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

tests: add insertBlockAndWaitForSelector utility #56642

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

flootr
Copy link
Contributor

@flootr flootr commented Nov 29, 2023

What?

Add a insertBlockAndWaitForSelector utility to the e2e test utils for playwright package which inserts a block and then waits for a given selector to be visible.

Why?

The idea came up when I started working on fixing e2e tests in #55585 which attempts to lazy load edit functions of blocks. After using insertBlock we have to wait for a certain selector to be visible, otherwise some of the tests fail which attempt to e.g. type something into a block which isn't there yet.

In 50cd450 you can see this might result in a lot of repetitive code which this util tries to abstract away. It's probably not suitable for all block insertions done in those tests but should cover a fair bit.

How?

The @wordpress/e2e-test-utils-playwright exports a bunch of methods and we're adding insertBlockAndWaitForSelector to it.

Testing Instructions

Testing Instructions for Keyboard

none

Screenshots or screencast

none

@flootr flootr added [Package] E2E Test Utils /packages/e2e-test-utils [Package] E2E Tests /packages/e2e-tests labels Nov 29, 2023
@flootr flootr self-assigned this Nov 29, 2023
@flootr flootr added [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. and removed [Package] E2E Test Utils /packages/e2e-test-utils [Package] E2E Tests /packages/e2e-tests labels Nov 29, 2023
Copy link

Flaky tests detected in 0c1f48e.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7033437691
📝 Reported issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
1 participant