Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 0474681

Browse files
committed
update all the tests in basic to run
1 parent e276c6a commit 0474681

File tree

6 files changed

+25
-32
lines changed

6 files changed

+25
-32
lines changed

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ gulp.task('prepublish', function(done) {
112112

113113
gulp.task('pretest', function(done) {
114114
runSequence('checkVersion',
115-
['webdriver:update', 'jshint', 'tslint', 'format'], 'tsc', 'built:copy', 'tsc:spec', done);
115+
'tsc', 'built:copy', 'tsc:spec', done);
116116
});
117117

118118
gulp.task('default',['prepublish']);

lib/browser.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -818,13 +818,13 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {
818818
* @param {number=} opt_timeout Number of milliseconds to wait for Angular to
819819
* start.
820820
*/
821-
get(destination: string, timeout = this.getPageTimeout) {
821+
async get(destination: string, timeout = this.getPageTimeout) {
822822
destination = this.baseUrl.indexOf('file://') === 0 ? this.baseUrl + destination :
823823
url.resolve(this.baseUrl, destination);
824-
if (this.ignoreSynchronization) {
825-
return this.driver.get(destination)
826-
.then(() => this.driver.controlFlow().execute(() => this.plugins_.onPageLoad(this)))
827-
.then(() => null);
824+
if (!await this.waitForAngularEnabled()) {
825+
await this.driver.get(destination);
826+
await this.plugins_.onPageLoad(this);
827+
return;
828828
}
829829

830830
let msg = (str: string) => {

lib/element.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ export class ElementArrayFinder extends WebdriverWebElement {
472472
.then((arr: any) => Promise.all(arr.map(actionFn)))
473473
.then(
474474
(value: any) => {
475-
return {passed: true, value: value};
475+
return {passed: true, value};
476476
},
477477
(error: any) => {
478478
return {passed: false, value: error};
@@ -1065,15 +1065,15 @@ export class ElementFinder extends WebdriverWebElement {
10651065
* the element is present on the page.
10661066
*/
10671067
async isPresent(): Promise<boolean> {
1068-
const arr = await this.parentElementArrayFinder.getWebElements();
1069-
if (arr.length === 0) {
1070-
return false;
1071-
}
10721068
try {
1069+
const arr = await this.parentElementArrayFinder.getWebElements();
1070+
if (arr.length === 0) {
1071+
return false;
1072+
}
10731073
// is present, whether it is enabled or not
10741074
return await arr[0].isEnabled();
10751075
} catch (err) {
1076-
falseIfMissing(err);
1076+
return falseIfMissing(err);
10771077
}
10781078
}
10791079

spec/basic/polling_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('synchronizing with pages that poll', () => {
88
await browser.get('index.html#/polling');
99
});
1010

11-
it('avoids timeouts using ignoreSynchronization', async () => {
11+
it('avoids timeouts using waitForAngularEnabled set to false', async () => {
1212
const startButton = element(by.id('pollstarter'));
1313

1414
const count = element(by.binding('count'));
@@ -17,7 +17,7 @@ describe('synchronizing with pages that poll', () => {
1717
await startButton.click();
1818

1919
// Turn this on to see timeouts.
20-
browser.ignoreSynchronization = true;
20+
await browser.waitForAngularEnabled(false);
2121

2222
const textBefore = await count.getText();
2323
expect(textBefore).toBeGreaterThan(-1);

spec/basic/restart_spec.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
describe('browser.restart', () => {
2-
it('doesn\'t break ignoreSynchronization', async () => {
2+
it(`doesn't break waitForAngularEnabled set to false`, async () => {
33
await browser.get('index.html#/polling');
44
await browser.restart();
55

6-
browser.ignoreSynchronization = true;
7-
// Get a non-angular page. It shouldn't fail if ignoreSynchronization is on.
6+
await browser.waitForAngularEnabled(false);
7+
console.log(await browser.waitForAngularEnabled());
8+
// Get a non-angular page. It shouldn't fail if waitForAngularEnabled
9+
// is turned off.
810
await browser.get('https://google.com/');
911
});
1012

11-
afterAll(() => {
12-
browser.ignoreSynchronization = false;
13+
afterAll(async () => {
14+
await browser.waitForAngularEnabled(true);
1315
});
1416
});

spec/basicConf.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,13 @@ exports.config = {
99

1010
// Spec patterns are relative to this directory.
1111
specs: [
12-
'basic/lib_spec.js',
13-
'basic/locators_spec.js'
14-
// 'basic/elements_spec.js',
15-
// 'basic/expected_conditions_spec.js',
16-
// 'basic/handling_spec.js',
17-
// 'basic/mockmodule_spec.js',
18-
// 'basic/navigation_spec.js',
19-
// 'basic/polling_spec.js',
20-
// 'basic/restart_spec.js',
21-
// 'basic/synchronize_spec.js',
12+
'basic/*_spec.js'
2213
],
2314

2415
// Exclude patterns are relative to this directory.
25-
// exclude: [
26-
// 'basic/exclude*.js'
27-
// ],
16+
exclude: [
17+
'basic/exclude*.js'
18+
],
2819

2920
capabilities: env.capabilities,
3021

0 commit comments

Comments
 (0)