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
This commit is contained in:
Seghir Nadir 2024-04-18 17:13:49 +02:00 committed by GitHub
parent 80133578be
commit af53de9aaa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Fix e2e tests

View File

@ -1,5 +1,4 @@
const { test, expect } = require( '@playwright/test' ); const { test, expect } = require( '@playwright/test' );
const { admin } = require( '../../test-data/data' );
const { disableWelcomeModal } = require( '../../utils/editor' ); const { disableWelcomeModal } = require( '../../utils/editor' );
const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
@ -166,6 +165,7 @@ test.describe( 'Cart Block Calculate Shipping', () => {
await context.clearCookies(); await context.clearCookies();
await page.goto( `/shop/?add-to-cart=${ product1Id }` ); await page.goto( `/shop/?add-to-cart=${ product1Id }` );
// eslint-disable-next-line playwright/no-networkidle
await page.waitForLoadState( 'networkidle' ); await page.waitForLoadState( 'networkidle' );
await page.goto( cartBlockPageSlug ); await page.goto( cartBlockPageSlug );
@ -187,9 +187,9 @@ test.describe( 'Cart Block Calculate Shipping', () => {
).toBeVisible(); ).toBeVisible();
await expect( await expect(
page.locator( 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( await expect(
page.locator( page.locator(
'.wc-block-components-totals-footer-item > .wc-block-components-totals-item__value' '.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 context.clearCookies();
await page.goto( `/shop/?add-to-cart=${ product1Id }` ); await page.goto( `/shop/?add-to-cart=${ product1Id }` );
// eslint-disable-next-line playwright/no-networkidle
await page.waitForLoadState( 'networkidle' ); await page.waitForLoadState( 'networkidle' );
await page.goto( cartBlockPageSlug ); await page.goto( cartBlockPageSlug );
@ -265,6 +266,7 @@ test.describe( 'Cart Block Calculate Shipping', () => {
await context.clearCookies(); await context.clearCookies();
await page.goto( `/shop/?add-to-cart=${ product1Id }` ); await page.goto( `/shop/?add-to-cart=${ product1Id }` );
// eslint-disable-next-line playwright/no-networkidle
await page.waitForLoadState( 'networkidle' ); await page.waitForLoadState( 'networkidle' );
await page.goto( cartBlockPageSlug ); await page.goto( cartBlockPageSlug );
@ -307,9 +309,11 @@ test.describe( 'Cart Block Calculate Shipping', () => {
await context.clearCookies(); await context.clearCookies();
await page.goto( `/shop/?add-to-cart=${ product1Id }` ); await page.goto( `/shop/?add-to-cart=${ product1Id }` );
// eslint-disable-next-line playwright/no-networkidle
await page.waitForLoadState( 'networkidle' ); await page.waitForLoadState( 'networkidle' );
await page.goto( `/shop/?add-to-cart=${ product2Id }` ); await page.goto( `/shop/?add-to-cart=${ product2Id }` );
// eslint-disable-next-line playwright/no-networkidle
await page.waitForLoadState( 'networkidle' ); await page.waitForLoadState( 'networkidle' );
await page.goto( cartBlockPageSlug ); await page.goto( cartBlockPageSlug );