-
Notifications
You must be signed in to change notification settings - Fork 26
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
Test: improve PW tests flakiness #452
base: main
Are you sure you want to change the base?
Conversation
e12dd1c
to
4d02a53
Compare
@@ -1,15 +1,15 @@ | |||
import { test, expect, type Page } from '@playwright/test'; | |||
import { navigateToRepositories } from './helpers/navHelpers'; | |||
import { deleteAllRepos } from './helpers/deleteRepositories'; | |||
import { closePopupsIfExist } from './helpers/helpers'; | |||
import { closePopupsIfExist, retry } from './helpers/helpers'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although controversial, I agree with this :) I know that consoleDot sometimes gets stuck and I need to reload for it to load. But should we just not move this into the navigation function rather than introducing this to every single test? Would be cleaner and we would not forget to introduce it in other tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forgetting this can be an issue, but I didn't want to force it into existing helpers and I think it's mostly wanted only on the inital page load (also had some trouble trying this while prototyping) so I just added a new one, but it could be changed 😅
@Andrewgdewar what's your opinion, retry included in nav helpers or it needs to be explicitly used when desired?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think moving it to the navigation functions makes sense, and keeping the helper around in case we create other navigation based things!
expect(uuidList.length).toEqual(1); | ||
|
||
const repoUuid = uuidList[0]; | ||
while (true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am bit torn on this one. It might be necessary for stage/prod tests as we are not in control of queue or for parallel tests, but I feel that this might hide actual issues or make tests unpredictable. The golden rule of tests - if they pass, none cares about them would apply here, as if they pass but always wait for very long time, we would not notice it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also a bit torn on this as it's sort of a foot gun for the reason you mentioned, but on the other hand the queue being bogged down on the runner isn't supposed to be the thing this test is verifying so I included this for that reason. 😅
but I am open to this being axed from this test (or the entire helper) @Andrewgdewar what ya think? 👀
Nice, thanks! I have some comments, but in general I agree and like those changes. And nice work on commits ;) Was very easy to review commit by commit! |
thanks 🎉😇 |
3740056
to
d7a8471
Compare
This adds a `retry` helper and uses it for retrying all current navigations, which will be useful for mitigating flakiness during navigation in playwright tests that caused by consoledot slowness.
This adds a helper which is gonna indefinitely wait for a specific task to be picked up, before continuing. This will be useful for fixing the failures of tests that are waiting for a valid status of a repo, but can be broken by other tasks hogging up the task queue.
This moves a explicit timeout to the correct spot, we have a generous default test timeout, because as we should be setting explicit timeouts in the smallest units (i.e. actions, expects etc.).
This changes the closePopupsIfExist helper to not throw errors if multiple handlers try to close the same pop-up, it currently throws when a handler tries to close a pop-up has been already closed by a prior handler.
This fixes our `format` and `lint` npm commands to also check the PW test folder. Auto format and lint fix currently present violations.
This adds a new custom ESLint rule that will throw linting errors when any file inside the `_playwright-tests` folder will import any local code that is outside the PW test folder. This will be helpful for preventing breakages in our integration tests which pickup tests for that folder but not the other suff in the repo.
d7a8471
to
fba8504
Compare
expect(uuidList.length).toEqual(1); | ||
|
||
const repoUuid = uuidList[0]; | ||
while (true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I am reading this correctly we could wait forever.... also the timeout on the request below is excessive, I'd expect that to return in 5s or so?
Why would an api for tasks call take 60 seconds...
I like the idea of what you are doing here but lets have this while loop be based off off of a retry count, maybe configurable via passed in variable with a reasonable number set by default. maybe check this 10 times at maximum for example.
await sleep(5000); | ||
} | ||
|
||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unneeded return
} | ||
} | ||
|
||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the same as not having a return, I guess some prefer explicit returns. As long as you are aware 🤷
Summary
This PR changes/fixes a few things to combat test flakiness.