diff --git a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/cart-checkout-payments.test.js b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/cart-checkout-payments.test.js index d5930c3b4e1..0eeae0f9c1f 100644 --- a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/cart-checkout-payments.test.js +++ b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/cart-checkout-payments.test.js @@ -2,7 +2,7 @@ * Internal dependencies */ import { shopper } from '../../../utils'; -import { SIMPLE_PRODUCT_NAME } from '../../../utils/constants'; +import { SIMPLE_VIRTUAL_PRODUCT_NAME } from '../../../utils/constants'; if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 ) { // eslint-disable-next-line jest/no-focused-tests @@ -12,7 +12,7 @@ if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 ) { describe( 'Shopper → Cart/Checkout → Can use express checkout', () => { it( 'Express Payment button is available on both Cart & Checkout pages', async () => { await shopper.goToShop(); - await shopper.addToCartFromShopPage( SIMPLE_PRODUCT_NAME ); + await shopper.addToCartFromShopPage( SIMPLE_VIRTUAL_PRODUCT_NAME ); await shopper.block.goToCart(); await shopper.block.mockExpressPaymentMethod(); // We need to re-render the cart for the express payments block to be updated, diff --git a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/cart-checkout-translations.test.js b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/cart-checkout-translations.test.js index 4316b5563b0..9cdb53347ed 100644 --- a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/cart-checkout-translations.test.js +++ b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/cart-checkout-translations.test.js @@ -46,24 +46,31 @@ describe( 'Shopper → Cart → Can view translated cart & checkout blocks', () await shopper.goToShop(); await shopper.addToCartFromShopPage( '128GB USB Stick' ); await shopper.block.goToCart(); - const productHeader = await page.$( + + await page.waitForSelector( '.wp-block-woocommerce-filled-cart-block' ); + + const productHeader = await page.waitForSelector( '.wc-block-cart-items .wc-block-cart-items__header span' ); - await expect( productHeader ).toMatch( 'Produit', { timeout: 2000 } ); + await expect( productHeader ).toMatch( 'Produit' ); - const removeLink = await page.$( '.wc-block-cart-item__remove-link' ); + const removeLink = await page.waitForSelector( + '.wc-block-cart-item__remove-link' + ); await expect( removeLink ).toMatch( 'Retirer l’élément' ); - const submitButton = await page.$( '.wc-block-cart__submit-button' ); + const submitButton = await page.waitForSelector( + '.wc-block-cart__submit-button' + ); await expect( submitButton ).toMatch( 'Procéder au paiement' ); const orderSummary = await page.$( '.wp-block-woocommerce-cart-order-summary-block' ); + await expect( orderSummary ).toMatch( 'Total panier' ); await expect( orderSummary ).toMatch( 'Sous-total' ); await expect( orderSummary ).toMatch( 'Coupon code' ); - await expect( orderSummary ).toMatch( 'Appliquer un code promo' ); } ); it( 'should be able to view translated Checkout block', async () => { @@ -72,9 +79,7 @@ describe( 'Shopper → Cart → Can view translated cart & checkout blocks', () const contactHeading = await page.$( '#contact-fields .wc-block-components-checkout-step__title' ); - await expect( contactHeading ).toMatch( 'Coordonnées', { - timeout: 2000, - } ); + await expect( contactHeading ).toMatch( 'Coordonnées' ); const shippingHeading = await page.$( '#shipping-fields .wc-block-components-checkout-step__title' diff --git a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/checkout-different-addresses.test.js b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/checkout-different-addresses.test.js index 20e01865248..1ff62ac88f5 100644 --- a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/checkout-different-addresses.test.js +++ b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/checkout-different-addresses.test.js @@ -23,8 +23,11 @@ import { reactivateCompatibilityNotice, } from '../../../utils'; -import { BILLING_DETAILS, SHIPPING_DETAILS } from '../../../utils/constants'; -const SIMPLE_PRODUCT_NAME = '128GB USB Stick'; +import { + BILLING_DETAILS, + SHIPPING_DETAILS, + SIMPLE_PHYSICAL_PRODUCT_NAME, +} from '../../../utils/constants'; if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 ) // eslint-disable-next-line jest/no-focused-tests @@ -71,7 +74,7 @@ describe( 'Shopper → Checkout → Can have different shipping and billing addr it( 'allows customer to have different shipping and billing addresses', async () => { await shopper.goToShop(); - await shopper.addToCartFromShopPage( SIMPLE_PRODUCT_NAME ); + await shopper.addToCartFromShopPage( SIMPLE_PHYSICAL_PRODUCT_NAME ); await shopper.block.goToCheckout(); await unsetCheckbox( '#checkbox-control-0' ); await shopper.block.fillShippingDetails( SHIPPING_DETAILS ); diff --git a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/checkout-form-warnings.test.js b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/checkout-form-warnings.test.js index 237265b256e..866bb7d1073 100644 --- a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/checkout-form-warnings.test.js +++ b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/checkout-form-warnings.test.js @@ -3,7 +3,7 @@ */ import { shopper } from '../../../utils'; import { - SIMPLE_PRODUCT_NAME, + SIMPLE_VIRTUAL_PRODUCT_NAME, CUSTOMER_USERNAME, CUSTOMER_PASSWORD, } from '../../../utils/constants'; @@ -48,7 +48,7 @@ describe( 'Shopper → Checkout → Can see warnings when form is incomplete', ( it( 'Shows warnings when form is incomplete', async () => { await shopper.goToShop(); - await shopper.addToCartFromShopPage( SIMPLE_PRODUCT_NAME ); + await shopper.addToCartFromShopPage( SIMPLE_VIRTUAL_PRODUCT_NAME ); await shopper.block.goToCheckout(); // Click on "Place Order" button diff --git a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/checkout-single-use-coupon.test.js b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/checkout-single-use-coupon.test.js index a1f5bd79776..f950fe29bfe 100644 --- a/plugins/woocommerce-blocks/tests/e2e/specs/shopper/checkout-single-use-coupon.test.js +++ b/plugins/woocommerce-blocks/tests/e2e/specs/shopper/checkout-single-use-coupon.test.js @@ -8,7 +8,7 @@ import { withRestApi } from '@woocommerce/e2e-utils'; */ import { shopper } from '../../../utils'; import { createCoupon } from '../../utils'; -import { SIMPLE_PRODUCT_NAME } from '../../../utils/constants'; +import { SIMPLE_VIRTUAL_PRODUCT_NAME } from '../../../utils/constants'; if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 ) // eslint-disable-next-line jest/no-focused-tests @@ -29,7 +29,7 @@ afterAll( async () => { describe( 'Shopper → Checkout → Can apply single-use coupon once', () => { it( 'allows checkout to apply single-use coupon once', async () => { await shopper.goToShop(); - await shopper.addToCartFromShopPage( SIMPLE_PRODUCT_NAME ); + await shopper.addToCartFromShopPage( SIMPLE_VIRTUAL_PRODUCT_NAME ); await shopper.block.goToCheckout(); await shopper.block.applyCouponFromCheckout( coupon.code ); @@ -63,7 +63,7 @@ describe( 'Shopper → Checkout → Can apply single-use coupon once', () => { it( 'Prevents checkout applying single-use coupon twice', async () => { await shopper.goToShop(); - await shopper.addToCartFromShopPage( SIMPLE_PRODUCT_NAME ); + await shopper.addToCartFromShopPage( SIMPLE_VIRTUAL_PRODUCT_NAME ); await shopper.block.goToCheckout(); await shopper.block.applyCouponFromCheckout( coupon.code ); await expect( page ).toMatch( 'Coupon usage limit has been reached.' );