Fix flaky mini-cart and create-checkout-block e2e tests (#48916)
Fix flaky Gutenberg and Services tests
This commit is contained in:
parent
6b366c2390
commit
8c7950b0c6
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
E2E tests: Fix flaky Gutenberg, WC Services tests
|
|
@ -6,6 +6,7 @@ const {
|
|||
insertBlock,
|
||||
transformIntoBlocks,
|
||||
publishPage,
|
||||
openEditorSettings,
|
||||
} = require( '../../utils/editor' );
|
||||
|
||||
const simpleProductName = 'Very Simple Product';
|
||||
|
@ -80,13 +81,8 @@ test.describe(
|
|||
let canvas = await getCanvas( page );
|
||||
|
||||
// Open Settings sidebar if closed
|
||||
if (
|
||||
await page
|
||||
.getByLabel( 'Editor Settings', { exact: true } )
|
||||
.isHidden()
|
||||
) {
|
||||
await canvas.getByLabel( 'Settings', { exact: true } ).click();
|
||||
}
|
||||
await openEditorSettings( { page } );
|
||||
|
||||
// Activate the terms and conditions checkbox
|
||||
await canvas.getByLabel( 'Block: Terms and Conditions' ).click();
|
||||
await page.getByLabel( 'Require checkbox' ).check();
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
const { test, expect } = require( '@playwright/test' );
|
||||
const { disableWelcomeModal } = require( '../../utils/editor' );
|
||||
const {
|
||||
disableWelcomeModal,
|
||||
openEditorSettings,
|
||||
} = require( '../../utils/editor' );
|
||||
const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
|
||||
const { random } = require( '../../utils/helpers' );
|
||||
|
||||
|
@ -147,6 +150,9 @@ test.describe(
|
|||
.click();
|
||||
await expect( page.getByLabel( 'Block: Mini-Cart' ) ).toBeVisible();
|
||||
|
||||
// Open Settings sidebar if closed
|
||||
await openEditorSettings( { page } );
|
||||
|
||||
// customize mini cart block
|
||||
await page.getByLabel( 'Block: Mini-Cart' ).click();
|
||||
// display total price
|
||||
|
|
|
@ -26,6 +26,15 @@ const disableWelcomeModal = async ( { page } ) => {
|
|||
}
|
||||
};
|
||||
|
||||
const openEditorSettings = async ( { page } ) => {
|
||||
// Open Settings sidebar if closed
|
||||
if ( await page.getByLabel( 'Editor Settings' ).isVisible() ) {
|
||||
console.log( 'Editor Settings is open, skipping action.' );
|
||||
} else {
|
||||
await page.getByLabel( 'Settings', { exact: true } ).click();
|
||||
}
|
||||
};
|
||||
|
||||
const getCanvas = async ( page ) => {
|
||||
return page.frame( 'editor-canvas' ) || page;
|
||||
};
|
||||
|
@ -106,6 +115,7 @@ module.exports = {
|
|||
goToPageEditor,
|
||||
goToPostEditor,
|
||||
disableWelcomeModal,
|
||||
openEditorSettings,
|
||||
getCanvas,
|
||||
fillPageTitle,
|
||||
insertBlock,
|
||||
|
|
Loading…
Reference in New Issue