fix(testing): Fixed race condition in WebWorker and Routing tests
This commit is contained in:
parent
5c21af95c7
commit
eee2146735
|
@ -7,12 +7,6 @@ function waitForElement(selector) {
|
|||
browser.wait(EC.presenceOf($(selector)), 10000);
|
||||
}
|
||||
|
||||
// returns a promise that resolves in the given number of milliseconds
|
||||
function wait(time) {
|
||||
var promise = new Promise((resolve, reject) => { setTimeout(resolve, time); });
|
||||
return promise;
|
||||
}
|
||||
|
||||
describe('routing inbox-app', function() {
|
||||
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
@ -69,8 +63,9 @@ describe('routing inbox-app', function() {
|
|||
waitForElement('#item-10');
|
||||
element(by.css('#item-10')).click();
|
||||
waitForElement('#record-id');
|
||||
browser.wait(wait(500), 600);
|
||||
expect(element(by.css('#record-id')).getText()).toEqual('ID: 10');
|
||||
var recordId = element(by.css("#record-id"));
|
||||
browser.wait(protractor.until.elementTextIs(recordId, "ID: 10"), 5000);
|
||||
expect(recordId.getText()).toEqual('ID: 10');
|
||||
});
|
||||
|
||||
it('should navigate back to the email inbox page when the back button is clicked', function() {
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util';
|
||||
import {Promise} from 'angular2/src/facade/async';
|
||||
|
||||
// returns a promise that resolves in the given number of milliseconds
|
||||
function wait(time) {
|
||||
var promise = new Promise((resolve, reject) => { setTimeout(resolve, time); });
|
||||
return promise;
|
||||
}
|
||||
|
||||
describe('WebWorkers', function() {
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
var selector = "hello-app .greeting";
|
||||
|
@ -23,9 +17,10 @@ describe('WebWorkers', function() {
|
|||
browser.get(URL);
|
||||
|
||||
browser.wait(protractor.until.elementLocated(by.css(selector)), 5000);
|
||||
element.all(by.css(".changeButton")).first().click();
|
||||
browser.wait(wait(500), 600);
|
||||
expect(element.all(by.css(selector)).first().getText()).toEqual("howdy world!");
|
||||
element(by.css("hello-app .changeButton")).click();
|
||||
var elem = element(by.css(selector));
|
||||
browser.wait(protractor.until.elementTextIs(elem, "howdy world!"), 5000);
|
||||
expect(elem.getText()).toEqual("howdy world!");
|
||||
});
|
||||
|
||||
it("should display correct key names", () => {
|
||||
|
@ -34,9 +29,9 @@ describe('WebWorkers', function() {
|
|||
|
||||
var area = element.all(by.css(".sample-area")).first();
|
||||
expect(area.getText()).toEqual('(none)');
|
||||
browser.wait(wait(500), 600);
|
||||
|
||||
area.sendKeys('u');
|
||||
browser.wait(protractor.until.elementTextIs(area, "U"), 5000);
|
||||
expect(area.getText()).toEqual("U");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue