From 18ab90badd71d43ad1a132fba84d3b93508466f4 Mon Sep 17 00:00:00 2001 From: "Veljko V." Date: Wed, 4 Sep 2024 22:09:04 +0200 Subject: [PATCH] [e2e tests] External sites - update /shopper tests, part 2 (#51100) * Update shopper tests, external config and add tags * Update WPCOM config to include shopper tests --- .../e2e-fix-compatibility-external-envs-part2 | 4 + .../default-pressable/playwright.config.js | 17 ++++ .../envs/default-wpcom/playwright.config.js | 22 ++++- .../tests/shopper/launch-your-store.spec.js | 84 ++++++++++--------- .../shop-products-filter-by-price.spec.js | 9 +- .../shopper/shop-title-after-deletion.spec.js | 12 +++ .../tests/shopper/wordpress-post.spec.js | 8 +- .../woocommerce/tests/e2e-pw/utils/editor.js | 1 + 8 files changed, 116 insertions(+), 41 deletions(-) create mode 100644 plugins/woocommerce/changelog/e2e-fix-compatibility-external-envs-part2 diff --git a/plugins/woocommerce/changelog/e2e-fix-compatibility-external-envs-part2 b/plugins/woocommerce/changelog/e2e-fix-compatibility-external-envs-part2 new file mode 100644 index 00000000000..682518cc821 --- /dev/null +++ b/plugins/woocommerce/changelog/e2e-fix-compatibility-external-envs-part2 @@ -0,0 +1,4 @@ +Significance: patch +Type: update + +Update /shopper tests (second part), so they are passing against Pressable env. \ No newline at end of file diff --git a/plugins/woocommerce/tests/e2e-pw/envs/default-pressable/playwright.config.js b/plugins/woocommerce/tests/e2e-pw/envs/default-pressable/playwright.config.js index b0747f37c30..48f83f3e12b 100644 --- a/plugins/woocommerce/tests/e2e-pw/envs/default-pressable/playwright.config.js +++ b/plugins/woocommerce/tests/e2e-pw/envs/default-pressable/playwright.config.js @@ -21,6 +21,23 @@ config = { '**/merchant/create-checkout-block.spec.js', '**/merchant/create-coupon.spec.js', '**/merchant/create-order.spec.js', + '**/shopper/checkout-create-account.spec.js', + '**/shopper/checkout-login.spec.js', + '**/shopper/checkout.spec.js', + '**/shopper/dashboard-access.spec.js', + '**/shopper/mini-cart.spec.js', + '**/shopper/my-account-addresses.spec.js', + '**/shopper/my-account-create-account.spec.js', + '**/shopper/my-account-downloads.spec.js', + '**/shopper/my-account-pay-order.spec.js', + '**/shopper/my-account.spec.js', + '**/shopper/order-email-receiving.spec.js', + '**/shopper/product-grouped.spec.js', + '**/shopper/product-simple.spec.js', + '**/shopper/product-tags-attributes.spec.js', + '**/shopper/product-variable.spec.js', + '**/shopper/shop-search-browse-sort.spec.js', + '**/shopper/shop-title-after-deletion.spec.js', ], grepInvert: /@skip-on-default-pressable/, }, diff --git a/plugins/woocommerce/tests/e2e-pw/envs/default-wpcom/playwright.config.js b/plugins/woocommerce/tests/e2e-pw/envs/default-wpcom/playwright.config.js index 179fca7b471..3a566c9a531 100644 --- a/plugins/woocommerce/tests/e2e-pw/envs/default-wpcom/playwright.config.js +++ b/plugins/woocommerce/tests/e2e-pw/envs/default-wpcom/playwright.config.js @@ -7,7 +7,27 @@ config = { { name: 'default wpcom', use: { ...devices[ 'Desktop Chrome' ] }, - testMatch: '**basic.spec.js', + testMatch: [ + '**/basic.spec.js', + '**/shopper/checkout-create-account.spec.js', + '**/shopper/checkout-login.spec.js', + '**/shopper/checkout.spec.js', + '**/shopper/dashboard-access.spec.js', + '**/shopper/mini-cart.spec.js', + '**/shopper/my-account-addresses.spec.js', + '**/shopper/my-account-create-account.spec.js', + '**/shopper/my-account-downloads.spec.js', + '**/shopper/my-account-pay-order.spec.js', + '**/shopper/my-account.spec.js', + '**/shopper/order-email-receiving.spec.js', + '**/shopper/product-grouped.spec.js', + '**/shopper/product-simple.spec.js', + '**/shopper/product-tags-attributes.spec.js', + '**/shopper/product-variable.spec.js', + '**/shopper/shop-search-browse-sort.spec.js', + '**/shopper/shop-title-after-deletion.spec.js', + ], + grepInvert: /@skip-on-default-wpcom/, }, ], }; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/launch-your-store.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/launch-your-store.spec.js index 5f85238a598..5db7a5ebd3b 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/launch-your-store.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/launch-your-store.spec.js @@ -72,43 +72,51 @@ async function runComingSoonTests( themeContext = '' ) { } ); } -test.describe( 'Launch Your Store front end - logged out', () => { - test.afterAll( async ( { baseURL } ) => { - try { - await setOption( - request, - baseURL, - 'woocommerce_coming_soon', - 'no' +test.describe( + 'Launch Your Store front end - logged out', + { tag: [ '@skip-on-default-wpcom', '@skip-on-default-pressable' ] }, + () => { + test.afterAll( async ( { baseURL } ) => { + try { + await setOption( + request, + baseURL, + 'woocommerce_coming_soon', + 'no' + ); + } catch ( error ) { + console.log( error ); + } + } ); + + test.describe( 'Block Theme (Twenty Twenty Four)', () => { + test.beforeAll( async () => { + await activateTheme( 'twentytwentyfour' ); + } ); + + test.afterAll( async () => { + // Reset theme to the default. + await activateTheme( DEFAULT_THEME ); + } ); + + runComingSoonTests( test.step, test.use ); + } ); + + test.describe( 'Classic Theme (Storefront)', () => { + test.beforeAll( async () => { + await activateTheme( 'storefront' ); + } ); + + test.afterAll( async () => { + // Reset theme to the default. + await activateTheme( DEFAULT_THEME ); + } ); + + runComingSoonTests( + test.step, + test.use, + 'Classic Theme (Storefront)' ); - } catch ( error ) { - console.log( error ); - } - } ); - - test.describe( 'Block Theme (Twenty Twenty Four)', () => { - test.beforeAll( async () => { - await activateTheme( 'twentytwentyfour' ); } ); - - test.afterAll( async () => { - // Reset theme to the default. - await activateTheme( DEFAULT_THEME ); - } ); - - runComingSoonTests( test.step, test.use ); - } ); - - test.describe( 'Classic Theme (Storefront)', () => { - test.beforeAll( async () => { - await activateTheme( 'storefront' ); - } ); - - test.afterAll( async () => { - // Reset theme to the default. - await activateTheme( DEFAULT_THEME ); - } ); - - runComingSoonTests( test.step, test.use, 'Classic Theme (Storefront)' ); - } ); -} ); + } +); diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/shop-products-filter-by-price.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/shop-products-filter-by-price.spec.js index 61fd3df02ba..ddf1a2d4735 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/shop-products-filter-by-price.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/shop-products-filter-by-price.spec.js @@ -24,7 +24,14 @@ const test = baseTest.extend( { test.describe( 'Filter items in the shop by product price', - { tag: [ '@payments', '@services' ] }, + { + tag: [ + '@payments', + '@services', + '@skip-on-default-wpcom', + '@skip-on-default-pressable', + ], + }, () => { test.beforeAll( async ( { api } ) => { // add products diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/shop-title-after-deletion.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/shop-title-after-deletion.spec.js index 5c361b1ed50..f0b75c15854 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/shop-title-after-deletion.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/shop-title-after-deletion.spec.js @@ -30,6 +30,18 @@ test.describe( await page .getByText( '1 page restored from the Trash.' ) .waitFor( { state: 'visible' } ); + await page.goto( 'wp-admin/edit.php?post_type=page' ); + await page.getByRole( 'cell', { name: '“Shop” (Edit)' } ).hover(); + await page + .getByLabel( 'Quick edit “Shop” inline' ) + .click( { force: true } ); + await page + .getByLabel( 'Status Published Pending' ) + .selectOption( 'publish', { exact: true } ); + await page.getByRole( 'button', { name: 'Update' } ).click(); + await page + .locator( '#a11y-speak-polite', { hasText: 'Changes saved.' } ) + .waitFor(); } ); test( 'Check the title of the shop page after the page has been deleted', async ( { diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/wordpress-post.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/wordpress-post.spec.js index fd6f46e0497..a9a3407d06f 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/wordpress-post.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/wordpress-post.spec.js @@ -6,7 +6,13 @@ const test = baseTest.extend( { test( 'logged-in customer can comment on a post', - { tag: [ '@non-critical' ] }, + { + tag: [ + '@non-critical', + '@skip-on-default-wpcom', + '@skip-on-default-pressable', + ], + }, async ( { page } ) => { await page.goto( 'hello-world/' ); await expect( diff --git a/plugins/woocommerce/tests/e2e-pw/utils/editor.js b/plugins/woocommerce/tests/e2e-pw/utils/editor.js index d2cf9d6dfe3..c837a59594e 100644 --- a/plugins/woocommerce/tests/e2e-pw/utils/editor.js +++ b/plugins/woocommerce/tests/e2e-pw/utils/editor.js @@ -45,6 +45,7 @@ const goToPageEditor = async ( { page } ) => { ); await page.goto( 'wp-admin/post-new.php?post_type=page' ); await disableWelcomeModal( { page } ); + await closeChoosePatternModal( { page } ); await responsePromise; };