[e2e] External - Expand WPCOM suite, part 3 (#51422)

* Skip "Restricted coupon management" - error 500

* Make `wooPatterns` element more specific

* Skip "Merchant can view a list of all customers" - more customers due to using existing website

* No LYS on WPCOM

* Dismiss notice if shown

* Expand WPCOM suite

* Click on `Canada`

* Click on `Canada`

* Be more specific about `Delete` button

* Add changefile(s) from automation for the following project(s): woocommerce

* Skip two more tests - WC patterns and block

* Remove usage of `networkidle`

* Handle notice if present with `addLocatorHandler`

* Fix ESLint issue

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Ivan Stojadinov 2024-09-18 13:24:38 +02:00 committed by GitHub
parent 16e072879b
commit 4bc4649008
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 461 additions and 414 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Expand the e2e suite we're running on WPCOM part #3.

View File

@ -23,6 +23,16 @@ config = {
'**/merchant/create-order.spec.js', '**/merchant/create-order.spec.js',
'**/merchant/create-page.spec.js', '**/merchant/create-page.spec.js',
'**/merchant/create-post.spec.js', '**/merchant/create-post.spec.js',
'**/merchant/create-restricted-coupons.spec.js',
'**/merchant/create-shipping-classes.spec.js',
'**/merchant/create-shipping-zones.spec.js',
'**/merchant/create-woocommerce-blocks.spec.js',
'**/merchant/create-woocommerce-patterns.spec.js',
'**/merchant/customer-list.spec.js',
'**/merchant/customer-payment-page.spec.js',
'**/merchant/launch-your-store.spec.js',
'**/merchant/lost-password.spec.js',
'**/merchant/order-bulk-edit.spec.js',
], ],
grepInvert: /@skip-on-default-wpcom/, grepInvert: /@skip-on-default-wpcom/,
}, },

View File

@ -103,397 +103,414 @@ const test = baseTest.extend( {
}, },
} ); } );
test.describe( 'Restricted coupon management', { tag: [ '@services' ] }, () => { test.describe(
for ( const couponType of Object.keys( couponData ) ) { 'Restricted coupon management',
test( `can create new ${ couponType } coupon`, async ( { { tag: [ '@services', '@skip-on-default-wpcom' ] },
page, () => {
coupon, for ( const couponType of Object.keys( couponData ) ) {
product, test( `can create new ${ couponType } coupon`, async ( {
} ) => { page,
// create basics for the coupon coupon,
await test.step( 'add new coupon', async () => { product,
await page.goto( } ) => {
'wp-admin/post-new.php?post_type=shop_coupon' // create basics for the coupon
); await test.step( 'add new coupon', async () => {
await page await page.goto(
.getByLabel( 'Coupon code' ) 'wp-admin/post-new.php?post_type=shop_coupon'
.fill( couponData[ couponType ].code );
await page
.getByPlaceholder( 'Description (optional)' )
.fill( couponData[ couponType ].description );
await page
.getByPlaceholder( '0' )
.fill( couponData[ couponType ].amount );
await expect( page.getByText( 'Move to Trash' ) ).toBeVisible();
} );
// set up the restrictions for each coupon type
// set minimum spend
if ( couponType === 'minimumSpend' ) {
await test.step( 'set minimum spend coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'No minimum' )
.fill( couponData[ couponType ].minSpend );
} );
}
// set maximum spend
if ( couponType === 'maximumSpend' ) {
await test.step( 'set maximum spend coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'No maximum' )
.fill( couponData[ couponType ].maxSpend );
} );
}
// set individual use
if ( couponType === 'individualUse' ) {
await test.step( 'set individual use coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page.getByLabel( 'Individual use only' ).check();
} );
}
// set exclude sale items
if ( couponType === 'excludeSaleItems' ) {
await test.step( 'set exclude sale items coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page.getByLabel( 'Exclude sale items' ).check();
} );
}
// set product categories
if ( couponType === 'productCategories' ) {
await test.step( 'set product categories coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'Any category' )
.pressSequentially( 'Uncategorized' );
await page
.getByRole( 'option', { name: 'Uncategorized' } )
.click();
} );
}
// set exclude product categories
if ( couponType === 'excludeProductCategories' ) {
await test.step( 'set exclude product categories coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'No categories' )
.pressSequentially( 'Uncategorized' );
await page
.getByRole( 'option', { name: 'Uncategorized' } )
.click();
} );
}
// Skip Brands tests while behind a feature flag.
const skipBrandsTests = true;
// set exclude product brands
if ( couponType === 'excludeProductBrands' && ! skipBrandsTests ) {
await test.step( 'set exclude product brands coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'No brands' )
.pressSequentially( 'WooCommerce Apparels' );
await page
.getByRole( 'option', { name: 'WooCommerce Apparels' } )
.click();
} );
}
// set products
if ( couponType === 'products' ) {
await test.step( 'set products coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'Search for a product…' )
.first()
.pressSequentially( product.name );
await page
.getByRole( 'option', { name: product.name } )
.click();
} );
}
// set exclude products
if ( couponType === 'excludeProducts' ) {
await test.step( 'set exclude products coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'Search for a product…' )
.last()
.pressSequentially( product.name );
await page
.getByRole( 'option', { name: product.name } )
.click();
} );
}
// set allowed emails
if ( couponType === 'allowedEmails' ) {
await test.step( 'set allowed emails coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'No restrictions' )
.fill( couponData[ couponType ].allowedEmails[ 0 ] );
} );
}
// set usage limit
if ( couponType === 'usageLimitPerCoupon' ) {
await test.step( 'set usage limit coupon', async () => {
await page
.getByRole( 'link', { name: 'Usage limits' } )
.click();
await page
.getByLabel( 'Usage limit per coupon' )
.fill( couponData[ couponType ].usageLimit );
} );
}
// set usage limit per user
if ( couponType === 'usageLimitPerUser' ) {
await test.step( 'set usage limit per user coupon', async () => {
await page
.getByRole( 'link', { name: 'Usage limits' } )
.click();
await page
.getByLabel( 'Usage limit per user' )
.fill( couponData[ couponType ].usageLimitPerUser );
} );
}
// publish the coupon and retrieve the id
await test.step( 'publish the coupon', async () => {
await page
.getByRole( 'button', { name: 'Publish', exact: true } )
.click();
await expect(
page.getByText( 'Coupon updated.' )
).toBeVisible();
coupon.id = page.url().match( /(?<=post=)\d+/ )[ 0 ];
expect( coupon.id ).toBeDefined();
} );
// verify the creation of the coupon and basic details
await test.step( 'verify coupon creation', async () => {
await page.goto( 'wp-admin/edit.php?post_type=shop_coupon' );
await expect(
page.getByRole( 'cell', {
name: couponData[ couponType ].code,
} )
).toBeVisible();
await expect(
page.getByRole( 'cell', {
name: couponData[ couponType ].description,
} )
).toBeVisible();
await expect(
page.getByRole( 'cell', {
name: couponData[ couponType ].amount,
exact: true,
} )
).toBeVisible();
await page
.getByRole( 'link', {
name: couponData[ couponType ].code,
} )
.first()
.click();
} );
// verify the restrictions for each coupon type
// verify minimum spend
if ( couponType === 'minimumSpend' ) {
await test.step( 'verify minimum spend coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByPlaceholder( 'No minimum' )
).toHaveValue( couponData[ couponType ].minSpend );
} );
}
// verify maximum spend
if ( couponType === 'maximumSpend' ) {
await test.step( 'verify maximum spend coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByPlaceholder( 'No maximum' )
).toHaveValue( couponData[ couponType ].maxSpend );
} );
}
// verify individual use
if ( couponType === 'individualUse' ) {
await test.step( 'verify individual use coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByLabel( 'Individual use only' )
).toBeChecked();
} );
}
// verify exclude sale items
if ( couponType === 'excludeSaleItems' ) {
await test.step( 'verify exclude sale items coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByLabel( 'Exclude sale items' )
).toBeChecked();
} );
}
// verify product categories
if ( couponType === 'productCategories' ) {
await test.step( 'verify product categories coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByRole( 'listitem', {
name: 'Uncategorized',
} )
).toBeVisible();
} );
}
// verify exclude product categories
if ( couponType === 'excludeProductCategories' ) {
await test.step( 'verify exclude product categories coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByRole( 'listitem', {
name: 'Uncategorized',
} )
).toBeVisible();
} );
}
// verify products
if ( couponType === 'products' ) {
await test.step( 'verify products coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByRole( 'listitem', { name: product.name } )
).toBeVisible();
} );
}
// verify exclude products
if ( couponType === 'excludeProducts' ) {
await test.step( 'verify exclude products coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByRole( 'listitem', { name: product.name } )
).toBeVisible();
} );
}
// verify allowed emails
if ( couponType === 'allowedEmails' ) {
await test.step( 'verify allowed emails coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByPlaceholder( 'No restrictions' )
).toHaveValue(
couponData[ couponType ].allowedEmails[ 0 ]
); );
} );
}
// verify usage limit
if ( couponType === 'usageLimitPerCoupon' ) {
await test.step( 'verify usage limit coupon', async () => {
await page await page
.getByRole( 'link', { name: 'Usage limits' } ) .getByLabel( 'Coupon code' )
.fill( couponData[ couponType ].code );
await page
.getByPlaceholder( 'Description (optional)' )
.fill( couponData[ couponType ].description );
await page
.getByPlaceholder( '0' )
.fill( couponData[ couponType ].amount );
await expect(
page.getByText( 'Move to Trash' )
).toBeVisible();
} );
// set up the restrictions for each coupon type
// set minimum spend
if ( couponType === 'minimumSpend' ) {
await test.step( 'set minimum spend coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'No minimum' )
.fill( couponData[ couponType ].minSpend );
} );
}
// set maximum spend
if ( couponType === 'maximumSpend' ) {
await test.step( 'set maximum spend coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'No maximum' )
.fill( couponData[ couponType ].maxSpend );
} );
}
// set individual use
if ( couponType === 'individualUse' ) {
await test.step( 'set individual use coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page.getByLabel( 'Individual use only' ).check();
} );
}
// set exclude sale items
if ( couponType === 'excludeSaleItems' ) {
await test.step( 'set exclude sale items coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page.getByLabel( 'Exclude sale items' ).check();
} );
}
// set product categories
if ( couponType === 'productCategories' ) {
await test.step( 'set product categories coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'Any category' )
.pressSequentially( 'Uncategorized' );
await page
.getByRole( 'option', { name: 'Uncategorized' } )
.click();
} );
}
// set exclude product categories
if ( couponType === 'excludeProductCategories' ) {
await test.step( 'set exclude product categories coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'No categories' )
.pressSequentially( 'Uncategorized' );
await page
.getByRole( 'option', { name: 'Uncategorized' } )
.click();
} );
}
// Skip Brands tests while behind a feature flag.
const skipBrandsTests = true;
// set exclude product brands
if (
couponType === 'excludeProductBrands' &&
! skipBrandsTests
) {
await test.step( 'set exclude product brands coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'No brands' )
.pressSequentially( 'WooCommerce Apparels' );
await page
.getByRole( 'option', {
name: 'WooCommerce Apparels',
} )
.click();
} );
}
// set products
if ( couponType === 'products' ) {
await test.step( 'set products coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'Search for a product…' )
.first()
.pressSequentially( product.name );
await page
.getByRole( 'option', { name: product.name } )
.click();
} );
}
// set exclude products
if ( couponType === 'excludeProducts' ) {
await test.step( 'set exclude products coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'Search for a product…' )
.last()
.pressSequentially( product.name );
await page
.getByRole( 'option', { name: product.name } )
.click();
} );
}
// set allowed emails
if ( couponType === 'allowedEmails' ) {
await test.step( 'set allowed emails coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await page
.getByPlaceholder( 'No restrictions' )
.fill(
couponData[ couponType ].allowedEmails[ 0 ]
);
} );
}
// set usage limit
if ( couponType === 'usageLimitPerCoupon' ) {
await test.step( 'set usage limit coupon', async () => {
await page
.getByRole( 'link', { name: 'Usage limits' } )
.click();
await page
.getByLabel( 'Usage limit per coupon' )
.fill( couponData[ couponType ].usageLimit );
} );
}
// set usage limit per user
if ( couponType === 'usageLimitPerUser' ) {
await test.step( 'set usage limit per user coupon', async () => {
await page
.getByRole( 'link', { name: 'Usage limits' } )
.click();
await page
.getByLabel( 'Usage limit per user' )
.fill( couponData[ couponType ].usageLimitPerUser );
} );
}
// publish the coupon and retrieve the id
await test.step( 'publish the coupon', async () => {
await page
.getByRole( 'button', { name: 'Publish', exact: true } )
.click(); .click();
await expect( await expect(
page.getByLabel( 'Usage limit per coupon' ) page.getByText( 'Coupon updated.' )
).toHaveValue( couponData[ couponType ].usageLimit ); ).toBeVisible();
coupon.id = page.url().match( /(?<=post=)\d+/ )[ 0 ];
expect( coupon.id ).toBeDefined();
} ); } );
}
// verify usage limit per user // verify the creation of the coupon and basic details
if ( couponType === 'usageLimitPerUser' ) { await test.step( 'verify coupon creation', async () => {
await test.step( 'verify usage limit per user coupon', async () => { await page.goto(
await page 'wp-admin/edit.php?post_type=shop_coupon'
.getByRole( 'link', { name: 'Usage limits' } ) );
.click();
await expect( await expect(
page.getByLabel( 'Usage limit per user' ) page.getByRole( 'cell', {
).toHaveValue( couponData[ couponType ].usageLimitPerUser ); name: couponData[ couponType ].code,
} )
).toBeVisible();
await expect(
page.getByRole( 'cell', {
name: couponData[ couponType ].description,
} )
).toBeVisible();
await expect(
page.getByRole( 'cell', {
name: couponData[ couponType ].amount,
exact: true,
} )
).toBeVisible();
await page
.getByRole( 'link', {
name: couponData[ couponType ].code,
} )
.first()
.click();
} ); } );
}
} ); // verify the restrictions for each coupon type
// verify minimum spend
if ( couponType === 'minimumSpend' ) {
await test.step( 'verify minimum spend coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByPlaceholder( 'No minimum' )
).toHaveValue( couponData[ couponType ].minSpend );
} );
}
// verify maximum spend
if ( couponType === 'maximumSpend' ) {
await test.step( 'verify maximum spend coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByPlaceholder( 'No maximum' )
).toHaveValue( couponData[ couponType ].maxSpend );
} );
}
// verify individual use
if ( couponType === 'individualUse' ) {
await test.step( 'verify individual use coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByLabel( 'Individual use only' )
).toBeChecked();
} );
}
// verify exclude sale items
if ( couponType === 'excludeSaleItems' ) {
await test.step( 'verify exclude sale items coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByLabel( 'Exclude sale items' )
).toBeChecked();
} );
}
// verify product categories
if ( couponType === 'productCategories' ) {
await test.step( 'verify product categories coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByRole( 'listitem', {
name: 'Uncategorized',
} )
).toBeVisible();
} );
}
// verify exclude product categories
if ( couponType === 'excludeProductCategories' ) {
await test.step( 'verify exclude product categories coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByRole( 'listitem', {
name: 'Uncategorized',
} )
).toBeVisible();
} );
}
// verify products
if ( couponType === 'products' ) {
await test.step( 'verify products coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByRole( 'listitem', { name: product.name } )
).toBeVisible();
} );
}
// verify exclude products
if ( couponType === 'excludeProducts' ) {
await test.step( 'verify exclude products coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByRole( 'listitem', { name: product.name } )
).toBeVisible();
} );
}
// verify allowed emails
if ( couponType === 'allowedEmails' ) {
await test.step( 'verify allowed emails coupon', async () => {
await page
.getByRole( 'link', {
name: 'Usage restriction',
} )
.click();
await expect(
page.getByPlaceholder( 'No restrictions' )
).toHaveValue(
couponData[ couponType ].allowedEmails[ 0 ]
);
} );
}
// verify usage limit
if ( couponType === 'usageLimitPerCoupon' ) {
await test.step( 'verify usage limit coupon', async () => {
await page
.getByRole( 'link', { name: 'Usage limits' } )
.click();
await expect(
page.getByLabel( 'Usage limit per coupon' )
).toHaveValue( couponData[ couponType ].usageLimit );
} );
}
// verify usage limit per user
if ( couponType === 'usageLimitPerUser' ) {
await test.step( 'verify usage limit per user coupon', async () => {
await page
.getByRole( 'link', { name: 'Usage limits' } )
.click();
await expect(
page.getByLabel( 'Usage limit per user' )
).toHaveValue(
couponData[ couponType ].usageLimitPerUser
);
} );
}
} );
}
} }
} ); );

View File

@ -60,8 +60,7 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
// this shipping zone already exists, don't create it // this shipping zone already exists, don't create it
} else { } else {
await page.goto( await page.goto(
'wp-admin/admin.php?page=wc-settings&tab=shipping&zone_id=new', 'wp-admin/admin.php?page=wc-settings&tab=shipping&zone_id=new'
{ waitUntil: 'networkidle' }
); );
await page await page
.getByPlaceholder( 'Zone name' ) .getByPlaceholder( 'Zone name' )
@ -92,10 +91,8 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
.getByRole( 'button', { name: 'Continue' } ) .getByRole( 'button', { name: 'Continue' } )
.last() .last()
.click(); .click();
await page.waitForLoadState( 'networkidle' );
await page.locator( '#btn-ok' ).click(); await page.locator( '#btn-ok' ).click();
await page.waitForLoadState( 'networkidle' );
await expect( await expect(
page page
@ -132,8 +129,7 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
// this shipping zone already exists, don't create it // this shipping zone already exists, don't create it
} else { } else {
await page.goto( await page.goto(
'wp-admin/admin.php?page=wc-settings&tab=shipping&zone_id=new', 'wp-admin/admin.php?page=wc-settings&tab=shipping&zone_id=new'
{ waitUntil: 'networkidle' }
); );
await page await page
.getByPlaceholder( 'Zone name' ) .getByPlaceholder( 'Zone name' )
@ -159,10 +155,8 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
.getByRole( 'button', { name: 'Continue' } ) .getByRole( 'button', { name: 'Continue' } )
.last() .last()
.click(); .click();
await page.waitForLoadState( 'networkidle' );
await page.locator( '#btn-ok' ).click(); await page.locator( '#btn-ok' ).click();
await page.waitForLoadState( 'networkidle' );
await expect( await expect(
page page
@ -196,8 +190,7 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
// this shipping zone already exists, don't create it // this shipping zone already exists, don't create it
} else { } else {
await page.goto( await page.goto(
'wp-admin/admin.php?page=wc-settings&tab=shipping&zone_id=new', 'wp-admin/admin.php?page=wc-settings&tab=shipping&zone_id=new'
{ waitUntil: 'networkidle' }
); );
await page await page
.getByPlaceholder( 'Zone name' ) .getByPlaceholder( 'Zone name' )
@ -209,7 +202,7 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
input.click(); input.click();
input.fill( 'Canada' ); input.fill( 'Canada' );
await page.getByText( 'Canada' ).last().click(); await page.getByLabel( 'Canada', { exact: true } ).click();
// Close dropdown // Close dropdown
await page.getByPlaceholder( 'Zone name' ).click(); await page.getByPlaceholder( 'Zone name' ).click();
@ -222,10 +215,8 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
.getByRole( 'button', { name: 'Continue' } ) .getByRole( 'button', { name: 'Continue' } )
.last() .last()
.click(); .click();
await page.waitForLoadState( 'networkidle' );
await page.locator( '#btn-ok' ).click(); await page.locator( '#btn-ok' ).click();
await page.waitForLoadState( 'networkidle' );
await expect( await expect(
page page
@ -240,7 +231,6 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
.click(); .click();
await page.getByLabel( 'Cost', { exact: true } ).fill( '10' ); await page.getByLabel( 'Cost', { exact: true } ).fill( '10' );
await page.getByRole( 'button', { name: 'Save' } ).last().click(); await page.getByRole( 'button', { name: 'Save' } ).last().click();
await page.waitForLoadState( 'networkidle' );
await page.goto( await page.goto(
'wp-admin/admin.php?page=wc-settings&tab=shipping' 'wp-admin/admin.php?page=wc-settings&tab=shipping'
@ -342,8 +332,7 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
// this shipping zone already exists, don't create it // this shipping zone already exists, don't create it
} else { } else {
await page.goto( await page.goto(
'wp-admin/admin.php?page=wc-settings&tab=shipping&zone_id=new', 'wp-admin/admin.php?page=wc-settings&tab=shipping&zone_id=new'
{ waitUntil: 'networkidle' }
); );
await page.locator( '#zone_name' ).fill( shippingZoneNameFlatRate ); await page.locator( '#zone_name' ).fill( shippingZoneNameFlatRate );
@ -353,7 +342,7 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
input.click(); input.click();
input.type( 'Canada' ); input.type( 'Canada' );
await page.getByText( 'Canada' ).last().click(); await page.getByLabel( 'Canada', { exact: true } ).click();
// Close dropdown // Close dropdown
await page.keyboard.press( 'Escape' ); await page.keyboard.press( 'Escape' );
@ -366,10 +355,7 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
.last() .last()
.click(); .click();
await page.waitForLoadState( 'networkidle' );
await page.locator( '#btn-ok' ).click(); await page.locator( '#btn-ok' ).click();
await page.waitForLoadState( 'networkidle' );
await expect( await expect(
page page
@ -384,13 +370,17 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
.click(); .click();
await page.locator( '#woocommerce_flat_rate_cost' ).fill( '10' ); await page.locator( '#woocommerce_flat_rate_cost' ).fill( '10' );
await page.locator( '#btn-ok' ).click(); await page.locator( '#btn-ok' ).click();
await page.waitForLoadState( 'networkidle' );
await page.locator( 'text=Delete' ).waitFor(); await expect(
page.getByRole( 'cell', { name: 'Edit | Delete', exact: true } )
).toBeVisible();
page.on( 'dialog', ( dialog ) => dialog.accept() ); page.on( 'dialog', ( dialog ) => dialog.accept() );
await page.locator( 'text=Delete' ).click(); await page
.getByRole( 'cell', { name: 'Edit | Delete', exact: true } )
.locator( 'text=Delete' )
.click();
await expect( await expect(
page.locator( '.wc-shipping-zone-method-blank-state' ) page.locator( '.wc-shipping-zone-method-blank-state' )
@ -482,7 +472,6 @@ test.describe( 'Verifies shipping options from customer perspective', () => {
await context.clearCookies(); await context.clearCookies();
await page.goto( `/shop/?add-to-cart=${ productId }` ); await page.goto( `/shop/?add-to-cart=${ productId }` );
await page.waitForLoadState( 'networkidle' );
} ); } );
test.afterAll( async ( { baseURL } ) => { test.afterAll( async ( { baseURL } ) => {

View File

@ -52,7 +52,14 @@ const test = baseTest.extend( {
test.describe( test.describe(
'Add WooCommerce Blocks Into Page', 'Add WooCommerce Blocks Into Page',
{ tag: [ '@gutenberg', '@services', '@skip-on-default-pressable' ] }, {
tag: [
'@gutenberg',
'@services',
'@skip-on-default-pressable',
'@skip-on-default-wpcom',
],
},
() => { () => {
test.beforeAll( async ( { api } ) => { test.beforeAll( async ( { api } ) => {
// add product attribute // add product attribute

View File

@ -28,7 +28,14 @@ const test = baseTest.extend( {
test.describe( test.describe(
'Add WooCommerce Patterns Into Page', 'Add WooCommerce Patterns Into Page',
{ tag: [ '@gutenberg', '@services', '@skip-on-default-pressable' ] }, {
tag: [
'@gutenberg',
'@services',
'@skip-on-default-pressable',
'@skip-on-default-wpcom',
],
},
() => { () => {
test( 'can insert WooCommerce patterns into page', async ( { test( 'can insert WooCommerce patterns into page', async ( {
page, page,
@ -86,7 +93,9 @@ test.describe(
// check some elements from added patterns // check some elements from added patterns
for ( let i = 1; i < wooPatterns.length; i++ ) { for ( let i = 1; i < wooPatterns.length; i++ ) {
await expect( await expect(
page.getByText( `${ wooPatterns[ i ].button }` ) page.getByRole( 'link', {
name: `${ wooPatterns[ i ].button }`,
} )
).toBeVisible(); ).toBeVisible();
} }
} ); } );

View File

@ -85,7 +85,7 @@ test.describe( 'Merchant > Customer List', { tag: '@services' }, () => {
test( test(
'Merchant can view a list of all customers, filter and download', 'Merchant can view a list of all customers, filter and download',
{ tag: '@skip-on-default-pressable' }, { tag: [ '@skip-on-default-pressable', '@skip-on-default-wpcom' ] },
async ( { page, customers } ) => { async ( { page, customers } ) => {
await test.step( 'Go to the customers reports page', async () => { await test.step( 'Go to the customers reports page', async () => {
const responsePromise = page.waitForResponse( const responsePromise = page.waitForResponse(

View File

@ -110,6 +110,17 @@ test.describe(
await test.step( 'Select payment method and pay for the order', async () => { await test.step( 'Select payment method and pay for the order', async () => {
// explicitly select the payment method // explicitly select the payment method
await page.getByText( 'Direct bank transfer' ).click(); await page.getByText( 'Direct bank transfer' ).click();
// Handle notice if present
await page.addLocatorHandler(
page.getByRole( 'link', { name: 'Dismiss' } ),
async () => {
await page
.getByRole( 'link', { name: 'Dismiss' } )
.click();
}
);
// pay for the order // pay for the order
await page await page
.getByRole( 'button', { name: 'Pay for order' } ) .getByRole( 'button', { name: 'Pay for order' } )

View File

@ -4,7 +4,7 @@ const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
test.describe( test.describe(
'Launch Your Store - logged in', 'Launch Your Store - logged in',
{ tag: [ '@gutenberg', '@services' ] }, { tag: [ '@gutenberg', '@services', '@skip-on-default-wpcom' ] },
() => { () => {
test.use( { storageState: process.env.ADMINSTATE } ); test.use( { storageState: process.env.ADMINSTATE } );