A few updates for flaky e2e tests (#45856)
Co-authored-by: Jon Lane <jon.lane@automattic.com>
This commit is contained in:
parent
9000fd764e
commit
ca7e3b99ed
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Fix some flaky e2e tests
|
|
@ -78,36 +78,11 @@ baseTest.describe( 'Merchant > Customer List', () => {
|
|||
},
|
||||
} );
|
||||
|
||||
test.beforeAll( async ( { api } ) => {
|
||||
let oldCustomers = {};
|
||||
await api.get( 'customers' ).then( ( response ) => {
|
||||
oldCustomers = response.data;
|
||||
} );
|
||||
await api.post( `customers/batch`, {
|
||||
delete: oldCustomers.map( ( customer ) => customer.id ),
|
||||
} );
|
||||
} );
|
||||
|
||||
test.beforeEach( async ( { context } ) => {
|
||||
// prevents the column picker from saving state between tests
|
||||
await context.route( '**/users/**', ( route ) => route.abort() );
|
||||
} );
|
||||
|
||||
// skipping this test because guest orders show in this list as undeletable customers.
|
||||
test.skip( 'Merchant can view an empty customer list', async ( {
|
||||
page,
|
||||
} ) => {
|
||||
await page.goto(
|
||||
'/wp-admin/admin.php?page=wc-admin&path=%2Fcustomers'
|
||||
);
|
||||
await expect(
|
||||
page.getByRole( 'cell', { name: 'No data to display' } )
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByText( '0customers0Average orders$0.' )
|
||||
).toBeVisible();
|
||||
} );
|
||||
|
||||
test( 'Merchant can view a list of all customers, filter and download', async ( {
|
||||
page,
|
||||
customers,
|
||||
|
|
|
@ -80,7 +80,7 @@ test.describe( 'WooCommerce Merchant Flow: Orders > Customer Payment Page', () =
|
|||
|
||||
// verify we landed on the customer payment page
|
||||
await expect(
|
||||
page.getByText( 'You are paying for a guest order.' )
|
||||
page.getByRole( 'button', { name: 'Pay for order' } )
|
||||
).toBeVisible();
|
||||
await expect( page.locator( 'td.product-name' ) ).toContainText(
|
||||
productName
|
||||
|
|
|
@ -81,10 +81,9 @@ test.describe( 'General tab', () => {
|
|||
} )
|
||||
.click();
|
||||
|
||||
const element = page.locator( 'div.components-snackbar__content' );
|
||||
const textContent = await element.innerText();
|
||||
|
||||
await expect( textContent ).toMatch( /Product published/ );
|
||||
await expect(
|
||||
page.getByLabel( 'Dismiss this notice' )
|
||||
).toContainText( 'Product published' );
|
||||
|
||||
const title = page.locator( '.woocommerce-product-header__title' );
|
||||
|
||||
|
@ -133,10 +132,9 @@ test.describe( 'General tab', () => {
|
|||
} )
|
||||
.click();
|
||||
|
||||
const element = page.locator( 'div.components-snackbar__content' );
|
||||
const textContent = await element.innerText();
|
||||
|
||||
await expect( textContent ).toMatch( /Invalid or duplicated SKU./ );
|
||||
await expect(
|
||||
page.getByLabel( 'Dismiss this notice' )
|
||||
).toContainText( 'Invalid or duplicated SKU.' );
|
||||
} );
|
||||
|
||||
test( 'can a shopper add the simple product to the cart', async ( {
|
||||
|
|
|
@ -147,12 +147,12 @@ test.describe( 'Variations tab', () => {
|
|||
} )
|
||||
.click();
|
||||
|
||||
await page
|
||||
.locator( '.woocommerce-product-publish-panel__header' )
|
||||
.getByRole( 'button', {
|
||||
name: 'Publish',
|
||||
} )
|
||||
.click();
|
||||
// await page
|
||||
// .locator( '.woocommerce-product-publish-panel__header' )
|
||||
// .getByRole( 'button', {
|
||||
// name: 'Publish',
|
||||
// } )
|
||||
// .click();
|
||||
|
||||
const element = page.locator( 'div.components-snackbar__content' );
|
||||
if ( Array.isArray( element ) ) {
|
||||
|
|
|
@ -121,10 +121,9 @@ test.describe( 'General tab', () => {
|
|||
} )
|
||||
.click();
|
||||
|
||||
const element = page.locator( 'div.components-snackbar__content' );
|
||||
const textContent = await element.innerText();
|
||||
|
||||
await expect( textContent ).toMatch( /Product published/ );
|
||||
await expect(
|
||||
page.getByLabel( 'Dismiss this notice' )
|
||||
).toContainText( 'Product published' );
|
||||
|
||||
const title = page.locator( '.woocommerce-product-header__title' );
|
||||
|
||||
|
|
|
@ -393,7 +393,7 @@ test.describe( 'Cart & Checkout Restricted Coupons', () => {
|
|||
billing: {
|
||||
first_name: 'Marge',
|
||||
last_name: 'Simpson',
|
||||
email: 'marge@example.com',
|
||||
email: 'marge.simpson@example.org',
|
||||
},
|
||||
line_items: [
|
||||
{
|
||||
|
@ -625,8 +625,8 @@ test.describe( 'Cart & Checkout Restricted Coupons', () => {
|
|||
} );
|
||||
|
||||
test( 'coupon cannot be used by any customer on cart (email restricted)', async ( {
|
||||
page,
|
||||
} ) => {
|
||||
page,
|
||||
} ) => {
|
||||
await page.goto( `/shop/?add-to-cart=${ firstProductId }` );
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
|
||||
|
@ -661,7 +661,7 @@ test.describe( 'Cart & Checkout Restricted Coupons', () => {
|
|||
await page
|
||||
.getByLabel( 'Email address' )
|
||||
.first()
|
||||
.fill( 'marge@example.com' );
|
||||
.fill( 'marge.simpson@example.org' );
|
||||
|
||||
await page
|
||||
.getByRole( 'link', { name: 'Click here to enter your code' } )
|
||||
|
@ -669,6 +669,8 @@ test.describe( 'Cart & Checkout Restricted Coupons', () => {
|
|||
await page.getByPlaceholder( 'Coupon code' ).fill( 'email-restricted' );
|
||||
await page.getByRole( 'button', { name: 'Apply coupon' } ).click();
|
||||
|
||||
await page.waitForLoadState( 'networkidle' );
|
||||
|
||||
await expect(
|
||||
page.getByText(
|
||||
'Please enter a valid email to use coupon code "email-restricted".'
|
||||
|
|
|
@ -10,8 +10,8 @@ const closeWelcomeModal = async ( { page } ) => {
|
|||
};
|
||||
|
||||
const disableWelcomeModal = async ( { page } ) => {
|
||||
await page.waitForLoadState();
|
||||
await page.waitForFunction( () => window?.wp?.data );
|
||||
// Further info: https://github.com/woocommerce/woocommerce/pull/45856/
|
||||
await page.waitForLoadState( 'domcontentloaded' );
|
||||
|
||||
const isWelcomeGuideActive = await page.evaluate( () =>
|
||||
wp.data.select( 'core/edit-post' ).isFeatureActive( 'welcomeGuide' )
|
||||
|
|
Loading…
Reference in New Issue