Fix flaky tests in navigation.spec.js and other tests related to the Post Editor Template mode#51790
Conversation
navigation.spec.js
|
Size Change: 0 B Total Size: 1.42 MB ℹ️ View Unchanged
|
|
Ugh! There are still e2e tests that fail; they look unrelated, though... If they do not pass after re-running them, I'll probably merge this PR anyway. 🤷 EDIT: I link the failing tests for visibility |
navigation.spec.jsnavigation.spec.js and other tests related to the Post Editor Template mode
|
I fixed other tests that were failing (also locally) related to the Post Editor Template mode. I did so by waiting for the Editor canvas to be loaded before using the keyboard. |
9ee7e63 to
c0139fe
Compare
|
I rebased this so that #51826 is included. Hopefully there's a ✅ |
|
@DAreRodz the Puppeteer test finally passed, so even if that one is still flaky, I'm going to merge this to unblock Great work finding out the problem with these ones! 🎉 |
|
Oh, I missed the previous @noisysocks' comment. Thanks for the other fix, Robert 🙂 |
| // Test: overlay menu traps focus | ||
| await page.keyboard.press( 'Tab' ); | ||
| await page.keyboard.press( 'Tab' ); | ||
| await pageUtils.pressKeys( 'Tab', { times: 2, delay: 50 } ); |
There was a problem hiding this comment.
I love that it solves the issue and I have no problem merging this. I'm just wondering if there's an actual bug that makes us use delay, which is a last resort? It feels weird to me that Playwright has no problem tabbing through elements in the editor but is "too fast" in the frontend 🤔 . Maybe there's something obvious I'm missing though!
…e Post Editor Template mode (WordPress#51790) * Add delay between consecutive keystrokes * Fix post editor template mode tests

What?
Fixes flaky tests in the
navigation.spec.jsfile belonging to the 'Navigation block - Frontend interactivity' test group.Other tests were failing, this time related to the
Post Editor Template mode(see post-editor-template-mode.spec.js). I fixed them as well.Why?
The feature works fine, but tests are randomly failing because Playwright seems to fail with consecutive
Tabkeystrokes without a delay in between.How?
Replaced consecutive
page.keyboard.presscalls withpageUtils.pressKeys, passing a delay of 50 milliseconds.Testing Instructions
Automatic e2e tests should pass now.