From 013cef959e2ef663a9b0837bac6388dfc086f58c Mon Sep 17 00:00:00 2001 From: Ivan Stojadinov Date: Tue, 27 Aug 2024 18:44:56 +0200 Subject: [PATCH] [e2e tests] External sites - update admin-* folders (#50994) * Skip `Introduction can be dismissed` * This part is already covered in `Introduction can be dismissed` * Skip Analytics-related tests since there are already some numbers on Pressable website * Include admin related tests into default-pressable test suite * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions Co-authored-by: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com> --- ...0994-e2e-external-sites-update-admin-tests | 4 ++ .../default-pressable/playwright.config.js | 3 + .../admin-analytics/analytics-data.spec.js | 2 +- .../tests/admin-marketing/overview.spec.js | 69 ++++++++++--------- 4 files changed, 43 insertions(+), 35 deletions(-) create mode 100644 plugins/woocommerce/changelog/50994-e2e-external-sites-update-admin-tests diff --git a/plugins/woocommerce/changelog/50994-e2e-external-sites-update-admin-tests b/plugins/woocommerce/changelog/50994-e2e-external-sites-update-admin-tests new file mode 100644 index 00000000000..4c731ca0240 --- /dev/null +++ b/plugins/woocommerce/changelog/50994-e2e-external-sites-update-admin-tests @@ -0,0 +1,4 @@ +Significance: patch +Type: update + +Update admin-* folders, so e2e tests 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 fe57da38ed9..d0ae4f28382 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 @@ -12,6 +12,9 @@ config = { '**/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', ], grepInvert: /@skip-on-default-pressable/, }, 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 fe893b0808c..6cfd1d35fd2 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,7 @@ const test = baseTest.extend( { test.describe( 'Analytics-related tests', - { tag: [ '@payments', '@services' ] }, + { tag: [ '@payments', '@services', '@skip-on-default-pressable' ] }, () => { 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 cc69f347113..2ababaf97ec 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 @@ -27,11 +27,6 @@ test.describe( 'Marketing page', () => { ).toBeVisible(); // Sections present - await expect( - page.getByText( - 'Reach new customers and increase sales without leaving WooCommerce' - ) - ).toBeVisible(); await expect( page.getByText( 'Channels', { exact: true } ) ).toBeVisible(); @@ -55,38 +50,44 @@ test.describe( 'Marketing page', () => { ).toBeVisible(); } ); - test( 'Introduction can be dismissed', async ( { page } ) => { - // Go to the Marketing page. - await page.goto( 'wp-admin/admin.php?page=wc-admin&path=%2Fmarketing' ); + test( + 'Introduction can be dismissed', + { tag: '@skip-on-default-pressable' }, + async ( { page } ) => { + // Go to the Marketing page. + await page.goto( + 'wp-admin/admin.php?page=wc-admin&path=%2Fmarketing' + ); - // Dismiss the introduction (if it's visible) - try { - await page - .locator( - '.woocommerce-marketing-introduction-banner-illustration > .components-button' + // Dismiss the introduction (if it's visible) + try { + await page + .locator( + '.woocommerce-marketing-introduction-banner-illustration > .components-button' + ) + .click( { timeout: 2000 } ); + } catch ( e ) { + console.log( 'Info: introduction already hidden' ); + } + + // The introduction should be hidden. + await expect( + page.getByText( + 'Reach new customers and increase sales without leaving WooCommerce' ) - .click( { timeout: 2000 } ); - } catch ( e ) { - console.log( 'Info: introduction already hidden' ); + ).toBeHidden(); + + // Refresh the page to make sure the state is saved. + await page.reload(); + + // The introduction should still be hidden. + await expect( + page.getByText( + 'Reach new customers and increase sales without leaving WooCommerce' + ) + ).toBeHidden(); } - - // The introduction should be hidden. - await expect( - page.getByText( - 'Reach new customers and increase sales without leaving WooCommerce' - ) - ).toBeHidden(); - - // Refresh the page to make sure the state is saved. - await page.reload(); - - // The introduction should still be hidden. - await expect( - page.getByText( - 'Reach new customers and increase sales without leaving WooCommerce' - ) - ).toBeHidden(); - } ); + ); test( 'Learning section can be expanded', async ( { page } ) => { // Go to the Dashboard page (this adds time for posts to be created)