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

Flaky Protractor tests with OAuth2 #13723

Closed
1 task
pascalgrimaud opened this issue Jan 26, 2021 · 19 comments · Fixed by #13726, #13732 or #13777
Closed
1 task

Flaky Protractor tests with OAuth2 #13723

pascalgrimaud opened this issue Jan 26, 2021 · 19 comments · Fixed by #13726, #13732 or #13777

Comments

@pascalgrimaud
Copy link
Member

Overview of the issue

Since this PR #13530, the Protractor tests failed most of the time.
See:

cc @mraible

protractor_monolith_oauth2
protractor_nodatabase_oauth2

Motivation for or Use Case
Reproduce the error
Related issues
Suggest a Fix
JHipster Version(s)

Current master

JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@mraible
Copy link
Contributor

mraible commented Jan 26, 2021 via email

@pascalgrimaud
Copy link
Member Author

I don't know, I'm not a Protractor expert like you :)
But we could give a try

@pascalgrimaud
Copy link
Member Author

I'm reopening this, as it's still flaky
nodatabase_flaky

@mraible
Copy link
Contributor

mraible commented Jan 28, 2021

I'll look into them now...

@pascalgrimaud
Copy link
Member Author

I tried some change too, but didn't fix it yet.

My workflow:

@mraible
Copy link
Contributor

mraible commented Jan 28, 2021

I typically re-create the failing app locally, then run:

npm run ci:e2e:package
npm run ci:e2e:prepare
npm run ci:e2e:run

If it passes locally, it's a CI issue and we need to add pauses, wait fors, etc...

@pascalgrimaud
Copy link
Member Author

Locally, it passes, I couldn't reproduce.

@mraible
Copy link
Contributor

mraible commented Jan 28, 2021

The first time I tried it, it didn't work.

[1]   2 passing (9s)
[1]   1 failing
[1]
[1]   1) Administration
[1]        "before all" hook: ret for "should load metrics":
[1]      TimeoutError: Wait timed out after 5003ms
[1]       at /Users/mraible/dev/react-nodatabase-oauth2-gradle/node_modules/selenium-webdriver/lib/promise.js:2201:17
[1]       at runMicrotasks (<anonymous>)
[1]       at processTicksAndRejections (internal/process/task_queues.js:93:5)

I tried again, and it did pass. Can we change the e2e script to try npm run ci:e2e:run multiple times?

I saw this recently with Protractor when running e2e tests on generated entities. It'd always pause on the edit screens. If I canceled and tried again, it'd pass on that edit screen, then pause/fail on the next one. If you canceled and restarted once for each generated entity, all tests eventually pass.

@mraible
Copy link
Contributor

mraible commented Jan 28, 2021

Are these running with JHI_E2E_HEADLESS=true? That might be an option. Or use another browser, like Firefox. I just tried and it works (from protractor.conf.js):

capabilities: {
  browserName: 'firefox',
},

NOTE: I did have to run npx webdriver-manager update after changing the browserName value.

@mraible
Copy link
Contributor

mraible commented Jan 28, 2021

Here's an attempted fix: #13754.

@pascalgrimaud
Copy link
Member Author

That's one of the reason we decided to use Cypress.
Protractor is so random

Another solution would be to completely migrate to Cypress in Daily builds, and definitively abandon Protractor there

@mraible
Copy link
Contributor

mraible commented Jan 28, 2021 via email

@mraible
Copy link
Contributor

mraible commented Jan 29, 2021

If Cypress tests prove to be flaky, we can add another implementation in Playwright. 😜

@pascalgrimaud
Copy link
Member Author

@mraible : for your information, I revert your PR here:

Then, I launch 5 NoDatabase builds consecutively.
nodatabase_revert

So for me, there is something to do with your PR.
If you're ok, we should revert it, and only add the username/password for Okta.
The other codes should not changed.

@mraible
Copy link
Contributor

mraible commented Jan 29, 2021

I'm OK with a revert. None of these tests hit Okta and I tend to recommend Keycloak for CI anyway.

@pascalgrimaud
Copy link
Member Author

Thanks, I'll take care of it tonight, after my day work

@pascalgrimaud pascalgrimaud self-assigned this Jan 29, 2021
@mraible
Copy link
Contributor

mraible commented Jan 29, 2021

Woah! I didn't realize you want to revert all of my changes to support Okta. It works locally, most of the time (or at least, more than before). I'm OK with it for a release, but I'd love to collaborate with you on a blog post to explain the why. :)

@mraible
Copy link
Contributor

mraible commented Jan 29, 2021

BTW, I'm cool if your reason is "because Okta sucks!" We can do better. We should be better than Keycloak, IMHO.

@pascalgrimaud
Copy link
Member Author

@mraible : sorry, I didn't explain well. Let me try again :-D

My branch with this commit pascalgrimaud@0a5e996 is only here to confirm that the introduced code makes Protractor to become flaky -> this branch is only for test

I don't want to revert all the code.
We should keep the username, password, and revert the other code (browser, element, etc), which seems not to be related directly to username/password

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment