[e2e tests] Improve execution time by disabling the welcomeGuide feature instead of waiting for the modal (#45132)
* Fix locator for command palette * Add changelog * Use fixtures instead of before/after hooks * Disable welcome modal * Remove describe block * Replace closeWelcomeModal with disableWelcomeModal * Remove wait for networkidle * Wait for page load * Add changelog
This commit is contained in:
parent
d581512171
commit
63f6650759
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
E2E tests: improve execution time by disabling the welcomeGuide feature instead of waiting for the modal
|
|
@ -1,5 +1,5 @@
|
|||
const { test, expect } = require( '@playwright/test' );
|
||||
const { closeWelcomeModal } = require( '../../utils/editor' );
|
||||
const { disableWelcomeModal } = require( '../../utils/editor' );
|
||||
|
||||
const transformedCartBlockTitle = `Transformed Cart ${ Date.now() }`;
|
||||
const transformedCartBlockSlug = transformedCartBlockTitle
|
||||
|
@ -13,7 +13,7 @@ test.describe( 'Transform Classic Cart To Cart Block', () => {
|
|||
// go to create a new page
|
||||
await page.goto( 'wp-admin/post-new.php?post_type=page' );
|
||||
|
||||
await closeWelcomeModal( { page } );
|
||||
await disableWelcomeModal( { page } );
|
||||
|
||||
// fill page title
|
||||
await page
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { test, expect } = require( '@playwright/test' );
|
||||
const { admin } = require( '../../test-data/data' );
|
||||
const { closeWelcomeModal } = require( '../../utils/editor' );
|
||||
const { disableWelcomeModal } = require( '../../utils/editor' );
|
||||
const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
|
||||
|
||||
const firstProductName = 'First Product';
|
||||
|
@ -142,12 +142,11 @@ test.describe( 'Cart Block Calculate Shipping', () => {
|
|||
test( 'create Cart Block page', async ( { page } ) => {
|
||||
// create a new page with cart block
|
||||
await page.goto( 'wp-admin/post-new.php?post_type=page' );
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
await page.locator( 'input[name="log"]' ).fill( admin.username );
|
||||
await page.locator( 'input[name="pwd"]' ).fill( admin.password );
|
||||
await page.locator( 'text=Log In' ).click();
|
||||
|
||||
await closeWelcomeModal( { page } );
|
||||
await disableWelcomeModal( { page } );
|
||||
|
||||
await page
|
||||
.getByRole( 'textbox', { name: 'Add title' } )
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { test, expect } = require( '@playwright/test' );
|
||||
const { admin } = require( '../../test-data/data' );
|
||||
const { closeWelcomeModal } = require( '../../utils/editor' );
|
||||
const { disableWelcomeModal } = require( '../../utils/editor' );
|
||||
const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
|
||||
|
||||
const simpleProductName = 'Cart Coupons Product';
|
||||
|
@ -124,12 +124,11 @@ test.describe( 'Cart Block Applying Coupons', () => {
|
|||
test( 'can create Cart Block page', async ( { page } ) => {
|
||||
// create a new page with cart block
|
||||
await page.goto( 'wp-admin/post-new.php?post_type=page' );
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
await page.locator( 'input[name="log"]' ).fill( admin.username );
|
||||
await page.locator( 'input[name="pwd"]' ).fill( admin.password );
|
||||
await page.locator( 'text=Log In' ).click();
|
||||
|
||||
await closeWelcomeModal( { page } );
|
||||
await disableWelcomeModal( { page } );
|
||||
|
||||
await page
|
||||
.getByRole( 'textbox', { name: 'Add title' } )
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const { test, expect } = require( '@playwright/test' );
|
||||
const { closeWelcomeModal } = require( '../../utils/editor' );
|
||||
const { disableWelcomeModal } = require( '../../utils/editor' );
|
||||
const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
|
||||
|
||||
const simpleProductName = 'Single Simple Product';
|
||||
|
@ -88,7 +88,7 @@ test.describe( 'Cart Block page', () => {
|
|||
// create a new page with cart block
|
||||
await page.goto( 'wp-admin/post-new.php?post_type=page' );
|
||||
|
||||
await closeWelcomeModal( { page } );
|
||||
await disableWelcomeModal( { page } );
|
||||
|
||||
await page
|
||||
.getByRole( 'textbox', { name: 'Add title' } )
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const { test, expect } = require( '@playwright/test' );
|
||||
const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
|
||||
const { admin } = require( '../../test-data/data' );
|
||||
const { closeWelcomeModal } = require( '../../utils/editor' );
|
||||
const { disableWelcomeModal } = require( '../../utils/editor' );
|
||||
|
||||
const productName = 'First Product Cart Block Taxing';
|
||||
const productPrice = '100.00';
|
||||
|
@ -108,12 +108,11 @@ test.describe( 'Shopper Cart & Checkout Block Tax Display', () => {
|
|||
test( 'can create Cart Block page', async ( { page } ) => {
|
||||
// create a new page with cart block
|
||||
await page.goto( 'wp-admin/post-new.php?post_type=page' );
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
await page.locator( 'input[name="log"]' ).fill( admin.username );
|
||||
await page.locator( 'input[name="pwd"]' ).fill( admin.password );
|
||||
await page.locator( 'text=Log In' ).click();
|
||||
|
||||
await closeWelcomeModal( { page } );
|
||||
await disableWelcomeModal( { page } );
|
||||
|
||||
await page
|
||||
.getByRole( 'textbox', { name: 'Add title' } )
|
||||
|
@ -140,19 +139,11 @@ test.describe( 'Shopper Cart & Checkout Block Tax Display', () => {
|
|||
test( 'can create Checkout Block page', async ( { page } ) => {
|
||||
// create a new page with checkout block
|
||||
await page.goto( 'wp-admin/post-new.php?post_type=page' );
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
await page.locator( 'input[name="log"]' ).fill( admin.username );
|
||||
await page.locator( 'input[name="pwd"]' ).fill( admin.password );
|
||||
await page.locator( 'text=Log In' ).click();
|
||||
|
||||
// Close welcome popup if prompted
|
||||
try {
|
||||
await page
|
||||
.getByLabel( 'Close', { exact: true } )
|
||||
.click( { timeout: 5000 } );
|
||||
} catch ( error ) {
|
||||
console.log( "Welcome modal wasn't present, skipping action." );
|
||||
}
|
||||
await disableWelcomeModal( { page } );
|
||||
|
||||
await page
|
||||
.getByRole( 'textbox', { name: 'Add title' } )
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const { test, expect } = require( '@playwright/test' );
|
||||
const { closeWelcomeModal } = require( '../../utils/editor' );
|
||||
const { disableWelcomeModal } = require( '../../utils/editor' );
|
||||
const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
|
||||
|
||||
const miniCartPageTitle = `Mini Cart ${ Date.now() }`;
|
||||
|
@ -121,7 +121,7 @@ test.describe( 'Mini Cart block page', () => {
|
|||
// create a new page with mini cart block
|
||||
await page.goto( 'wp-admin/post-new.php?post_type=page' );
|
||||
|
||||
await closeWelcomeModal( { page } );
|
||||
await disableWelcomeModal( { page } );
|
||||
|
||||
await page
|
||||
.getByRole( 'textbox', { name: 'Add title' } )
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const { test, expect } = require( '@playwright/test' );
|
||||
const { closeWelcomeModal } = require( '../../utils/editor' );
|
||||
const { disableWelcomeModal } = require( '../../utils/editor' );
|
||||
const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
|
||||
|
||||
const singleProductPrice1 = '10';
|
||||
|
@ -75,7 +75,7 @@ test.describe( 'Filter items in the shop by product price', () => {
|
|||
// go to create a new page with filtering products by price
|
||||
await page.goto( 'wp-admin/post-new.php?post_type=page' );
|
||||
|
||||
await closeWelcomeModal( { page } );
|
||||
await disableWelcomeModal( { page } );
|
||||
|
||||
await page
|
||||
.getByRole( 'textbox', { name: 'Add title' } )
|
||||
|
|
|
@ -10,6 +10,9 @@ const closeWelcomeModal = async ( { page } ) => {
|
|||
};
|
||||
|
||||
const disableWelcomeModal = async ( { page } ) => {
|
||||
await page.waitForLoadState();
|
||||
await page.waitForFunction( () => window?.wp?.data );
|
||||
|
||||
const isWelcomeGuideActive = await page.evaluate( () =>
|
||||
wp.data.select( 'core/edit-post' ).isFeatureActive( 'welcomeGuide' )
|
||||
);
|
||||
|
@ -24,13 +27,13 @@ const disableWelcomeModal = async ( { page } ) => {
|
|||
const goToPageEditor = async ( { page } ) => {
|
||||
await page.goto( 'wp-admin/post-new.php?post_type=page' );
|
||||
|
||||
await closeWelcomeModal( { page } );
|
||||
await disableWelcomeModal( { page } );
|
||||
};
|
||||
|
||||
const goToPostEditor = async ( { page } ) => {
|
||||
await page.goto( 'wp-admin/post-new.php' );
|
||||
|
||||
await closeWelcomeModal( { page } );
|
||||
await disableWelcomeModal( { page } );
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Reference in New Issue