From d9bcf83bf03440ab422422be3d2c1e3c1bf6ab33 Mon Sep 17 00:00:00 2001 From: Veljko V Date: Thu, 23 May 2024 20:49:44 +0200 Subject: [PATCH] Fix E2E shopper mini cart test (#47756) Fix mini cart e2e test --- .../changelog/e2e-fix-skipped-mini-cart-test | 4 ++++ .../e2e-pw/tests/shopper/mini-cart.spec.js | 17 +++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 plugins/woocommerce/changelog/e2e-fix-skipped-mini-cart-test diff --git a/plugins/woocommerce/changelog/e2e-fix-skipped-mini-cart-test b/plugins/woocommerce/changelog/e2e-fix-skipped-mini-cart-test new file mode 100644 index 00000000000..4db74363691 --- /dev/null +++ b/plugins/woocommerce/changelog/e2e-fix-skipped-mini-cart-test @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +E2E tests: fixing skipped mini cart test 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 e64fb431b56..3758d6274a2 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 @@ -16,7 +16,7 @@ const totalInclusiveTax = +singleProductSalePrice + 5 + 2.5; let productId, countryTaxId, stateTaxId, shippingZoneId; -test.describe.skip( 'Mini Cart block page', () => { +test.describe( 'Mini Cart block page', () => { test.use( { storageState: process.env.ADMINSTATE } ); test.beforeAll( async ( { baseURL } ) => { @@ -176,9 +176,11 @@ test.describe.skip( 'Mini Cart block page', () => { // customize font size and weight await page.getByLabel( 'Large', { exact: true } ).click(); await page.getByRole( 'button', { name: 'Font weight' } ).click(); - await page - .getByRole( 'option', { name: 'Black', exact: true } ) - .click(); + // choose Light via kb press due to encountered issue with normal click + await page.keyboard.press( 'ArrowDown' ); + await page.keyboard.press( 'ArrowDown' ); + await page.keyboard.press( 'ArrowDown' ); + await page.keyboard.press( 'Enter' ); // publish created mini cart page await page @@ -215,7 +217,7 @@ test.describe.skip( 'Mini Cart block page', () => { ); await expect( page.locator( miniCartBlock ) ).toHaveAttribute( 'data-style', - '{"typography":{"fontWeight":"900"}}' + '{"typography":{"fontWeight":"300"}}' ); await page.locator( miniCartButton ).click(); await expect( @@ -280,9 +282,8 @@ test.describe.skip( 'Mini Cart block page', () => { await page.goto( miniCartPageSlug ); await page.locator( miniCartButton ).click(); await page.getByRole( 'link', { name: 'Go to checkout' } ).click(); - await expect( - page.getByRole( 'heading', { name: 'Checkout', exact: true } ) - ).toBeVisible(); + await expect( page.url() ).toContain( '/checkout' ); + await expect( page.getByText( 'Place order' ) ).toBeVisible(); await expect( page.locator( miniCartButton ) ).toBeHidden(); // shopping cart is very sensitive to cookies, so be explicit