-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[lexical-playground] CI: fix flaky MaxLength emoji e2e test #6257
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
@@ -75,7 +79,7 @@ test.describe('MaxLength', () => { | |||
await pasteFromClipboard(page, { | |||
'text/plain': 'lorem ipsum dolor sit amet, consectetur adipiscing elit', | |||
}); | |||
await page.keyboard.press('Backspace'); | |||
await pressBackspace(page, 1, STANDARD_KEYPRESS_DELAY_MS); |
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.
- do we need delay at 3 places ? or just one where the flakyness appears and adds additional
?
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.
strangely today i wasnt able to repro the failures on my machine
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.
ah ok if i run the whole test suit, able to repro it again
@@ -88,7 +92,7 @@ test.describe('MaxLength', () => { | |||
`, | |||
); | |||
|
|||
await page.keyboard.type('💏'); | |||
await page.keyboard.type('💏', {delay: STANDARD_KEYPRESS_DELAY_MS}); |
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.
also is this test failing in CI in past runs for all environments ? or we wanna add delays based on environments where it fails like firefox or iscollab etc
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.
feels abit overkill to guard the delays based on enviroment given at most a total of 300ms (1 third of a second) is added.
the benefit is the test is stable across all enviroments
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 just feel our e2e test suite will grow and scale overtime with more tests added, we should try to add whats needed, overusing sleeps is also not great experience, making e2e test suite slow. unless this test is flaky over all environments and needs sleeps
- also has this test failed CI in the past ? as priority should be stabilising CI and fix highly flaky tests 1st for improving on DevEx, having past failure references would be good to track in some comment or PR or issue.
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.
- Also, if we see the run https://github.com/facebook/lexical/actions/runs/9364683650/job/25778198911?pr=6246 for [lexical-playground] CI: standardise key press delay #6246 it actually shows Heading test is still flaky after the fix. How are we verifying the fix ? As its not consistent and still appears after this change

- That's why i prefer fixing the tests causing CI failures 1st to verify the flakyness is actually resolved
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.
thanks for pointing out a still flaky test result. ill investigate more tmr. today i discovered the repeat param which allows me to stress test to make sure the test is no longer flaky.
also, u have a valid point to reduce unnecessary sleeps so that devx and cost is not affected. i plan to experiment how much total delay would be added for x amount of default delay, and see if such a value is an acceptable value interms of devx and cost. and also, the projected value if our test suite grows
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.
for this test, it is consistenly flaky on my machine when i run the suite of firefox collab test. when ran isolated, it is also consistently flaky. after this fix and stress testing it 10 times, it passes consistently on all 10 runs
followup thoughts:
would experiment this in a seperate pr |
I wonder if there is an approach we could use where we attach an updateListener to the editor under test and wait for the update to be reconciled (with a timeout of 100ms or whatever the constant should be) after a keypress instead of always sleeping 100ms. Of course it wouldn't generalize to all keypresses but it might help remove a lot of sleeps and let us both speed up the tests and make them more reliable. |
+1 to Bob's point, if we could build a waitFor() kinda API which waits for the necessary step to complete with some Max timeout to Wait, it would be more reliable over sleeps which add constant delays without any underlying reason for the delays , was reading this yesterday https://shilpa-goley.medium.com/how-to-handle-flaky-tests-e738e5d22156 |
thanks @etrepum , that sounds like a good idea! will give it a try |
d997ce8
to
ef69f9b
Compare
@@ -75,7 +79,7 @@ test.describe('MaxLength', () => { | |||
await pasteFromClipboard(page, { | |||
'text/plain': 'lorem ipsum dolor sit amet, consectetur adipiscing elit', | |||
}); | |||
await page.keyboard.press('Backspace'); | |||
await pressBackspace(page, 1); |
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.
default value is 1 right, adding this again gives any additional value :) ?
tests failing due to flaky test |
Description
appears randomly thus making test flaky, add keypress delays when typing to prevent thatTest plan
add
--reporter=html --repeat-each=10
to "test-e2e-collab-firefox": "cross-env E2E_BROWSER=firefox E2E_EDITOR_MODE=rich-text-with-collab playwright test --project="firefox"", in build scriptthen run
npm run start & npm run test-e2e-collab-firefox
Before
After