-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Gallery Block: Add E2E test for image randomization #71538
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
Conversation
|
Size Change: 0 B Total Size: 1.93 MB ℹ️ View Unchanged
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Flaky tests detected in a13bece. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/17541127763
|
Mamaduka
left a comment
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.
Tested using the following method and new tests haven't failed a single time.
npm run test:e2e -- test/e2e/specs/editor/blocks/gallery.spec.js --repeat-each=50
* Gallery Block: Add E2E test for image randomization * Use actually uploaded media * Update test title Co-authored-by: t-hamano <[email protected]> Co-authored-by: Mamaduka <[email protected]>
* Gallery Block: Add E2E test for image randomization * Use actually uploaded media * Update test title Co-authored-by: t-hamano <[email protected]> Co-authored-by: Mamaduka <[email protected]>
Closes #71432
What?
This PR adds e2e tests to ensure that the "Randomize order" setting of the Gallery block works correctly.
Why?
As commented here, we need to use a regular expression to randomize the images inside the Gallery block.
As a result, if the HTML output by the Image block changes in the future, it may no longer match this regular expression, and randomization may no longer work.
How?
Test that the randomization works in both scenarios, with and without the lightbox effect on the image. These E2E tests inject sequential numbers into the alt text and verify that they do NOT match between the editor and the front-end. It is highly unlikely that the order of the Alt text will ever change on the front end, so these tests will never fail.
Testing Instructions
Run
npm run test:e2e test/e2e/specs/editor/blocks/gallery.spec.jsYou can also make the tests fail intentionally to better understand what it's trying to do: