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

Playwright utils: move plugin-specific request utils to global-setup #52339

Closed
swissspidy opened this issue Jul 5, 2023 · 2 comments · Fixed by #52412
Closed

Playwright utils: move plugin-specific request utils to global-setup #52339

swissspidy opened this issue Jul 5, 2023 · 2 comments · Fixed by #52412
Assignees
Labels
[Package] E2E Test Utils /packages/e2e-test-utils [Package] E2E Tests /packages/e2e-tests

Comments

@swissspidy
Copy link
Member

What problem does this address?

Right now the request utils in e2e-test-utils-playwright contain a lot of Gutenberg-specific logic that does not apply to other setups:

await Promise.all( [
requestUtils.activateTheme( 'twentytwentyone' ),
// Disable this test plugin as it's conflicting with some of the tests.
// We already have reduced motion enabled and Playwright will wait for most of the animations anyway.
requestUtils.deactivatePlugin(
'gutenberg-test-plugin-disables-the-css-animations'
),
requestUtils.deleteAllPosts(),
requestUtils.deleteAllBlocks(),
requestUtils.resetPreferences(),
] );

Because of this I need to manually override the requestUtils fixture in my setup, because otherwise I get errors about things like the gutenberg-test-plugin-disables-the-css-animations plugin not existing.

In my case it's not desired to trash all posts because I need some test data before the tests run.

What is your proposed solution?

Move the highlighted parts above to the global setup file, because that's really where this code belongs.

@swissspidy swissspidy added [Package] E2E Test Utils /packages/e2e-test-utils [Package] E2E Tests /packages/e2e-tests labels Jul 5, 2023
@swissspidy
Copy link
Member Author

cc @kevin940726 @noisysocks @talldan who were involved in writing that code

@kevin940726
Copy link
Member

Makes sense. I don't remember why I didn't do that in the first place 😅 . Maybe it's because global-setup only runs once but worker fixture runs before each test suite? Feel free to open PRs to explore this idea though! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] E2E Test Utils /packages/e2e-test-utils [Package] E2E Tests /packages/e2e-tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants