Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix e2e tests: Update default behavior to use a block-based cart and checkout. #387

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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