[e2e] External - Expand WPCOM suite, part 4 (#51424)

* Skip `can remove a coupon` - error 500

* Make elements more specific

* Skip two tests from order-emails.spec.js

* Skip `WooCommerce Page Load`

* Expand WPCOM suite

* Change hardcoded email address

* Unskip tests in order-emails.spec.js

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

* ESLint updates

* Check different locator for Marketing channels

* Skip "can receive completed email" for now

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Ivan Stojadinov 2024-10-02 11:23:07 +02:00 committed by GitHub
parent 6b5dbbc6ac
commit 9c514b3949
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 195 additions and 162 deletions

View File

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

View File

@ -45,6 +45,16 @@ config = {
'**/merchant/settings-woo-com.spec.js',
'**/merchant/users-create.spec.js',
'**/merchant/users-manage.spec.js',
'**/merchant/order-coupon.spec.js',
'**/merchant/order-edit.spec.js',
'**/merchant/order-emails.spec.js',
'**/merchant/order-refund.spec.js',
'**/merchant/order-search.spec.js',
'**/merchant/order-status-filter.spec.js',
'**/merchant/page-loads.spec.js',
'**/merchant/product-create-simple.spec.js',
'**/merchant/product-delete.spec.js',
'**/merchant/product-edit.spec.js',
],
grepInvert: /@skip-on-default-wpcom/,
},

View File

@ -119,7 +119,10 @@ test.describe(
).toBeVisible();
} );
test( 'can remove a coupon', async ( { page } ) => {
test(
'can remove a coupon',
{ tag: [ '@skip-on-default-wpcom' ] },
async ( { page } ) => {
await page.goto(
`/wp-admin/admin.php?page=wc-orders&action=edit&id=${ orderId }`
);
@ -133,7 +136,9 @@ test.describe(
page.getByRole( 'cell', { name: 'Coupon(s)' } )
).toBeVisible();
await expect(
page.getByRole( 'cell', { name: `- $${ couponAmount }.00` } )
page.getByRole( 'cell', {
name: `- $${ couponAmount }.00`,
} )
).toBeVisible();
await expect(
page.getByRole( 'cell', {
@ -142,17 +147,22 @@ test.describe(
} )
).toBeVisible();
// remove the coupon
await page.locator( 'a.remove-coupon' ).dispatchEvent( 'click' ); // have to use dispatchEvent because nothing visible to click on
await page
.locator( 'a.remove-coupon' )
.dispatchEvent( 'click' ); // have to use dispatchEvent because nothing visible to click on
// make sure the coupon was removed
await expect(
page.locator( '.wc_coupon_list li', { hasText: couponCode } )
page.locator( '.wc_coupon_list li', {
hasText: couponCode,
} )
).toBeHidden();
await expect(
page
.getByRole( 'cell', { name: `$${ productPrice }` } )
.nth( 1 )
).toBeVisible();
} );
}
);
}
);

View File

@ -71,10 +71,7 @@ test.describe(
} );
} );
test(
'can receive new order email',
{ tag: '@skip-on-default-pressable' },
async ( { page, baseURL } ) => {
test( 'can receive new order email', async ( { page, baseURL } ) => {
// New order emails are sent automatically when we create a simple order. Verify that we get these.
// Need to create a new order for this test because we clear logs before each run.
const api = new wcApi( {
@ -102,9 +99,7 @@ test.describe(
).toContainText( admin.email );
await expect(
page.locator( 'td.column-subject >> nth=1' )
).toContainText(
`[${ storeName }]: New order #${ newOrderId }`
);
).toContainText( `[${ storeName }]: New order #${ newOrderId }` );
// look at order email contents
await page
@ -113,26 +108,25 @@ test.describe(
.click();
await expect(
page.getByText( 'Receiver wordpress@example.com' )
page.getByText( `Receiver ${ admin.email }` )
).toBeVisible();
await expect(
page.getByText( 'Subject [WooCommerce Core E2E' )
).toBeVisible();
await page.getByRole( 'link', { name: 'json' } ).click();
await expect(
page.locator(
'#wp-mail-logging-modal-content-body-content'
)
).toContainText(
'Youve received the following order from :'
);
}
);
page.locator( '#wp-mail-logging-modal-content-body-content' )
).toContainText( 'Youve received the following order from :' );
} );
test( 'can receive completed email', async ( { page, baseURL } ) => {
test(
'can receive completed email',
{ tag: '@skip-on-default-wpcom' },
async ( { page, baseURL } ) => {
// Completed order emails are sent automatically when an order's payment is completed.
// Verify that the email is sent, and that the content is the expected one
const emailContent = '#wp-mail-logging-modal-content-body-content';
const emailContent =
'#wp-mail-logging-modal-content-body-content';
const emailContentJson = '#wp-mail-logging-modal-format-json';
const api = new wcApi( {
url: baseURL,
@ -163,7 +157,9 @@ test.describe(
// Verify that the email has been sent
await expect(
page.getByText( `Your ${ storeName } order is now complete` )
page.getByText(
`Your ${ storeName } order is now complete`
)
).toBeVisible();
// Enter email log and select to view the content in JSON
@ -189,7 +185,8 @@ test.describe(
await expect( page.locator( emailContent ) ).toContainText(
'Thanks for shopping with us'
);
} );
}
);
test( 'can receive cancelled order email', async ( {
page,

View File

@ -87,8 +87,8 @@ const wcPages = [
{
name: 'Overview',
heading: 'Overview',
element: '.woocommerce-marketing-card-header-description',
text: 'Start by adding a channel to your store',
element: '.woocommerce-marketing-channels-card',
text: 'Channels',
},
{
name: 'Coupons',
@ -201,9 +201,10 @@ for ( const currentPage of wcPages ) {
} );
for ( let i = 0; i < currentPage.subpages.length; i++ ) {
test( `Can load ${ currentPage.subpages[ i ].name }`, async ( {
page,
} ) => {
test(
`Can load ${ currentPage.subpages[ i ].name }`,
{ tag: '@skip-on-default-wpcom' },
async ( { page } ) => {
await page
.locator(
`li.wp-menu-open > ul.wp-submenu > li a:text-is("${ currentPage.subpages[ i ].name }")`
@ -223,7 +224,8 @@ for ( const currentPage of wcPages ) {
await expect(
page.locator( currentPage.subpages[ i ].element )
).toContainText( currentPage.subpages[ i ].text );
} );
}
);
}
}
);

View File

@ -96,7 +96,10 @@ for ( const productType of Object.keys( productData ) ) {
await page
.getByLabel( 'Regular price ($)' )
.fill( productData[ productType ].regularPrice );
await page.getByText( 'Inventory' ).click();
await page
.getByRole( 'link' )
.filter( { hasText: 'Inventory' } )
.click();
// Inventory information
await page
@ -130,7 +133,10 @@ for ( const productType of Object.keys( productData ) ) {
await test.step( 'add product advanced information', async () => {
// Advanced information
await page.getByText( 'Advanced' ).click();
await page
.getByRole( 'link' )
.filter( { hasText: 'Advanced' } )
.click();
await page
.getByLabel( 'Purchase note' )
.fill( productData[ productType ].purchaseNote );
@ -265,12 +271,16 @@ for ( const productType of Object.keys( productData ) ) {
// Verify description
await expect(
page.getByText(
page
.getByText(
productData[ productType ].shortDescription
)
.first()
).toBeVisible();
await expect(
page.getByText( productData[ productType ].description )
page
.getByText( productData[ productType ].description )
.first()
).toBeVisible();
await expect(
page.getByText( `SKU: ${ productData[ productType ].sku }` )