-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
wp-scripts: add support for Playwright #53108
Conversation
Size Change: 0 B Total Size: 1.51 MB ℹ️ View Unchanged
|
Thank you for starting this PR and exploring how we can add support for Playwright to
It sounds like a great idea. If folks are fine using the default config provided by
I see that we install browsers on CI with npx playwright install chromium firefox webkit --with-deps You can replicate how we install browsers when running gutenberg/packages/scripts/scripts/test-e2e.js Lines 31 to 33 in 422d12a
This way it magically works for the dev when they run it for the first time. My biggest concern was initially about adding new dependence for Playwright, while we have dependencies present for Puppeteer in Both tools have a similar impact, a little bit over 15 MB which isn't surprising as Playwright was forked from Puppeteer. The great news is that both are optimized and they don't install browsers together with npm packages. It all happens afterward lazily when you actually use the tool. At some point, we will have to revisit the architecture of As of today, when you install As for this PR, I guess it's better to start with a simpler approach and live for the time being with two concurrent tools bundled with Now, test-e2e could do what you suggested - detect a config and run a corresponding tool through these packages. We could even set these extracted packages as optional peer dependencies, and possibly even offer a prompt helping to install them on the fly. |
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.
The changes applied to the ESLint plugin and WP scripts look good.
I don’t know much about Playwright configuration in Gutenberg, but everythings seems to work correctly.
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 looks great as it stands for the @wordpress/scripts
and @wordpress/eslint-plugin
with all the remarks I shared in #53108 (comment).
@kevin940726 or @WunderBart, could you help verify that refactoring to ESLint rules and configs work as intended?
@@ -16,6 +16,7 @@ test.describe( 'Nonce', () => { | |||
await admin.createNewPost(); | |||
await page.keyboard.press( 'Enter' ); | |||
// Wait until the network is idle. | |||
// eslint-disable-next-line playwright/no-networkidle |
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.
Someone could verify that these exceptions caught after the ESLint package upgrade should be refactored in the follow-up PR.
What's blocking this from reviewing / merging? |
npm packages got published to npm today, so I say we waited enough to gather additional feedback. We will have two weeks to adjust if necessary before another publishing window. |
Flaky tests detected in ab5ca23. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6040775971
|
Thanks for the work! FWIW, I didn't want to move Playwright into I don't feel that strongly about this or we have to revert this though. Just want to share my opinions for future reference 🙂 . |
What?
Adds
wp-scripts test-playwright
with a default Playwright configuration for running e2e tests.Adds a new
test-playwright
config to@wordpress/eslint-plugin
.Note
Idea: enhance
test-e2e
to automatically detect whether the given configuration is for Puppeteer or Playwright. Needs to accommodate for setups using both together.Why?
Playwright is the future for e2e tests in WordPress. Adding support directly to wp-scripts makes it easier to use Playwright not just for cure, but for everyone.
How?
The setup really follows the one for
test-e2e
, though things are a bit simpler because no Jest is involved.Testing Instructions
npm run test:e2e:playwright
andtest:performance:playwright
are changed in the PR to use wp-scripts and the tests still run & passYou can also run
./node_modules/.bin/wp-scripts test-playwright
and then provide a different config to run tests in another project.Testing Instructions for Keyboard
Screenshots or screencast