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
Inserter: Test to make sure the Inserter menu is closed. #24610
Conversation
Size Change: 0 B Total Size: 1.2 MB ℹ️ View Unchanged
|
This appears to be failing in other sections, too:
I assume those are valid, and the insertion will need to be fixed in those places as well? Or does the test/test helper need to be changed? |
They should be legitimate failures. I'll investigate further. |
I'm not certain how all the pieces come together yet, but the behavior of the inserter when using the experimental Full Site editing feature does not work the same. It does not close when a block is added. These tests run within the context of that feature. Since the inserter doesn't close for Full Site editing, it technically shouldn't test it. I wonder if it's purposeful that the inserter doesn't close in FSE. |
Adding |
That's a good point. Alternatives are definitely welcome. I wouldn't expect most tests to pass in the
The code is fairly repetitive and probably could use some 'drying' up. |
@StevenDufresne I'd prefer the second solution, a I won't be too worried about repetitive code though, even though they have similar functionality, they are also very different. Let's not prematurely optimize it unless we really need to. We can even rename the original What's your thought on this? Am I missing some context :)? |
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.
LGTM 👍. Thank you @StevenDufresne !
…ry test." This reverts commit 5e1a810.
…it for inserter and it's focus.
f3553ad
to ff2fc4c
Compare
Description
This is an experimental PR to start addressing #24606.
The Problem
The block directory package is bundled in Gutenberg but its E2E tests are separate and therefore changes to the
Inserter
and its related components can break Block Directory functionality. This is because the Block Directory package makes use of the slot/fill component in the inserter.A Potential Solution
This PR includes updates to the
insertBlock
function so it can be used by the block directory end to end tests since its markup differs from the default markup view. This PR allows developers to pass an optionalxPath
to the button that eventually inserts a block (the block directory installs first). Up until now, the block directory e2e tests reimplemented a Block Directory specific "insertBlock" sequence that was not sufficiently bubbling up errors introduced withInserter
changes.While it is most likely not a good approach to continually abstract the
insertBlock
function and make it super configurable, this will at least ensure that all items in the inserter that insert blocks behave consistently and share a common code base.I have also added the following:
await page.waitForSelector( '.block-editor-inserter__menu', { hidden: true, } );
since the current test doesn't actually test whether the inserter has closed, even though the comment suggests it has. By adding this block, the bug defined in #24606, is exposed.
Checklist: