Skip to content

Commit

Permalink
Fix e2e tests: Update default behavior to use a block-based cart and …
Browse files Browse the repository at this point in the history
…checkout.
  • Loading branch information
iamdharmesh committed Nov 9, 2023
1 parent 3e7f543 commit 290597c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
32 changes: 24 additions & 8 deletions tests/e2e/specs/order.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,40 @@ test.describe('Order Tests', () => {
// Verify Check-In and Check-Out Date and Time Display on Cart Page.
await page.goto('/cart');
await expect(
page.locator('dl.variation dd.variation-Check-in p').first()
page
.locator(
'.wc-block-components-product-details__check-in .wc-block-components-product-details__value'
)
.first()
).toContainText(checkInTime);
await expect(
page.locator('dl.variation dd.variation-Check-out p').first()
page
.locator(
'.wc-block-components-product-details__check-out .wc-block-components-product-details__value'
)
.first()
).toContainText(checkOutTime);

// Verify Check-In and Check-Out Date and Time Display on Checkout Page.
await page.goto('/checkout');
await expect(
page.locator('dl.variation dd.variation-Check-in p').first()
page
.locator(
'.wc-block-components-product-details__check-in .wc-block-components-product-details__value'
)
.first()
).toContainText(checkInTime);
await expect(
page.locator('dl.variation dd.variation-Check-out p').first()
page
.locator(
'.wc-block-components-product-details__check-out .wc-block-components-product-details__value'
)
.first()
).toContainText(checkOutTime);

// Verify Check-In and Check-Out Date and Time Display on Order Received Page.
await fillBillingDetails(page, customer.billing);
await placeOrder(page);
await fillBillingDetails(page, customer.billing, true);
await placeOrder(page, true);
await expect(
page
.locator('ul.wc-booking-summary-list .booking-start-date')
Expand Down Expand Up @@ -130,8 +146,8 @@ test.describe('Order Tests', () => {

// Place order and verify booking details in confirmation email.
await page.goto('/checkout');
await fillBillingDetails(page, customer.billing);
const orderId = await placeOrder(page);
await fillBillingDetails(page, customer.billing, true);
const orderId = await placeOrder(page, true);
await api.update.order({
id: orderId,
status: 'completed',
Expand Down
20 changes: 12 additions & 8 deletions tests/e2e/specs/product.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,15 @@ test.describe('Product Tests', () => {

// Verify Accommodation Booking Process for Slot Requiring Confirmation
await page.goto('/checkout');
await expect(page.locator('#place_order')).toContainText(
'Request Confirmation'
);
await fillBillingDetails(page, customer.billing);
await placeOrder(page);
await expect(
page.locator(
'button.wc-block-components-checkout-place-order-button'
)
).toContainText('Request Confirmation');
await fillBillingDetails(page, customer.billing, true);
await page
.locator('button.wc-block-components-checkout-place-order-button')
.click();
await expect(
page
.locator('.wc-booking-summary .status-pending-confirmation')
Expand All @@ -275,8 +279,8 @@ test.describe('Product Tests', () => {

// Place order
await page.goto('/checkout');
await fillBillingDetails(page, customer.billing);
const orderId = await placeOrder(page);
await fillBillingDetails(page, customer.billing, true);
const orderId = await placeOrder(page, true);

page.goto('/my-account/bookings/');
page.on('dialog', (dialog) => dialog.accept());
Expand All @@ -288,7 +292,7 @@ test.describe('Product Tests', () => {
.click();

await expect(
page.locator('.woocommerce .woocommerce-info').first()
page.locator('.wc-block-components-notice-banner.is-info').first()
).toContainText('Your booking was cancelled');
});

Expand Down

0 comments on commit 290597c

Please sign in to comment.