[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:
parent
6b5dbbc6ac
commit
9c514b3949
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: update
|
||||||
|
|
||||||
|
Expand the e2e suite we're running on WPCOM part #4.
|
|
@ -45,6 +45,16 @@ config = {
|
||||||
'**/merchant/settings-woo-com.spec.js',
|
'**/merchant/settings-woo-com.spec.js',
|
||||||
'**/merchant/users-create.spec.js',
|
'**/merchant/users-create.spec.js',
|
||||||
'**/merchant/users-manage.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/,
|
grepInvert: /@skip-on-default-wpcom/,
|
||||||
},
|
},
|
||||||
|
|
|
@ -119,7 +119,10 @@ test.describe(
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test( 'can remove a coupon', async ( { page } ) => {
|
test(
|
||||||
|
'can remove a coupon',
|
||||||
|
{ tag: [ '@skip-on-default-wpcom' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
await page.goto(
|
await page.goto(
|
||||||
`/wp-admin/admin.php?page=wc-orders&action=edit&id=${ orderId }`
|
`/wp-admin/admin.php?page=wc-orders&action=edit&id=${ orderId }`
|
||||||
);
|
);
|
||||||
|
@ -133,7 +136,9 @@ test.describe(
|
||||||
page.getByRole( 'cell', { name: 'Coupon(s)' } )
|
page.getByRole( 'cell', { name: 'Coupon(s)' } )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole( 'cell', { name: `- $${ couponAmount }.00` } )
|
page.getByRole( 'cell', {
|
||||||
|
name: `- $${ couponAmount }.00`,
|
||||||
|
} )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole( 'cell', {
|
page.getByRole( 'cell', {
|
||||||
|
@ -142,17 +147,22 @@ test.describe(
|
||||||
} )
|
} )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
// remove the coupon
|
// 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
|
// make sure the coupon was removed
|
||||||
await expect(
|
await expect(
|
||||||
page.locator( '.wc_coupon_list li', { hasText: couponCode } )
|
page.locator( '.wc_coupon_list li', {
|
||||||
|
hasText: couponCode,
|
||||||
|
} )
|
||||||
).toBeHidden();
|
).toBeHidden();
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page
|
||||||
.getByRole( 'cell', { name: `$${ productPrice }` } )
|
.getByRole( 'cell', { name: `$${ productPrice }` } )
|
||||||
.nth( 1 )
|
.nth( 1 )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -71,10 +71,7 @@ test.describe(
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test(
|
test( 'can receive new order email', async ( { page, baseURL } ) => {
|
||||||
'can receive new order email',
|
|
||||||
{ tag: '@skip-on-default-pressable' },
|
|
||||||
async ( { page, baseURL } ) => {
|
|
||||||
// New order emails are sent automatically when we create a simple order. Verify that we get these.
|
// 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.
|
// Need to create a new order for this test because we clear logs before each run.
|
||||||
const api = new wcApi( {
|
const api = new wcApi( {
|
||||||
|
@ -102,9 +99,7 @@ test.describe(
|
||||||
).toContainText( admin.email );
|
).toContainText( admin.email );
|
||||||
await expect(
|
await expect(
|
||||||
page.locator( 'td.column-subject >> nth=1' )
|
page.locator( 'td.column-subject >> nth=1' )
|
||||||
).toContainText(
|
).toContainText( `[${ storeName }]: New order #${ newOrderId }` );
|
||||||
`[${ storeName }]: New order #${ newOrderId }`
|
|
||||||
);
|
|
||||||
|
|
||||||
// look at order email contents
|
// look at order email contents
|
||||||
await page
|
await page
|
||||||
|
@ -113,26 +108,25 @@ test.describe(
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText( 'Receiver wordpress@example.com' )
|
page.getByText( `Receiver ${ admin.email }` )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText( 'Subject [WooCommerce Core E2E' )
|
page.getByText( 'Subject [WooCommerce Core E2E' )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await page.getByRole( 'link', { name: 'json' } ).click();
|
await page.getByRole( 'link', { name: 'json' } ).click();
|
||||||
await expect(
|
await expect(
|
||||||
page.locator(
|
page.locator( '#wp-mail-logging-modal-content-body-content' )
|
||||||
'#wp-mail-logging-modal-content-body-content'
|
).toContainText( 'You’ve received the following order from :' );
|
||||||
)
|
} );
|
||||||
).toContainText(
|
|
||||||
'You’ve 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.
|
// 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
|
// 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 emailContentJson = '#wp-mail-logging-modal-format-json';
|
||||||
const api = new wcApi( {
|
const api = new wcApi( {
|
||||||
url: baseURL,
|
url: baseURL,
|
||||||
|
@ -163,7 +157,9 @@ test.describe(
|
||||||
|
|
||||||
// Verify that the email has been sent
|
// Verify that the email has been sent
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText( `Your ${ storeName } order is now complete` )
|
page.getByText(
|
||||||
|
`Your ${ storeName } order is now complete`
|
||||||
|
)
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
|
||||||
// Enter email log and select to view the content in JSON
|
// Enter email log and select to view the content in JSON
|
||||||
|
@ -189,7 +185,8 @@ test.describe(
|
||||||
await expect( page.locator( emailContent ) ).toContainText(
|
await expect( page.locator( emailContent ) ).toContainText(
|
||||||
'Thanks for shopping with us'
|
'Thanks for shopping with us'
|
||||||
);
|
);
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'can receive cancelled order email', async ( {
|
test( 'can receive cancelled order email', async ( {
|
||||||
page,
|
page,
|
||||||
|
|
|
@ -87,8 +87,8 @@ const wcPages = [
|
||||||
{
|
{
|
||||||
name: 'Overview',
|
name: 'Overview',
|
||||||
heading: 'Overview',
|
heading: 'Overview',
|
||||||
element: '.woocommerce-marketing-card-header-description',
|
element: '.woocommerce-marketing-channels-card',
|
||||||
text: 'Start by adding a channel to your store',
|
text: 'Channels',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Coupons',
|
name: 'Coupons',
|
||||||
|
@ -201,9 +201,10 @@ for ( const currentPage of wcPages ) {
|
||||||
} );
|
} );
|
||||||
|
|
||||||
for ( let i = 0; i < currentPage.subpages.length; i++ ) {
|
for ( let i = 0; i < currentPage.subpages.length; i++ ) {
|
||||||
test( `Can load ${ currentPage.subpages[ i ].name }`, async ( {
|
test(
|
||||||
page,
|
`Can load ${ currentPage.subpages[ i ].name }`,
|
||||||
} ) => {
|
{ tag: '@skip-on-default-wpcom' },
|
||||||
|
async ( { page } ) => {
|
||||||
await page
|
await page
|
||||||
.locator(
|
.locator(
|
||||||
`li.wp-menu-open > ul.wp-submenu > li a:text-is("${ currentPage.subpages[ i ].name }")`
|
`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(
|
await expect(
|
||||||
page.locator( currentPage.subpages[ i ].element )
|
page.locator( currentPage.subpages[ i ].element )
|
||||||
).toContainText( currentPage.subpages[ i ].text );
|
).toContainText( currentPage.subpages[ i ].text );
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -96,7 +96,10 @@ for ( const productType of Object.keys( productData ) ) {
|
||||||
await page
|
await page
|
||||||
.getByLabel( 'Regular price ($)' )
|
.getByLabel( 'Regular price ($)' )
|
||||||
.fill( productData[ productType ].regularPrice );
|
.fill( productData[ productType ].regularPrice );
|
||||||
await page.getByText( 'Inventory' ).click();
|
await page
|
||||||
|
.getByRole( 'link' )
|
||||||
|
.filter( { hasText: 'Inventory' } )
|
||||||
|
.click();
|
||||||
|
|
||||||
// Inventory information
|
// Inventory information
|
||||||
await page
|
await page
|
||||||
|
@ -130,7 +133,10 @@ for ( const productType of Object.keys( productData ) ) {
|
||||||
|
|
||||||
await test.step( 'add product advanced information', async () => {
|
await test.step( 'add product advanced information', async () => {
|
||||||
// Advanced information
|
// Advanced information
|
||||||
await page.getByText( 'Advanced' ).click();
|
await page
|
||||||
|
.getByRole( 'link' )
|
||||||
|
.filter( { hasText: 'Advanced' } )
|
||||||
|
.click();
|
||||||
await page
|
await page
|
||||||
.getByLabel( 'Purchase note' )
|
.getByLabel( 'Purchase note' )
|
||||||
.fill( productData[ productType ].purchaseNote );
|
.fill( productData[ productType ].purchaseNote );
|
||||||
|
@ -265,12 +271,16 @@ for ( const productType of Object.keys( productData ) ) {
|
||||||
|
|
||||||
// Verify description
|
// Verify description
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText(
|
page
|
||||||
|
.getByText(
|
||||||
productData[ productType ].shortDescription
|
productData[ productType ].shortDescription
|
||||||
)
|
)
|
||||||
|
.first()
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText( productData[ productType ].description )
|
page
|
||||||
|
.getByText( productData[ productType ].description )
|
||||||
|
.first()
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText( `SKU: ${ productData[ productType ].sku }` )
|
page.getByText( `SKU: ${ productData[ productType ].sku }` )
|
||||||
|
|
Loading…
Reference in New Issue