[e2e tests] External sites - update /merchant tests, part 4 (#51181)

* Skip `WooCommerce woo.com Settings`

* Make `Update` button more unique

* Run entire /merchant folder

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

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Ivan Stojadinov 2024-09-06 11:27:45 +02:00 committed by GitHub
parent 19661e3317
commit a61a2bd29e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 87 additions and 87 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Update the rest of /merchant tests so they are passing against Pressable env.

View File

@ -9,38 +9,12 @@ config = {
use: { ...devices[ 'Desktop Chrome' ] }, use: { ...devices[ 'Desktop Chrome' ] },
testMatch: [ testMatch: [
'**/basic.spec.js', '**/basic.spec.js',
'**/merchant/products/add-variable-product/**/*.spec.js',
'**/activate-and-setup/**/*.spec.js', '**/activate-and-setup/**/*.spec.js',
'**/merchant/products/block-editor/**/*.spec.js',
'**/admin-analytics/**/*.spec.js', '**/admin-analytics/**/*.spec.js',
'**/admin-marketing/**/*.spec.js', '**/admin-marketing/**/*.spec.js',
'**/admin-tasks/**/*.spec.js', '**/admin-tasks/**/*.spec.js',
'**/customize-store/**/*.spec.js', '**/customize-store/**/*.spec.js',
'**/merchant/create-page.spec.js', '**/merchant/**/*.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/command-palette.spec.js',
'**/merchant/create-cart-block.spec.js',
'**/merchant/create-checkout-block.spec.js',
'**/merchant/create-coupon.spec.js',
'**/merchant/create-order.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',
'**/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',
'**/shopper/checkout-create-account.spec.js', '**/shopper/checkout-create-account.spec.js',
'**/shopper/checkout-login.spec.js', '**/shopper/checkout-login.spec.js',
'**/shopper/checkout.spec.js', '**/shopper/checkout.spec.js',

View File

@ -99,7 +99,10 @@ test.describe(
page.locator( '#set-post-thumbnail img[src*="image-01"]' ) page.locator( '#set-post-thumbnail img[src*="image-01"]' )
).toBeVisible(); ).toBeVisible();
await page.getByRole( 'button', { name: 'Update' } ).click(); await page
.locator( '#publishing-action' )
.getByRole( 'button', { name: 'Update' } )
.click();
} ); } );
await test.step( 'Verify product image was set', async () => { await test.step( 'Verify product image was set', async () => {
@ -141,7 +144,10 @@ test.describe(
page.locator( '#set-post-thumbnail img[src*="image-02"]' ) page.locator( '#set-post-thumbnail img[src*="image-02"]' )
).toBeVisible(); ).toBeVisible();
await page.getByRole( 'button', { name: 'Update' } ).click(); await page
.locator( '#publishing-action' )
.getByRole( 'button', { name: 'Update' } )
.click();
} ); } );
await test.step( 'Verify product image was set', async () => { await test.step( 'Verify product image was set', async () => {
@ -176,7 +182,10 @@ test.describe(
page.getByRole( 'link', { name: 'Set product image' } ) page.getByRole( 'link', { name: 'Set product image' } )
).toBeVisible(); ).toBeVisible();
await page.getByRole( 'button', { name: 'Update' } ).click(); await page
.locator( '#publishing-action' )
.getByRole( 'button', { name: 'Update' } )
.click();
} ); } );
await test.step( 'Verify product image was removed', async () => { await test.step( 'Verify product image was removed', async () => {
@ -237,7 +246,10 @@ test.describe(
initialImagesCount = currentImagesCount; initialImagesCount = currentImagesCount;
} }
await page.getByRole( 'button', { name: 'Update' } ).click(); await page
.locator( '#publishing-action' )
.getByRole( 'button', { name: 'Update' } )
.click();
} ); } );
await test.step( 'Verify product gallery', async () => { await test.step( 'Verify product gallery', async () => {
@ -276,7 +288,10 @@ test.describe(
'number of images should decrease' 'number of images should decrease'
).toEqual( imagesCount - 1 ); ).toEqual( imagesCount - 1 );
await page.getByRole( 'button', { name: 'Update' } ).click(); await page
.locator( '#publishing-action' )
.getByRole( 'button', { name: 'Update' } )
.click();
} ); } );
await test.step( 'Verify product gallery', async () => { await test.step( 'Verify product gallery', async () => {

View File

@ -54,7 +54,10 @@ test.describe(
exact: true, exact: true,
} ) } )
.click(); .click();
await page.getByRole( 'button', { name: 'Update' } ).click(); await page
.locator( '#publishing-action' )
.getByRole( 'button', { name: 'Update' } )
.click();
await expect( await expect(
page.getByText( 'Product updated.' ) page.getByText( 'Product updated.' )
).toBeVisible(); ).toBeVisible();

View File

@ -1,65 +1,69 @@
const { test, expect } = require( '@playwright/test' ); const { test, expect } = require( '@playwright/test' );
const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
test.describe( 'WooCommerce woo.com Settings', { tag: '@services' }, () => { test.describe(
test.use( { storageState: process.env.ADMINSTATE } ); 'WooCommerce woo.com Settings',
{ tag: [ '@services', '@skip-on-default-pressable' ] },
() => {
test.use( { storageState: process.env.ADMINSTATE } );
test.beforeAll( async ( { baseURL } ) => { test.beforeAll( async ( { baseURL } ) => {
// make sure the analytics connection is disabled // make sure the analytics connection is disabled
const api = new wcApi( { const api = new wcApi( {
url: baseURL, url: baseURL,
consumerKey: process.env.CONSUMER_KEY, consumerKey: process.env.CONSUMER_KEY,
consumerSecret: process.env.CONSUMER_SECRET, consumerSecret: process.env.CONSUMER_SECRET,
version: 'wc/v3', version: 'wc/v3',
} ); } );
await api.put( 'settings/advanced/woocommerce_analytics_enabled', { await api.put( 'settings/advanced/woocommerce_analytics_enabled', {
value: 'no',
} );
await api.put(
'settings/advanced/woocommerce_show_marketplace_suggestions',
{
value: 'no', value: 'no',
} } );
); await api.put(
} ); 'settings/advanced/woocommerce_show_marketplace_suggestions',
{
value: 'no',
}
);
} );
test( 'can enable analytics tracking', async ( { page } ) => { test( 'can enable analytics tracking', async ( { page } ) => {
await page.goto( await page.goto(
'wp-admin/admin.php?page=wc-settings&tab=advanced&section=woocommerce_com' 'wp-admin/admin.php?page=wc-settings&tab=advanced&section=woocommerce_com'
); );
// enable analytics tracking // enable analytics tracking
await page await page
.getByLabel( 'Allow usage of WooCommerce to be tracked' ) .getByLabel( 'Allow usage of WooCommerce to be tracked' )
.check(); .check();
await page.getByRole( 'button', { name: 'Save changes' } ).click(); await page.getByRole( 'button', { name: 'Save changes' } ).click();
// confirm setting saved // confirm setting saved
await expect( page.locator( 'div.updated.inline' ) ).toContainText( await expect( page.locator( 'div.updated.inline' ) ).toContainText(
'Your settings have been saved.' 'Your settings have been saved.'
); );
await expect( await expect(
page.getByLabel( 'Allow usage of WooCommerce to be tracked' ) page.getByLabel( 'Allow usage of WooCommerce to be tracked' )
).toBeChecked(); ).toBeChecked();
} ); } );
test( 'can enable marketplace suggestions', async ( { page } ) => { test( 'can enable marketplace suggestions', async ( { page } ) => {
await page.goto( await page.goto(
'wp-admin/admin.php?page=wc-settings&tab=advanced&section=woocommerce_com' 'wp-admin/admin.php?page=wc-settings&tab=advanced&section=woocommerce_com'
); );
// enable marketplace suggestions // enable marketplace suggestions
await page await page
.getByLabel( 'Display suggestions within WooCommerce' ) .getByLabel( 'Display suggestions within WooCommerce' )
.check(); .check();
await page.getByRole( 'button', { name: 'Save changes' } ).click(); await page.getByRole( 'button', { name: 'Save changes' } ).click();
// confirm setting saved // confirm setting saved
await expect( page.locator( 'div.updated.inline' ) ).toContainText( await expect( page.locator( 'div.updated.inline' ) ).toContainText(
'Your settings have been saved.' 'Your settings have been saved.'
); );
await expect( await expect(
page.getByLabel( 'Display suggestions within WooCommerce' ) page.getByLabel( 'Display suggestions within WooCommerce' )
).toBeChecked(); ).toBeChecked();
} ); } );
} ); }
);