From ac7321e5b7cd3188f42610cbd362f7adefd6d5f3 Mon Sep 17 00:00:00 2001 From: "Veljko V." Date: Fri, 27 Sep 2024 22:16:21 +0200 Subject: [PATCH] E2E Fix shopper mini-cart test (#51741) --- .../changelog/e2e-fix-shopper-mini-cart-test | 4 ++++ .../tests/e2e-pw/tests/shopper/mini-cart.spec.js | 6 ++---- plugins/woocommerce/tests/e2e-pw/utils/editor.js | 11 +++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 plugins/woocommerce/changelog/e2e-fix-shopper-mini-cart-test diff --git a/plugins/woocommerce/changelog/e2e-fix-shopper-mini-cart-test b/plugins/woocommerce/changelog/e2e-fix-shopper-mini-cart-test new file mode 100644 index 00000000000..c3f4f41e9f3 --- /dev/null +++ b/plugins/woocommerce/changelog/e2e-fix-shopper-mini-cart-test @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +Fix shopper mini cart test compatibility with external envs diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/mini-cart.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/mini-cart.spec.js index 502c1c2068a..422d1864d5e 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/mini-cart.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/mini-cart.spec.js @@ -1,8 +1,8 @@ const { test, expect } = require( '@playwright/test' ); const { - disableWelcomeModal, openEditorSettings, getCanvas, + goToPageEditor, } = require( '../../utils/editor' ); const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; const { random } = require( '../../utils/helpers' ); @@ -133,9 +133,7 @@ test.describe( const greenColor = '00cc09'; // go to create a new page - await page.goto( 'wp-admin/post-new.php?post_type=page' ); - - await disableWelcomeModal( { page } ); + await goToPageEditor( { page } ); const canvas = await getCanvas( page ); diff --git a/plugins/woocommerce/tests/e2e-pw/utils/editor.js b/plugins/woocommerce/tests/e2e-pw/utils/editor.js index e6be385fc40..b45279e172e 100644 --- a/plugins/woocommerce/tests/e2e-pw/utils/editor.js +++ b/plugins/woocommerce/tests/e2e-pw/utils/editor.js @@ -1,10 +1,13 @@ const { expect } = require( '@playwright/test' ); const closeChoosePatternModal = async ( { page } ) => { - const closeModal = page.getByRole( 'button', { - name: 'Close', - exact: true, - } ); + const closeModal = page + .getByLabel( 'Scrollable section' ) + .filter() + .getByRole( 'button', { + name: 'Close', + exact: true, + } ); await page.addLocatorHandler( closeModal, async () => { await closeModal.click(); } );