chore(ci): update Protractor version, remove custom waits

The latest Protractor version supports waiting for Angular2 applications,
so remove custom waiting logic.

Closes #3829
This commit is contained in:
Julie Ralph
2015-10-06 21:00:26 -07:00
parent fcc6f2c561
commit af1119063c
13 changed files with 697 additions and 236 deletions

View File

@ -5,6 +5,7 @@ var bind = benchpress.bind;
var Options = benchpress.Options;
export function runClickBenchmark(config) {
browser.ignoreSynchronization = !config.waitForAngular2;
var buttons = config.buttons.map(function(selector) { return $(selector); });
config.work = function() { buttons.forEach(function(button) { button.click(); }); };
return runBenchmark(config);
@ -24,9 +25,7 @@ export function runBenchmark(config) {
});
}
var url = encodeURI(config.url + '?' + urlParams.join('&'));
var getter = config.waitForAngular2 !== false ? browser.get(url) :
browser.driver.get(browser.baseUrl + url);
return getter.then(function() {
return browser.get(url).then(function() {
return global['benchpressRunner'].sample({
id: config.id,
execute: config.work,

View File

@ -36,7 +36,7 @@ export class SeleniumWebDriverAdapter extends WebDriverAdapter {
capabilities(): Promise<any> {
return this._convertPromise(
this._driver.getCapabilities().then((capsObject) => capsObject.toJSON()));
this._driver.getCapabilities().then((capsObject) => capsObject.serialize()));
}
logs(type: string): Promise<any> {

View File

@ -1,11 +1,5 @@
import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util';
function whenStable(rootSelector) {
// TODO(hankduan): remove this call once Protractor implements it
return browser.executeAsyncScript('var el = document.querySelector("' + rootSelector + '");' +
'window.getAngularTestability(el).whenStable(arguments[0]);');
};
describe('async', () => {
var URL = 'examples/src/async/index.html';
@ -20,51 +14,48 @@ describe('async', () => {
it('should wait for asynchronous actions', () => {
var timeout = $('#delayedIncrement');
timeout.$('.action').click();
// At this point, the async action is still pending, so the count should
// still be 0.
expect(timeout.$('.val').getText()).toEqual('0');
whenStable('async-app')
.then(() => {
// whenStable should only be called when the async action finished,
// so the count should be 1 at this point.
expect(timeout.$('.val').getText()).toEqual('1');
});
timeout.$('.action').click();
// whenStable should only be called when the async action finished,
// so the count should be 1 at this point.
expect(timeout.$('.val').getText()).toEqual('1');
});
it('should notice when asynchronous actions are cancelled', () => {
var timeout = $('#delayedIncrement');
timeout.$('.action').click();
// At this point, the async action is still pending, so the count should
// still be 0.
expect(timeout.$('.val').getText()).toEqual('0');
browser.ignoreSynchronization = true;
timeout.$('.action').click();
timeout.$('.cancel').click();
whenStable('async-app')
.then(() => {
// whenStable should be called since the async action is cancelled. The
// count should still be 0;
expect(timeout.$('.val').getText()).toEqual('0');
});
browser.ignoreSynchronization = false;
// whenStable should be called since the async action is cancelled. The
// count should still be 0;
expect(timeout.$('.val').getText()).toEqual('0');
});
it('should wait for a series of asynchronous actions', () => {
var timeout = $('#multiDelayedIncrements');
timeout.$('.action').click();
// At this point, the async action is still pending, so the count should
// still be 0.
expect(timeout.$('.val').getText()).toEqual('0');
whenStable('async-app')
.then(() => {
// whenStable should only be called when all the async actions
// finished, so the count should be 10 at this point.
expect(timeout.$('.val').getText()).toEqual('10');
});
timeout.$('.action').click();
// whenStable should only be called when all the async actions
// finished, so the count should be 10 at this point.
expect(timeout.$('.val').getText()).toEqual('10');
});
afterEach(verifyNoBrowserErrors);

View File

@ -11,7 +11,6 @@ describe('http', function() {
it('should fetch and display people', function() {
browser.get(URL);
browser.sleep(200);
expect(getComponentText('http-app', '.people')).toEqual('hello, Jeff');
});
});

View File

@ -11,7 +11,6 @@ describe('jsonp', function() {
it('should fetch and display people', function() {
browser.get(URL);
browser.sleep(200);
expect(getComponentText('jsonp-app', '.people')).toEqual('hello, caitp');
});
});

View File

@ -11,7 +11,6 @@ describe('md-dialog', function() {
openButton.click();
var dialog = element(by.css('.md-dialog'));
browser.sleep(500);
expect(dialog.isPresent()).toEqual(true);

View File

@ -2,21 +2,27 @@ import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util';
import {Promise} from 'angular2/src/core/facade/async';
describe('WebWorkers Kitchen Sink', function() {
afterEach(verifyNoBrowserErrors);
afterEach(() => {
verifyNoBrowserErrors();
browser.ignoreSynchronization = false;
});
var selector = "hello-app .greeting";
var URL = browser.baseUrl + "examples/src/web_workers/kitchen_sink/index.html";
var URL = "examples/src/web_workers/kitchen_sink/index.html";
it('should greet', () => {
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
browser.driver.get(URL);
browser.ignoreSynchronization = true;
browser.get(URL);
browser.wait(protractor.until.elementLocated(by.css(selector)), 15000);
expect(element.all(by.css(selector)).first().getText()).toEqual("hello world!");
});
it('should change greeting', () => {
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
browser.driver.get(URL);
browser.ignoreSynchronization = true;
browser.get(URL);
browser.wait(protractor.until.elementLocated(by.css(selector)), 15000);
element(by.css("hello-app .changeButton")).click();
@ -27,7 +33,8 @@ describe('WebWorkers Kitchen Sink', function() {
it("should display correct key names", () => {
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
browser.driver.get(URL);
browser.ignoreSynchronization = true;
browser.get(URL);
browser.wait(protractor.until.elementLocated(by.css(".sample-area")), 15000);
var area = element.all(by.css(".sample-area")).first();

View File

@ -1,15 +1,19 @@
import {verifyNoBrowserErrors} from "angular2/src/test_lib/e2e_util";
import {PromiseWrapper} from "angular2/src/core/facade/async";
var URL = browser.baseUrl + 'examples/src/web_workers/message_broker/index.html';
var URL = 'examples/src/web_workers/message_broker/index.html';
describe("MessageBroker", function() {
afterEach(verifyNoBrowserErrors);
afterEach(() => {
verifyNoBrowserErrors();
browser.ignoreSynchronization = false;
});
it("should bootstrap", () => {
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
browser.driver.get(URL);
browser.ignoreSynchronization = true;
browser.get(URL);
waitForBootstrap();
expect(element(by.css("app h1")).getText()).toEqual("WebWorker MessageBroker Test");
});
@ -17,7 +21,8 @@ describe("MessageBroker", function() {
it("should echo messages", () => {
const VALUE = "Hi There";
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
browser.driver.get(URL);
browser.ignoreSynchronization = true;
browser.get(URL);
waitForBootstrap();
var input = element.all(by.css("#echo_input")).first();

View File

@ -2,13 +2,17 @@ import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util';
import {Promise} from 'angular2/src/core/facade/async';
describe('WebWorkers Todo', function() {
afterEach(verifyNoBrowserErrors);
afterEach(() => {
verifyNoBrowserErrors();
browser.ignoreSynchronization = false;
});
var URL = browser.baseUrl + "examples/src/web_workers/todo/index.html";
var URL = "examples/src/web_workers/todo/index.html";
it('should bootstrap', () => {
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
browser.driver.get(URL);
browser.ignoreSynchronization = true;
browser.get(URL);
waitForBootstrap();
expect(element(by.css("#todoapp header")).getText()).toEqual("todos");