In my test I am calling and outside library to seed data into our backend before running some ui tests using protractor.
'use strict'
var dataBuilder = require('data_builder.js');
describe('test', function () {
var testData = {
name: 'foo',
title: 'bar',
...
};
beforeEach(function () {
//create test data on the backend
dataBuilder.create(testData).then(function (id) {
testData.id = id.id;
});
});
it('test something', function () {
...
});
As such the promise returned by the dataBuilder isn't resolved before the it() actually finishes. How can I add the promise returned by the dataBuilder into webDriver's flow control?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…