-
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
Add end 2 end tests InnerBlocks renderAppender #14996
Add end 2 end tests InnerBlocks renderAppender #14996
Conversation
63ac58e
to
6078276
Compare
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's a failed test in the build in this newly added suite. It should be made to pass consistently.
packages/e2e-tests/plugins/inner-blocks-renderappender/index.js
Outdated
Show resolved
Hide resolved
packages/e2e-tests/plugins/inner-blocks-renderappender/index.js
Outdated
Show resolved
Hide resolved
f9c411d
to
da0c6a7
Compare
e4967b5
to
9ce9b74
Compare
a6225e9
to
271817e
Compare
The PR is rebased and is updated the tests are passing consistently. I think it is ready for a review. |
271817e
to
6fe1c75
Compare
Hi @aduth, this PR was rebased could you a new look? |
/** | ||
* Registers a custom script for the plugin. | ||
*/ | ||
function enqueue_inner_blocks_renderappender_script() { |
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.
By its camelCase renderAppender
, we should treat "render appender" as two words, reflecting this as well in its kebab-case
and snake_case
forms as render-appender.php
and render_appender
respectively.
packages/e2e-tests/plugins/inner-blocks-renderappender/index.js
Outdated
Show resolved
Hide resolved
var InnerBlocks = wp.blockEditor.InnerBlocks; | ||
var withSelect = wp.data.withSelect; | ||
|
||
var dataSelector = withSelect( function( select, ownProps ) { |
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.
Optional: Could use hooks form now.
openAllBlockInserterCategories, | ||
} from '@wordpress/e2e-test-utils'; | ||
|
||
const QUOTE_INSERT_BUTTON_SELECTOR = '//button[contains(concat(" ", @class, " "), " block-editor-block-types-list__item ")][./span[contains(text(),"Quote")]]'; |
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.
If it was really the case that the inner span selection ended up being an issue resolved in #18771, then I think we should be a bit more wary about it. I think there might be some options with XPath to traverse back up to the parent of a matched span, if we need to match it? https://devhints.io/xpath#more-examples
Generally, I kinda wish these elements were just easier to target. I'd almost be okay with adapting the output in the source code for the sake of the tests, if it makes them more reliable.
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.
I updated the selection mechanism to use logic similar to what we used on #18771.
'Quote', | ||
'Video', | ||
] ); | ||
const quoteButton = ( await page.$x( QUOTE_INSERT_BUTTON_SELECTOR ) )[ 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.
Can we add some inline comments in this test case to explain the steps? As it stands, it's pretty difficult to follow.
6fe1c75
to
d6d57d3
Compare
d6d57d3
to
ddd783c
Compare
Hi @aduth, thank you for the review I applied changes that I hope to address all the points raised 👍 |
Description
This PR adds end 2 end tests to renderAppender property of InnerBlocks added in #14241.
How has this been tested?
I checked end 2 end tests execute with success.