Skip to content

Commit af11190

Browse files
committed
chore(ci): update Protractor version, remove custom waits
The latest Protractor version supports waiting for Angular2 applications, so remove custom waiting logic. Closes angular#3829
1 parent fcc6f2c commit af11190

13 files changed

Lines changed: 697 additions & 236 deletions

File tree

modules/angular2/src/test_lib/perf_util.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var bind = benchpress.bind;
55
var Options = benchpress.Options;
66

77
export function runClickBenchmark(config) {
8+
browser.ignoreSynchronization = !config.waitForAngular2;
89
var buttons = config.buttons.map(function(selector) { return $(selector); });
910
config.work = function() { buttons.forEach(function(button) { button.click(); }); };
1011
return runBenchmark(config);
@@ -24,9 +25,7 @@ export function runBenchmark(config) {
2425
});
2526
}
2627
var url = encodeURI(config.url + '?' + urlParams.join('&'));
27-
var getter = config.waitForAngular2 !== false ? browser.get(url) :
28-
browser.driver.get(browser.baseUrl + url);
29-
return getter.then(function() {
28+
return browser.get(url).then(function() {
3029
return global['benchpressRunner'].sample({
3130
id: config.id,
3231
execute: config.work,

modules/benchpress/src/webdriver/selenium_webdriver_adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class SeleniumWebDriverAdapter extends WebDriverAdapter {
3636

3737
capabilities(): Promise<any> {
3838
return this._convertPromise(
39-
this._driver.getCapabilities().then((capsObject) => capsObject.toJSON()));
39+
this._driver.getCapabilities().then((capsObject) => capsObject.serialize()));
4040
}
4141

4242
logs(type: string): Promise<any> {

modules/examples/e2e_test/async/async_spec.ts

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util';
22

3-
function whenStable(rootSelector) {
4-
// TODO(hankduan): remove this call once Protractor implements it
5-
return browser.executeAsyncScript('var el = document.querySelector("' + rootSelector + '");' +
6-
'window.getAngularTestability(el).whenStable(arguments[0]);');
7-
};
8-
93
describe('async', () => {
104
var URL = 'examples/src/async/index.html';
115

@@ -20,51 +14,48 @@ describe('async', () => {
2014

2115
it('should wait for asynchronous actions', () => {
2216
var timeout = $('#delayedIncrement');
23-
timeout.$('.action').click();
2417

2518
// At this point, the async action is still pending, so the count should
2619
// still be 0.
2720
expect(timeout.$('.val').getText()).toEqual('0');
2821

29-
whenStable('async-app')
30-
.then(() => {
31-
// whenStable should only be called when the async action finished,
32-
// so the count should be 1 at this point.
33-
expect(timeout.$('.val').getText()).toEqual('1');
34-
});
22+
timeout.$('.action').click();
23+
24+
// whenStable should only be called when the async action finished,
25+
// so the count should be 1 at this point.
26+
expect(timeout.$('.val').getText()).toEqual('1');
3527
});
3628

3729
it('should notice when asynchronous actions are cancelled', () => {
3830
var timeout = $('#delayedIncrement');
39-
timeout.$('.action').click();
4031

4132
// At this point, the async action is still pending, so the count should
4233
// still be 0.
4334
expect(timeout.$('.val').getText()).toEqual('0');
4435

36+
browser.ignoreSynchronization = true;
37+
timeout.$('.action').click();
38+
4539
timeout.$('.cancel').click();
46-
whenStable('async-app')
47-
.then(() => {
48-
// whenStable should be called since the async action is cancelled. The
49-
// count should still be 0;
50-
expect(timeout.$('.val').getText()).toEqual('0');
51-
});
40+
browser.ignoreSynchronization = false;
41+
42+
// whenStable should be called since the async action is cancelled. The
43+
// count should still be 0;
44+
expect(timeout.$('.val').getText()).toEqual('0');
5245
});
5346

5447
it('should wait for a series of asynchronous actions', () => {
5548
var timeout = $('#multiDelayedIncrements');
56-
timeout.$('.action').click();
5749

5850
// At this point, the async action is still pending, so the count should
5951
// still be 0.
6052
expect(timeout.$('.val').getText()).toEqual('0');
6153

62-
whenStable('async-app')
63-
.then(() => {
64-
// whenStable should only be called when all the async actions
65-
// finished, so the count should be 10 at this point.
66-
expect(timeout.$('.val').getText()).toEqual('10');
67-
});
54+
timeout.$('.action').click();
55+
56+
// whenStable should only be called when all the async actions
57+
// finished, so the count should be 10 at this point.
58+
expect(timeout.$('.val').getText()).toEqual('10');
6859
});
6960

7061
afterEach(verifyNoBrowserErrors);

modules/examples/e2e_test/http/http_spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ describe('http', function() {
1111

1212
it('should fetch and display people', function() {
1313
browser.get(URL);
14-
browser.sleep(200);
1514
expect(getComponentText('http-app', '.people')).toEqual('hello, Jeff');
1615
});
1716
});

modules/examples/e2e_test/jsonp/jsonp_spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ describe('jsonp', function() {
1111

1212
it('should fetch and display people', function() {
1313
browser.get(URL);
14-
browser.sleep(200);
1514
expect(getComponentText('jsonp-app', '.people')).toEqual('hello, caitp');
1615
});
1716
});

modules/examples/e2e_test/material/dialog_spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ describe('md-dialog', function() {
1111
openButton.click();
1212

1313
var dialog = element(by.css('.md-dialog'));
14-
browser.sleep(500);
1514

1615
expect(dialog.isPresent()).toEqual(true);
1716

modules/examples/e2e_test/web_workers/kitchen_sink/kitchen_sink_spec.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,27 @@ import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util';
22
import {Promise} from 'angular2/src/core/facade/async';
33

44
describe('WebWorkers Kitchen Sink', function() {
5-
afterEach(verifyNoBrowserErrors);
5+
afterEach(() => {
6+
verifyNoBrowserErrors();
7+
browser.ignoreSynchronization = false;
8+
});
69
var selector = "hello-app .greeting";
7-
var URL = browser.baseUrl + "examples/src/web_workers/kitchen_sink/index.html";
10+
var URL = "examples/src/web_workers/kitchen_sink/index.html";
811

912
it('should greet', () => {
1013
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
11-
browser.driver.get(URL);
14+
browser.ignoreSynchronization = true;
15+
browser.get(URL);
1216

1317
browser.wait(protractor.until.elementLocated(by.css(selector)), 15000);
1418
expect(element.all(by.css(selector)).first().getText()).toEqual("hello world!");
19+
1520
});
1621

1722
it('should change greeting', () => {
1823
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
19-
browser.driver.get(URL);
24+
browser.ignoreSynchronization = true;
25+
browser.get(URL);
2026

2127
browser.wait(protractor.until.elementLocated(by.css(selector)), 15000);
2228
element(by.css("hello-app .changeButton")).click();
@@ -27,7 +33,8 @@ describe('WebWorkers Kitchen Sink', function() {
2733

2834
it("should display correct key names", () => {
2935
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
30-
browser.driver.get(URL);
36+
browser.ignoreSynchronization = true;
37+
browser.get(URL);
3138
browser.wait(protractor.until.elementLocated(by.css(".sample-area")), 15000);
3239

3340
var area = element.all(by.css(".sample-area")).first();

modules/examples/e2e_test/web_workers/message_broker/message_broker_spec.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
import {verifyNoBrowserErrors} from "angular2/src/test_lib/e2e_util";
22
import {PromiseWrapper} from "angular2/src/core/facade/async";
33

4-
var URL = browser.baseUrl + 'examples/src/web_workers/message_broker/index.html';
4+
var URL = 'examples/src/web_workers/message_broker/index.html';
55

66
describe("MessageBroker", function() {
77

8-
afterEach(verifyNoBrowserErrors);
8+
afterEach(() => {
9+
verifyNoBrowserErrors();
10+
browser.ignoreSynchronization = false;
11+
});
912

1013
it("should bootstrap", () => {
1114
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
12-
browser.driver.get(URL);
15+
browser.ignoreSynchronization = true;
16+
browser.get(URL);
1317
waitForBootstrap();
1418
expect(element(by.css("app h1")).getText()).toEqual("WebWorker MessageBroker Test");
1519
});
1620

1721
it("should echo messages", () => {
1822
const VALUE = "Hi There";
1923
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
20-
browser.driver.get(URL);
24+
browser.ignoreSynchronization = true;
25+
browser.get(URL);
2126
waitForBootstrap();
2227

2328
var input = element.all(by.css("#echo_input")).first();

modules/examples/e2e_test/web_workers/todo/todo_spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ import {verifyNoBrowserErrors} from 'angular2/src/test_lib/e2e_util';
22
import {Promise} from 'angular2/src/core/facade/async';
33

44
describe('WebWorkers Todo', function() {
5-
afterEach(verifyNoBrowserErrors);
5+
afterEach(() => {
6+
verifyNoBrowserErrors();
7+
browser.ignoreSynchronization = false;
8+
});
69

7-
var URL = browser.baseUrl + "examples/src/web_workers/todo/index.html";
10+
var URL = "examples/src/web_workers/todo/index.html";
811

912
it('should bootstrap', () => {
1013
// This test can't wait for Angular 2 as Testability is not available when using WebWorker
11-
browser.driver.get(URL);
14+
browser.ignoreSynchronization = true;
15+
browser.get(URL);
1216

1317
waitForBootstrap();
1418
expect(element(by.css("#todoapp header")).getText()).toEqual("todos");

0 commit comments

Comments
 (0)