From af53de9aaa1e7f0dbb7da04020e3aaf79da09271 Mon Sep 17 00:00:00 2001 From: Seghir Nadir Date: Thu, 18 Apr 2024 17:13:49 +0200 Subject: [PATCH] Fix E2E search string for Cart block shipping tests (#46720) * Fix E2E search string for Cart block shipping tests * add changelog * update to uppercase * fix test * fix test one last time * fix lint --- .../woocommerce/changelog/fix-e2e-tests-for-shipping | 5 +++++ .../shopper/cart-block-calculate-shipping.spec.js | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 plugins/woocommerce/changelog/fix-e2e-tests-for-shipping diff --git a/plugins/woocommerce/changelog/fix-e2e-tests-for-shipping b/plugins/woocommerce/changelog/fix-e2e-tests-for-shipping new file mode 100644 index 00000000000..4651fb17a6f --- /dev/null +++ b/plugins/woocommerce/changelog/fix-e2e-tests-for-shipping @@ -0,0 +1,5 @@ +Significance: patch +Type: fix +Comment: Fix e2e tests + + diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block-calculate-shipping.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block-calculate-shipping.spec.js index 1a519e17cde..eef5a99252e 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block-calculate-shipping.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block-calculate-shipping.spec.js @@ -1,5 +1,4 @@ const { test, expect } = require( '@playwright/test' ); -const { admin } = require( '../../test-data/data' ); const { disableWelcomeModal } = require( '../../utils/editor' ); const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; @@ -166,6 +165,7 @@ test.describe( 'Cart Block Calculate Shipping', () => { await context.clearCookies(); await page.goto( `/shop/?add-to-cart=${ product1Id }` ); + // eslint-disable-next-line playwright/no-networkidle await page.waitForLoadState( 'networkidle' ); await page.goto( cartBlockPageSlug ); @@ -187,9 +187,9 @@ test.describe( 'Cart Block Calculate Shipping', () => { ).toBeVisible(); await expect( page.locator( - '.wc-block-components-radio-control__description > .wc-block-components-formatted-money-amount' + '.wc-block-components-radio-control__description > .wc-block-components-shipping-rates-control__package__description--free' ) - ).toContainText( '$0.00' ); + ).toContainText( 'Free' ); await expect( page.locator( '.wc-block-components-totals-footer-item > .wc-block-components-totals-item__value' @@ -204,6 +204,7 @@ test.describe( 'Cart Block Calculate Shipping', () => { await context.clearCookies(); await page.goto( `/shop/?add-to-cart=${ product1Id }` ); + // eslint-disable-next-line playwright/no-networkidle await page.waitForLoadState( 'networkidle' ); await page.goto( cartBlockPageSlug ); @@ -265,6 +266,7 @@ test.describe( 'Cart Block Calculate Shipping', () => { await context.clearCookies(); await page.goto( `/shop/?add-to-cart=${ product1Id }` ); + // eslint-disable-next-line playwright/no-networkidle await page.waitForLoadState( 'networkidle' ); await page.goto( cartBlockPageSlug ); @@ -307,9 +309,11 @@ test.describe( 'Cart Block Calculate Shipping', () => { await context.clearCookies(); await page.goto( `/shop/?add-to-cart=${ product1Id }` ); + // eslint-disable-next-line playwright/no-networkidle await page.waitForLoadState( 'networkidle' ); await page.goto( `/shop/?add-to-cart=${ product2Id }` ); + // eslint-disable-next-line playwright/no-networkidle await page.waitForLoadState( 'networkidle' ); await page.goto( cartBlockPageSlug );