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,
|
insertBlock,
|
||||||
transformIntoBlocks,
|
transformIntoBlocks,
|
||||||
publishPage,
|
publishPage,
|
||||||
|
openEditorSettings,
|
||||||
} = require( '../../utils/editor' );
|
} = require( '../../utils/editor' );
|
||||||
|
|
||||||
const simpleProductName = 'Very Simple Product';
|
const simpleProductName = 'Very Simple Product';
|
||||||
|
@ -80,13 +81,8 @@ test.describe(
|
||||||
let canvas = await getCanvas( page );
|
let canvas = await getCanvas( page );
|
||||||
|
|
||||||
// Open Settings sidebar if closed
|
// Open Settings sidebar if closed
|
||||||
if (
|
await openEditorSettings( { page } );
|
||||||
await page
|
|
||||||
.getByLabel( 'Editor Settings', { exact: true } )
|
|
||||||
.isHidden()
|
|
||||||
) {
|
|
||||||
await canvas.getByLabel( 'Settings', { exact: true } ).click();
|
|
||||||
}
|
|
||||||
// Activate the terms and conditions checkbox
|
// Activate the terms and conditions checkbox
|
||||||
await canvas.getByLabel( 'Block: Terms and Conditions' ).click();
|
await canvas.getByLabel( 'Block: Terms and Conditions' ).click();
|
||||||
await page.getByLabel( 'Require checkbox' ).check();
|
await page.getByLabel( 'Require checkbox' ).check();
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
const { test, expect } = require( '@playwright/test' );
|
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 wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
|
||||||
const { random } = require( '../../utils/helpers' );
|
const { random } = require( '../../utils/helpers' );
|
||||||
|
|
||||||
|
@ -147,6 +150,9 @@ test.describe(
|
||||||
.click();
|
.click();
|
||||||
await expect( page.getByLabel( 'Block: Mini-Cart' ) ).toBeVisible();
|
await expect( page.getByLabel( 'Block: Mini-Cart' ) ).toBeVisible();
|
||||||
|
|
||||||
|
// Open Settings sidebar if closed
|
||||||
|
await openEditorSettings( { page } );
|
||||||
|
|
||||||
// customize mini cart block
|
// customize mini cart block
|
||||||
await page.getByLabel( 'Block: Mini-Cart' ).click();
|
await page.getByLabel( 'Block: Mini-Cart' ).click();
|
||||||
// display total price
|
// 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 ) => {
|
const getCanvas = async ( page ) => {
|
||||||
return page.frame( 'editor-canvas' ) || page;
|
return page.frame( 'editor-canvas' ) || page;
|
||||||
};
|
};
|
||||||
|
@ -106,6 +115,7 @@ module.exports = {
|
||||||
goToPageEditor,
|
goToPageEditor,
|
||||||
goToPostEditor,
|
goToPostEditor,
|
||||||
disableWelcomeModal,
|
disableWelcomeModal,
|
||||||
|
openEditorSettings,
|
||||||
getCanvas,
|
getCanvas,
|
||||||
fillPageTitle,
|
fillPageTitle,
|
||||||
insertBlock,
|
insertBlock,
|
||||||
|
|
Loading…
Reference in New Issue