-
Notifications
You must be signed in to change notification settings - Fork 12k
feat(@angular/cli): migrate e2e tests to async/await #15472
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
Conversation
Protractor recently introduced a breaking change in version 6.0.0. No more custom control flow - everyone should use async/await instead. This behaviour is already accessible in versions before 6.0.0 under the flag SELENIUM_PROMISE_MANAGER=false. By setting this flag to false - which is the default in 6.0.0 - I hope to reduce the migration time of new users of Angular using the CLI and using Protractor for e2e. I personnaly did the migration 2 years ago and I believe it is preferable to start directly in async/await mode. It makes the test easier to read and futurproof.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
Thanks for the PR! We discussed this in our team - This also needs a migration script to migrate all existing Protractor tests. We decided not to do it for now because of priorities. Will revisit this as part of our next major release. |
@vikerman @alan-agius4 Please let me know as soon as you'll be ready to merge such PR. For the moment it is more like a proposal for a PR. I am not sure we need to wait for a migration script to do that. In a way, it would be better for new users to start directly with the async/await mode (easier to understand, faster). Protractor migration feedback In a sense a migration tool from Protractor with custom promise manager to async/await would be a nice thing but in reality the two approaches are not fully equivalent. Protractor in async/await mode is far faster than the old mode. The async/await mode can create port exhaustion quite easily on Windows on code like: element.all(by.repeater('todo in todoList.todos'))
.filter(todo => todo.getText().then(label => label.indexOf('#10') !== -1))
.each(todo => todo.element(by.css('input')).click()) The same code with async/await runs out of ports see angular/protractor#4706 and https://github.com/dubzzz/protractor-move-async-await In my current company we did the change but it was more than just putting async and await where it needs, we needed to tweak some of our page objects to avoid port exhaustion (to be able to run our tests on Windows). |
Closing since this no longer the recommended path since protractor version 6 is deprecated. |
We can maybe bump towards the latest version of protractor instead? |
Version 7 is essentially the same as version 5, but includes some breaking changes. The CLI version 10 already uses version 7. |
Is there an issue or publicly shared vision on how team plans to move forward with Protractor? I'm afraid that we will be stuck with undebuggable control flow same as we're stuck with zone.js without support for native async/await for several years and no clear way forward. As for a migration path for existing apps. Maybe a fixer based on |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Protractor recently introduced a breaking change in version 6.0.0: no more custom control flow, everyone should use async/await instead.
Source: https://github.com/angular/protractor/blob/master/CHANGELOG.md
This behaviour is already accessible in versions before 6.0.0 under the flag SELENIUM_PROMISE_MANAGER=false.
By setting this flag to false - which is the default in 6.0.0 - I hope to reduce the migration time of new users of Angular using the CLI and using Protractor for e2e.
I personnaly did the migration 2 years ago and I believe it is preferable to start directly in async/await mode. It makes the test easier to read and futurproof.