-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix e2e test for block API / filtered blocks #51882
base: trunk
Are you sure you want to change the base?
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.42 MB ℹ️ View Unchanged
|
1006955
to
b02c0bd
Compare
Flaky tests detected in b02c0bd. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5470416292
|
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