From cebdcc61d0d0cc11a2fe6c51c3ed03516dfe23e7 Mon Sep 17 00:00:00 2001 From: Ivan Stojadinov Date: Mon, 16 Sep 2024 13:56:44 +0200 Subject: [PATCH] [e2e] External - Expand WPCOM suite, part 1 (#51303) * Expand WPCOM suite * Skip core-profiler.spec.js on WPCOM - no "Coming soon" * Skip `Analytics-related tests` on WPCOM - different sums * Skip `Marketing Overview page have relevant content` - no content on WPCOM * Payment setup task - make Save button more unique * Include more tests in playwright.config.js * Skip `Store owner can skip the core profiler` * Add changefile(s) from automation for the following project(s): woocommerce * Make "Get paid" more unique --------- Co-authored-by: github-actions --- .../51303-e2e-external-expand-wpcom-suite | 4 ++ .../envs/default-wpcom/playwright.config.js | 4 ++ .../activate-and-setup/core-profiler.spec.js | 4 +- .../admin-analytics/analytics-data.spec.js | 9 ++- .../tests/admin-marketing/overview.spec.js | 68 ++++++++++--------- .../e2e-pw/tests/admin-tasks/payment.spec.js | 4 +- 6 files changed, 56 insertions(+), 37 deletions(-) create mode 100644 plugins/woocommerce/changelog/51303-e2e-external-expand-wpcom-suite diff --git a/plugins/woocommerce/changelog/51303-e2e-external-expand-wpcom-suite b/plugins/woocommerce/changelog/51303-e2e-external-expand-wpcom-suite new file mode 100644 index 00000000000..975d531637f --- /dev/null +++ b/plugins/woocommerce/changelog/51303-e2e-external-expand-wpcom-suite @@ -0,0 +1,4 @@ +Significance: patch +Type: update + +Expand the e2e suite we're running on WPCOM. \ No newline at end of file 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 08977a04e71..276458fa570 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 @@ -9,6 +9,10 @@ config = { use: { ...devices[ 'Desktop Chrome' ] }, testMatch: [ '**/basic.spec.js', + '**/activate-and-setup/**/*.spec.js', + '**/admin-analytics/**/*.spec.js', + '**/admin-marketing/**/*.spec.js', + '**/admin-tasks/**/*.spec.js', '**/shopper/**/*.spec.js', '**/api-tests/**/*.test.js', ], diff --git a/plugins/woocommerce/tests/e2e-pw/tests/activate-and-setup/core-profiler.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/activate-and-setup/core-profiler.spec.js index f0cf8016e40..a4679791f03 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/activate-and-setup/core-profiler.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/activate-and-setup/core-profiler.spec.js @@ -3,7 +3,7 @@ const { setOption } = require( '../../utils/options' ); test.describe( 'Store owner can complete the core profiler', - { tag: '@skip-on-default-pressable' }, + { tag: [ '@skip-on-default-pressable', '@skip-on-default-wpcom' ] }, () => { test.use( { storageState: process.env.ADMINSTATE } ); @@ -450,7 +450,7 @@ test.describe( test.describe( 'Store owner can skip the core profiler', - { tag: '@skip-on-default-pressable' }, + { tag: [ '@skip-on-default-pressable', '@skip-on-default-wpcom' ] }, () => { test.use( { storageState: process.env.ADMINSTATE } ); diff --git a/plugins/woocommerce/tests/e2e-pw/tests/admin-analytics/analytics-data.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/admin-analytics/analytics-data.spec.js index 6cfd1d35fd2..9d8ebd604a9 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/admin-analytics/analytics-data.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/admin-analytics/analytics-data.spec.js @@ -25,7 +25,14 @@ const test = baseTest.extend( { test.describe( 'Analytics-related tests', - { tag: [ '@payments', '@services', '@skip-on-default-pressable' ] }, + { + tag: [ + '@payments', + '@services', + '@skip-on-default-pressable', + '@skip-on-default-wpcom', + ], + }, () => { let categoryIds, productIds, orderIds, setupPage; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/admin-marketing/overview.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/admin-marketing/overview.spec.js index 2ababaf97ec..773f160caf2 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/admin-marketing/overview.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/admin-marketing/overview.spec.js @@ -15,40 +15,44 @@ test.describe( 'Marketing page', () => { ).toBeVisible(); } ); - test( 'Marketing Overview page have relevant content', async ( { - page, - } ) => { - // Go to the Marketing page. - await page.goto( 'wp-admin/admin.php?page=wc-admin&path=%2Fmarketing' ); + test( + 'Marketing Overview page have relevant content', + { tag: '@skip-on-default-wpcom' }, + async ( { page } ) => { + // Go to the Marketing page. + await page.goto( + 'wp-admin/admin.php?page=wc-admin&path=%2Fmarketing' + ); - // Heading should be overview - await expect( - page.getByRole( 'heading', { name: 'Overview' } ) - ).toBeVisible(); + // Heading should be overview + await expect( + page.getByRole( 'heading', { name: 'Overview' } ) + ).toBeVisible(); - // Sections present - await expect( - page.getByText( 'Channels', { exact: true } ) - ).toBeVisible(); - await expect( - page.getByText( 'Discover more marketing tools' ) - ).toBeVisible(); - await expect( - page.getByRole( 'tab', { name: 'Email' } ) - ).toBeVisible(); - await expect( - page.getByRole( 'tab', { name: 'Automations' } ) - ).toBeVisible(); - await expect( - page.getByRole( 'tab', { name: 'Conversion' } ) - ).toBeVisible(); - await expect( - page.getByRole( 'tab', { name: 'CRM', exact: true } ) - ).toBeVisible(); - await expect( - page.getByText( 'Learn about marketing a store' ) - ).toBeVisible(); - } ); + // Sections present + await expect( + page.getByText( 'Channels', { exact: true } ) + ).toBeVisible(); + await expect( + page.getByText( 'Discover more marketing tools' ) + ).toBeVisible(); + await expect( + page.getByRole( 'tab', { name: 'Email' } ) + ).toBeVisible(); + await expect( + page.getByRole( 'tab', { name: 'Automations' } ) + ).toBeVisible(); + await expect( + page.getByRole( 'tab', { name: 'Conversion' } ) + ).toBeVisible(); + await expect( + page.getByRole( 'tab', { name: 'CRM', exact: true } ) + ).toBeVisible(); + await expect( + page.getByText( 'Learn about marketing a store' ) + ).toBeVisible(); + } + ); test( 'Introduction can be dismissed', diff --git a/plugins/woocommerce/tests/e2e-pw/tests/admin-tasks/payment.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/admin-tasks/payment.spec.js index eec70d721a8..035b63be270 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/admin-tasks/payment.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/admin-tasks/payment.spec.js @@ -73,7 +73,7 @@ test.describe( 'Payment setup task', () => { await page .locator( '//input[@placeholder="BIC / Swift"]' ) .fill( 'ABBA' ); - await page.locator( 'text=Save' ).click(); + await page.getByRole( 'button', { name: 'Save' } ).click(); // Check that bank transfers were set up. await expect( @@ -93,7 +93,7 @@ test.describe( 'Payment setup task', () => { page, } ) => { await page.goto( 'wp-admin/admin.php?page=wc-admin' ); - await page.locator( 'text=Get paid' ).click(); + await page.getByRole( 'button', { name: '3 Get paid' } ).click(); await expect( page.locator( '.woocommerce-layout__header-wrapper > h1' ) ).toHaveText( 'Get paid' );