-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add clickBlockToolbarButton end to end test util (#14254)
This PR adds an end 2 end test util that allows clicking in a block toolbar button and refactors existing code to use it. ## How has this been tested? We only need to verify that the end 2 end tests pass.
- Loading branch information
1 parent
03a74ba
commit 3c5ed0e
Showing
9 changed files
with
92 additions
and
91 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Clicks a block toolbar button. | ||
* | ||
* @param {string} buttonAriaLabel The aria label of the button to click. | ||
*/ | ||
export async function clickBlockToolbarButton( buttonAriaLabel ) { | ||
const BLOCK_TOOLBAR_SELECTOR = '.editor-block-toolbar'; | ||
const BUTTON_SELECTOR = `${ BLOCK_TOOLBAR_SELECTOR } button[aria-label="${ buttonAriaLabel }"]`; | ||
if ( await page.$( BLOCK_TOOLBAR_SELECTOR ) === null ) { | ||
// Press escape to show the block toolbar | ||
await page.keyboard.press( 'Escape' ); | ||
} | ||
await page.waitForSelector( BUTTON_SELECTOR ); | ||
await page.click( BUTTON_SELECTOR ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters