[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' ] },
testMatch: [
'**/basic.spec.js',
'**/merchant/products/add-variable-product/**/*.spec.js',
'**/activate-and-setup/**/*.spec.js',
'**/merchant/products/block-editor/**/*.spec.js',
'**/admin-analytics/**/*.spec.js',
'**/admin-marketing/**/*.spec.js',
'**/admin-tasks/**/*.spec.js',
'**/customize-store/**/*.spec.js',
'**/merchant/create-page.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',
'**/merchant/**/*.spec.js',
'**/shopper/checkout-create-account.spec.js',
'**/shopper/checkout-login.spec.js',
'**/shopper/checkout.spec.js',

View File

@ -99,7 +99,10 @@ test.describe(
page.locator( '#set-post-thumbnail img[src*="image-01"]' )
).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 () => {
@ -141,7 +144,10 @@ test.describe(
page.locator( '#set-post-thumbnail img[src*="image-02"]' )
).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 () => {
@ -176,7 +182,10 @@ test.describe(
page.getByRole( 'link', { name: 'Set product image' } )
).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 () => {
@ -237,7 +246,10 @@ test.describe(
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 () => {
@ -276,7 +288,10 @@ test.describe(
'number of images should decrease'
).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 () => {

View File

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

View File

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