Skip to content

Commit

Permalink
Fix failing e2e tests on daily run (woocommerce#49313)
Browse files Browse the repository at this point in the history
* Fix inability to activate twentytwenty theme

* Fix linting error

* Fix command palette test

* Change locator for Gutenberg tests

* Revert locator — Gutenberg adds an iframe

* Use regex for command palette

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
  • Loading branch information
lanej0 and Jon Lane authored Jul 10, 2024
1 parent cae3937 commit a50a2a9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/dev-fixes-daily-failures
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Update a few e2e tests failing on the daily run
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ const clickOnCommandPaletteOption = async ( { page, optionName } ) => {
// Press `Ctrl` + `K` to open the command palette.
await page.keyboard.press( cmdKeyCombo );

// Using a regex here because Gutenberg changes the text of the placeholder
await page
.getByLabel( 'Command palette' )
.locator( 'input' )
.getByPlaceholder(
/Search (?:commands(?: and settings)?|for commands)/
)
.fill( optionName );

// Click on the relevant option.
Expand Down
4 changes: 1 addition & 3 deletions plugins/woocommerce/tests/e2e-pw/utils/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ const goToPostEditor = async ( { page } ) => {
};

const fillPageTitle = async ( page, title ) => {
await ( await getCanvas( page ) )
.getByRole( 'textbox', { name: 'Add title' } )
.fill( title );
await ( await getCanvas( page ) ).getByLabel( 'Add title' ).fill( title );
};

const insertBlock = async ( page, blockName ) => {
Expand Down
4 changes: 2 additions & 2 deletions plugins/woocommerce/tests/e2e-pw/utils/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ export const DEFAULT_THEME = 'twentytwentythree';

export const activateTheme = ( themeName ) => {
return new Promise( ( resolve, reject ) => {
const command = `wp-env run tests-cli wp theme activate ${ themeName }`;
const command = `wp-env run tests-cli wp theme install ${ themeName } --activate`;

exec( command, ( error, stdout, stderr ) => {
exec( command, ( error, stdout ) => {
if ( error ) {
console.error( `Error executing command: ${ error }` );
return reject( error );
Expand Down

0 comments on commit a50a2a9

Please sign in to comment.