From 3f578e13611e39adba86f31c4690c200a6c438b3 Mon Sep 17 00:00:00 2001 From: Nadir Seghir Date: Thu, 19 Oct 2023 18:44:29 +0200 Subject: [PATCH] add tests --- ...k-shipping.block_theme.side_effects.spec.ts | 18 +++++++++++++++++- tests/e2e/tests/checkout/checkout.page.ts | 8 ++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/e2e/tests/checkout/checkout-block-shipping.block_theme.side_effects.spec.ts b/tests/e2e/tests/checkout/checkout-block-shipping.block_theme.side_effects.spec.ts index 3374a03246f..b855a0ccc91 100644 --- a/tests/e2e/tests/checkout/checkout-block-shipping.block_theme.side_effects.spec.ts +++ b/tests/e2e/tests/checkout/checkout-block-shipping.block_theme.side_effects.spec.ts @@ -57,7 +57,23 @@ test.describe( 'Shopper → Checkout block → Shipping', () => { FLAT_RATE_SHIPPING_PRICE ) ).toBe( true ); - await page.getByLabel( 'Use same address for billing' ).uncheck(); + + await pageObject.syncBillingWithShipping(); + await pageObject.fillInCheckoutWithTestData( { + phone: '0987654322', + } ); + await pageObject.unsyncBillingWithShipping(); + const shippingForm = page.getByRole( 'group', { + name: 'Shipping address', + } ); + const billingForm = page.getByRole( 'group', { + name: 'Billing address', + } ); + + await expect( shippingForm.getByLabel( 'Phone' ).inputValue ).toEqual( + billingForm.getByLabel( 'Phone' ).inputValue + ); + await pageObject.fillInCheckoutWithTestData(); const overrideBillingDetails = { firstname: 'Juan', diff --git a/tests/e2e/tests/checkout/checkout.page.ts b/tests/e2e/tests/checkout/checkout.page.ts index 52990872a41..0f035125a07 100644 --- a/tests/e2e/tests/checkout/checkout.page.ts +++ b/tests/e2e/tests/checkout/checkout.page.ts @@ -332,6 +332,14 @@ export class CheckoutPage { } } + async syncBillingWithShipping() { + await this.page.getByLabel( 'Use same address for billing' ).check(); + } + + async unsyncBillingWithShipping() { + await this.page.getByLabel( 'Use same address for billing' ).uncheck(); + } + getOrderId() { // Get the current URL const url = this.page.url();