jeroenheijmans/sample-angular-oauth2-oidc-with-auth-guards

Replace Protractor with other end-to-end testing utilities

jeroenheijmans opened this issue · 3 comments

Protractor used to be the default E2E (end to end) testing solution for Angular, but the Angular team has moved on. This is the announcement from the Protractor pages:

Protractor is deprecated and will reach end-of-life in August 2023. We discourage any new users from adopting Protractor and recommend existing users migrate to other end-to-end testing solutions. See what ending support means and read the end of life announcement for more information.

Which means this sample will have to change over to something else as well.

The E2E tests are actually a little important to me, because they give me enough confidence to easily keep doing security and Angular version upgrades. On the other hand, I don't want a overblown solution for a small sample like this.

If anyone from the community would decide to pick this up before I do (which is quite welcome of course!), I recommend posting a suggested solution here first before going at it, just to make sure the direction is one I want for this sample.

This is getting a tad more pressing. Recent builds are now failing with:

[00:48:20] I/launcher - Running 1 instances of WebDriver
[00:48:20] I/direct - Using ChromeDriver directly...
[00:48:20] E/launcher - session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 116.0.5845.110 with binary path /usr/bin/google-chrome
  (Driver info: chromedriver=114.0.5735.90 (386bc09e8f4f2e025eddae123f36f6263096ae49-refs/branch-heads/5735@{#1052}),platform=Linux 5.15.0-10[41](https://github.com/jeroenheijmans/sample-angular-oauth2-oidc-with-auth-guards/actions/runs/5987894959/job/16242540960#step:10:42)-azure x86_64)
[00:48:20] E/launcher - SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 116.0.5845.110 with binary path /usr/bin/google-chrome

Indirectly that's caused by Protractor, Selenium, and the version of webdriver-manager they use.

We can see if this is still patchable without replacing Protractor, but I expect more of these cases in the future.

Seems that Chrome started publishing their versions xml at a different location starting with v115, and removed the old option in v116 entirely, which is why webdriver-manager breaks: it can no longer find the right driver. See this webdriver-manager issue.

In that issue a workaround is linked, which works for me locally on Windows. But it feels super fragile, temporary, and hacky to make this a more permanent solution, and I hesitate putting in work to have that hack inside this repo.

I also tried how easy it would be to switch to Playwright or Cypress. The latter got somewhere but still not very far in limited time. I think Cypress is the way to go but either I or a community member would need to put in some time to make that work.

For now I'll let the e2e tests fail for a while longer, while I think about the approach to take. In the mean time if someone feels like porting this codebase's e2e tests to Cypress I'd welcome a PR.

Tried to introduce Nightwatch as a replacement, but it has been a frustrating experience. Publishing the branch for reference, but I think I'll give Playwright another go first, some time later.