Add end 2 end tests InnerBlocks renderAppender#14996
Conversation
63ac58e to
6078276
Compare
aduth
left a comment
There was a problem hiding this comment.
There's a failed test in the build in this newly added suite. It should be made to pass consistently.
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.
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.
| var InnerBlocks = wp.blockEditor.InnerBlocks; | ||
| var withSelect = wp.data.withSelect; | ||
|
|
||
| var dataSelector = withSelect( function( select, ownProps ) { |
There was a problem hiding this comment.
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.
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.
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.
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.