Cover block: Add e2e test coverage for bugfixes#75483
Conversation
|
Size Change: -356 B (-0.01%) Total Size: 6.84 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in f64e03b. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22391238057
|
c634b9d to
c62e151
Compare
|
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. |
| @@ -48,8 +52,9 @@ test.describe( 'Cover', () => { | |||
| ); | |||
| } ); | |||
|
|
|||
| test( 'can set background image using image upload on block placeholder', async ( { | |||
| test( 'can set background image using image upload on block placeholder, and computes the overlay color correctly based on the average image color', async ( { | |||
There was a problem hiding this comment.
Any reason for not having these test seprate? When the test description is a couple of sentences, it's a sign to split it, IMO :)
We could also use test.step to group related parts, inside the test.
There was a problem hiding this comment.
Any reason for not having these test seprate? When the test description is a couple of sentences, it's a sign to split it, IMO :)
They used to be separate (before 6889bca and 2f28693, respectively), but since "shorter" tests were fully included in the "longest" test, having them separate just seem to duplicate them. (With that said, I'm also not super-happy to have one ginormous test to cover three separate aspects now.)
We could also use
test.stepto group related parts, inside the test.
TIL about test.step! Thank you for the pointer, that sounds exactly like the kind of tool I was looking for
4cb54fa to
e26f0c9
Compare
|
Rebased. This currently reverts the changes to the e2e test from #75112. However, the previous code should still work, as it’s only checking if the file basename is included in the filename of the uploaded file. AFAIU, client-side media processing appends a suffix but otherwise retains the filename, so this check should still work. cc/ @adamsilverstein |
Mamaduka
left a comment
There was a problem hiding this comment.
The changes look good to me, and I think we can merge this, unless @adamsilverstein wants to make any changes based on the latest feedback.
e26f0c9 to
fecabb7
Compare
fecabb7 to
f64e03b
Compare
What?
The Cover block performs a number of color-related computations, e.g. for the color of the overlay (based on the average color value of the background image). These have proven finicky to get "right" from a UX POV. As a result, the Cover block has received a number of smallish bugfixes over time. However, many of those bugfixes lack test coverage. This PR seeks to remediate that.
Why?
To increase confidence in changes to the Cover block's internal logic. This is especially with regard to #74610, where I'm trying to accommodate the block code to re-compute the aforementioned color values in response to an image being set via Block Bindings.
How?
Preparatory work:
can set background image using image upload on block placeholderanddims background image down by 50% with the average image color when an image is uploadedtests intocan set background image using image upload on block placeholder, and computes the overlay color correctly based on the average image color.Then, add e2e test coverage for the following PRs:
Testing Instructions
The overall strategy is to verify that the newly added tests pass, both in CI and locally:
Furthermore, we need to verify that each test will fail if the respective PR that added the fix is reverted. In case of #5422 and #65105, this is as easy as
git revert <SHA>, with the SHA taken from the "Merge Commit" column above. (The other PRs cannot be reverted without conflicts.)To revert #59855, apply the following diff:
TODO
The test for #65105 is currently passing, even with 1a8aa20 reverted. (It might only fail for a previous version of Cover block markup?)