-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec8949a
commit ccf56ec
Showing
8 changed files
with
49 additions
and
11 deletions.
There are no files selected for viewing
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
4 changes: 2 additions & 2 deletions
4
tests/e2e/specs/stories-editor/featured-image-automatically-set.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Clicks a button based on the text on the button. | ||
* | ||
* This is almost a copy of the upstream util, however, it uses page.evaluate for clicking since it seems to work more reliably. | ||
* | ||
* @param {string} buttonText The text that appears on the button to click. | ||
*/ | ||
export async function clickButton( buttonText ) { | ||
const button = await page.waitForXPath( `//button[contains(text(), '${ buttonText }')]` ); | ||
await page.evaluate( ( btn ) => { | ||
btn.click(); | ||
}, button ); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Switches editor mode. | ||
* | ||
* This is almost a copy from upstream switchEditorModeTo util, however, it uses page.evaluate for clicking | ||
* since that seems to work more reliably. | ||
* | ||
* @param {string} mode String editor mode. | ||
*/ | ||
export async function switchEditorModeTo( mode ) { | ||
const selector = '.edit-post-more-menu [aria-label="More tools & options"]'; | ||
await page.waitForSelector( selector ); | ||
await page.evaluate( ( sel ) => { | ||
document.querySelector( sel ).click(); | ||
}, selector ); | ||
const [ button ] = await page.$x( | ||
`//button[contains(text(), '${ mode } Editor')]` | ||
); | ||
|
||
await page.evaluate( ( btn ) => { | ||
btn.click( 'button' ); | ||
}, button ); | ||
} |