-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Fix e2e test for block API / filtered blocks #51882
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
For reference the PR that introduced the test. I requested a review from Greg because he's the author. |
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.
For reference here’s the filter source:
gutenberg/packages/e2e-tests/plugins/block-api/index.js
Lines 17 to 31 in fe28cc9
addFilter( | |
'blocks.registerBlockType', | |
'e2e-tests/hello-world/filter-added-after-registration', | |
( blockType, name ) => { | |
if ( name === 'e2e-tests/hello-world' ) { | |
return { | |
...blockType, | |
title: 'Filtered Hello World', | |
}; | |
} | |
return blockType; | |
} | |
); | |
} )(); |
It doesn't filter block content but rather the block title. So that's why I thought the assertion should be for the filtered title.
Size Change: 0 B Total Size: 1.85 MB ℹ️ View Unchanged
|
1006955
to
b02c0bd
Compare
Flaky tests detected in b02c0bd. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5470416292
|
b02c0bd
to
c22e28a
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. |
Sorry for the branch override, @stokesman! I found this PR while cleaning old draft branches and decided to finish it instead of closing it. |
Thank you @Mamaduka! |
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: stokesman <presstoke@git.wordpress.org>
What?
An attempt to fix a test that may not be doing what it's supposed to be. Noticed during work on #51824.
Why?
It's worth a look because the test might not guard against regressions.
Currently the test asserts that the filtered block is inserted and has a certain text content. I suspect that’s wrong because the filter doesn't change the text content so there’s nothing testing the filter had an effect.
Conversely, if the original issue was that a block would fail to be inserted if it had a filter added after its block type was registered, then this test is fine and this PR can be closed. However, that didn't seem to be the case from my reading of it.
How?
Creates an assertion for the effect of the filter.
Testing Instructions