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

Commit

Permalink
update all the tests in basic to run
Browse files Browse the repository at this point in the history
  • Loading branch information
cnishina committed Nov 16, 2018
1 parent e276c6a commit 179622a
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 32 deletions.
1 change: 1 addition & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
name: Selenium Start
background: true
command: |
./node_modules/webdriver-manager/bin/webdriver-manager update
./node_modules/.bin/webdriver-manager-replacement update --gecko false
./node_modules/.bin/webdriver-manager-replacement start --gecko false
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ gulp.task('prepublish', function(done) {

gulp.task('pretest', function(done) {
runSequence('checkVersion',
['webdriver:update', 'jshint', 'tslint', 'format'], 'tsc', 'built:copy', 'tsc:spec', done);
'tsc', 'built:copy', 'tsc:spec', done);
});

gulp.task('default',['prepublish']);
10 changes: 5 additions & 5 deletions lib/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -818,13 +818,13 @@ export class ProtractorBrowser extends AbstractExtendedWebDriver {
* @param {number=} opt_timeout Number of milliseconds to wait for Angular to
* start.
*/
get(destination: string, timeout = this.getPageTimeout) {
async get(destination: string, timeout = this.getPageTimeout) {
destination = this.baseUrl.indexOf('file://') === 0 ? this.baseUrl + destination :
url.resolve(this.baseUrl, destination);
if (this.ignoreSynchronization) {
return this.driver.get(destination)
.then(() => this.driver.controlFlow().execute(() => this.plugins_.onPageLoad(this)))
.then(() => null);
if (!await this.waitForAngularEnabled()) {
await this.driver.get(destination);
await this.plugins_.onPageLoad(this);
return;
}

let msg = (str: string) => {
Expand Down
12 changes: 6 additions & 6 deletions lib/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ export class ElementArrayFinder extends WebdriverWebElement {
.then((arr: any) => Promise.all(arr.map(actionFn)))
.then(
(value: any) => {
return {passed: true, value: value};
return {passed: true, value};
},
(error: any) => {
return {passed: false, value: error};
Expand Down Expand Up @@ -1065,15 +1065,15 @@ export class ElementFinder extends WebdriverWebElement {
* the element is present on the page.
*/
async isPresent(): Promise<boolean> {
const arr = await this.parentElementArrayFinder.getWebElements();
if (arr.length === 0) {
return false;
}
try {
const arr = await this.parentElementArrayFinder.getWebElements();
if (arr.length === 0) {
return false;
}
// is present, whether it is enabled or not
return await arr[0].isEnabled();
} catch (err) {
falseIfMissing(err);
return falseIfMissing(err);
}
}

Expand Down
4 changes: 2 additions & 2 deletions spec/basic/polling_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('synchronizing with pages that poll', () => {
await browser.get('index.html#/polling');
});

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

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

// Turn this on to see timeouts.
browser.ignoreSynchronization = true;
await browser.waitForAngularEnabled(false);

const textBefore = await count.getText();
expect(textBefore).toBeGreaterThan(-1);
Expand Down
12 changes: 7 additions & 5 deletions spec/basic/restart_spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
describe('browser.restart', () => {
it('doesn\'t break ignoreSynchronization', async () => {
it(`doesn't break waitForAngularEnabled set to false`, async () => {
await browser.get('index.html#/polling');
await browser.restart();

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

afterAll(() => {
browser.ignoreSynchronization = false;
afterAll(async () => {
await browser.waitForAngularEnabled(true);
});
});
17 changes: 4 additions & 13 deletions spec/basicConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,13 @@ exports.config = {

// Spec patterns are relative to this directory.
specs: [
'basic/lib_spec.js',
'basic/locators_spec.js'
// 'basic/elements_spec.js',
// 'basic/expected_conditions_spec.js',
// 'basic/handling_spec.js',
// 'basic/mockmodule_spec.js',
// 'basic/navigation_spec.js',
// 'basic/polling_spec.js',
// 'basic/restart_spec.js',
// 'basic/synchronize_spec.js',
'basic/*_spec.js'
],

// Exclude patterns are relative to this directory.
// exclude: [
// 'basic/exclude*.js'
// ],
exclude: [
'basic/exclude*.js'
],

capabilities: env.capabilities,

Expand Down

0 comments on commit 179622a

Please sign in to comment.