Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
senadir committed Oct 19, 2023
1 parent 45c180b commit 3f578e1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
8 changes: 8 additions & 0 deletions tests/e2e/tests/checkout/checkout.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3f578e1

Please sign in to comment.