-
Notifications
You must be signed in to change notification settings - Fork 178
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 tests in WordPress 5.8 #8204
Conversation
Size Change: 0 B Total Size: 2.2 MB ℹ️ View Unchanged
|
.dispatch('core/block-editor') | ||
.selectBlock( | ||
wp.data.select('core/block-editor').getSelectedBlockClientId(), | ||
0 |
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.
What's the 0
here? AFAIK selectBlock
only takes one argument.
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.
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.
Looks like 0
is the default argument here:
Could be safely removed
`//button//span[contains(text(), '${searchTerm}')]` | ||
); | ||
await insertButton.click(); | ||
await focusSelectedBlock(); |
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.
Instead of focusing the block, could we close the inserter manually somehow?
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.
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.
oh, in that case, since our versions of insertBlock
and waitForInserterCloseAndContentFocus
are now identical to the ones from Gutenberg, we can just use insertBlock
from @wordpress/e2e-test-utils
directly instead of copying everything.
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.
Sadly we can't as the version of @wordpress/e2e-test-utils
is a month out of date. Also
It works properly with the minimum version of Gutenberg 9.2.0 or the minimum version of WordPress 5.6.0.
We support, 5.5, so have maintain our own version of these functions.
https://github.com/WordPress/gutenberg/tree/trunk/packages/e2e-test-utils
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.
Sadly we can't as the version of @wordpress/e2e-test-utils is a month out of date.
Is it? At first glance I don't see a difference from the package published on npm that we use and the Gutenberg trunk
branch.
I don't mind maintaining our own version of certain functions if they differ in logic, but here they seem identical to me. But happy to be corrected.
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.
This packages says, last published 1 month ago.
Inserter was updated 12 minutes ago.
What am I missing?
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.
That seems fine to me? Yes there's a recently modified file in there, but I don't see how that would affect us. That change is neither in core nor in the package version that we use. We also don't use any of the currently unreleased new features.
Putting this another way: if we just remove our own version of insertBlock
and use the version from @wordpress/e2e-test-utils
, do the e2e tests still pass? If yes, I'd say we can safely remove our copy.
Closing in favour #8223 |
Context
Summary
TLDR, in WordPress 5.8+, the block needs to be focused, before this is out was automatically focused and the inserter closed.
Much of these changes are copied from upstream.
Relevant Technical Choices
To-do
User-facing changes
Testing Instructions
QA
This PR can be tested by following these steps:
UAT
This PR can be tested by following these steps:
Reviews
Does this PR have a security-related impact?
Does this PR change what data or activity we track or use?
Does this PR have a legal-related impact?
Checklist
Type: XYZ
label to the PRFixes #8160