Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(driverProviders): clean up driver provider q usage #5034

Merged
merged 3 commits into from
Nov 15, 2018

Conversation

cnishina
Copy link
Member

  • Remove driverProviderUseExistingWebDriver since the generation of the selenium server is already accomplished when providing a selenium address in driverProvider.ts. Also clean up docs and tests.
  • Use native promises over q promises.

lib/driverProviders/driverProvider.ts Outdated Show resolved Hide resolved
lib/driverProviders/driverProvider.ts Outdated Show resolved Hide resolved
lib/driverProviders/driverProvider.ts Outdated Show resolved Hide resolved
lib/driverProviders/driverProvider.ts Outdated Show resolved Hide resolved
lib/driverProviders/hosted.ts Outdated Show resolved Hide resolved
lib/driverProviders/mock.ts Outdated Show resolved Hide resolved
@cnishina cnishina force-pushed the driverProviderUseExisting branch 10 times, most recently from caea081 to 7ff7d2d Compare November 13, 2018 22:44
- Remove driverProviderUseExistingWebDriver since the generation of the selenium server is already accomplished when providing a selenium address in driverProvider.ts. Also clean up docs and tests.
- Use native promises over q promises.
- Comment out driverProviderLocal tests. If the flag is set, the
controlFlow method is undefined and fails this test. The error is as
follows: this.driver.controlFlow is not a function at ProtractorBrowser.angularAppRoot
@cnishina cnishina force-pushed the driverProviderUseExisting branch 5 times, most recently from 39e02d1 to e13478b Compare November 14, 2018 01:25
… and angularAppRoot

- Enabled the driverProviderLocal tests
- Remove auto unwrap test for a WebElement. Reference PR angular#3471
@cnishina
Copy link
Member Author

Errrr....Fixed it!

first try

lib/browser.ts Outdated Show resolved Hide resolved
lib/browser.ts Outdated Show resolved Hide resolved
lib/browser.ts Outdated Show resolved Hide resolved
return this.driver.controlFlow().execute(() => {
return this.bpClient.setWaitEnabled(!this.internalIgnoreSynchronization);
});
return this.bpClient.setWaitEnabled(!this.internalIgnoreSynchronization);
}
})
.then(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This promise chain should eventually become async/await, but let's save that for another Pr.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, this promise chain might be better contained in a separate PR.

lib/driverProviders/attachSession.ts Outdated Show resolved Hide resolved
lib/driverProviders/direct.ts Outdated Show resolved Hide resolved
lib/driverProviders/driverProvider.ts Outdated Show resolved Hide resolved
lib/driverProviders/driverProvider.ts Outdated Show resolved Hide resolved
lib/driverProviders/local.ts Outdated Show resolved Hide resolved
@cnishina
Copy link
Member Author

Fixes are in!

done

lib/browser.ts Show resolved Hide resolved
lib/browser.ts Outdated Show resolved Hide resolved
if (timeout) {
let errMsg = `Timed out waiting for asynchronous Angular tasks to finish after ` +
`${timeout}. This may be because the current page is not an Angular ` +
`application. Please see the FAQ for more details: ` +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do ourselves a favor and extract as much as possible from this if statement into a private function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great idea but I think this PR is getting a little out of hand and not keeping on point to what the original description was. I'll write an issue on this for an improvement.

}, this.allScriptsTimeout, 'Plugins.waitForCondition()');
} catch (err) {
let timeout: RegExpExecArray;
if (/asynchronous script timeout/.test(err.message)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well extract this into a private function to make it more readable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this.

- In lieu of Promise.resolve(...) for async await, just return the item
- Clean up JSDocs for q.promise
- Clean up interactive tests to close the browser window and let
Protractor quit the driver session
@cnishina
Copy link
Member Author

Reference #4995

@cnishina cnishina merged commit 149a2ac into angular:selenium4 Nov 15, 2018
cnishina added a commit to cnishina/protractor that referenced this pull request Dec 19, 2018
…ngular#5034)

Driver providers and tests:

- Use native promises over q promises in driver providers
- Remove driverProviderUseExistingWebDriver since the generation of the selenium server is already accomplished when providing a selenium address in driverProvider.ts. Also clean up docs and tests.
- Enabled the driverProviderLocal tests
- Clean up JSDocs for q.promise

Basic lib spec:

- Remove auto unwrap test for a WebElement. Reference PR angular#3471

Browser:

- Remove control flow from waitForAngularEnabled, waitForAngular, and angularAppRoot in the Browser class.
cnishina added a commit to cnishina/protractor that referenced this pull request Mar 23, 2019
…ngular#5034)

Driver providers and tests:

- Use native promises over q promises in driver providers
- Remove driverProviderUseExistingWebDriver since the generation of the selenium server is already accomplished when providing a selenium address in driverProvider.ts. Also clean up docs and tests.
- Enabled the driverProviderLocal tests
- Clean up JSDocs for q.promise

Basic lib spec:

- Remove auto unwrap test for a WebElement. Reference PR angular#3471

Browser:

- Remove control flow from waitForAngularEnabled, waitForAngular, and angularAppRoot in the Browser class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants