feat: atoms e2e tests (#23273)
* e2e tests for availability settings atom * init tests for booking page * add data test id for event type card * update tests for booking page * add data test ids for playwright tests * update test coverage for booking page
This commit is contained in:
1 parent
f4944a05c9
commit
d9adb6c1fc
4 files changed
+109
-2
No files matched your search
+60
@@ -0,0 +1,60 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
import type { Page } from "@playwright/test";
|
||||
|
||||
async function selectOption(page: Page, optionNumber: number) {
|
||||
for (let i = 0; i < optionNumber; i++) {
|
||||
await page.keyboard.press("ArrowDown");
|
||||
}
|
||||
await page.keyboard.press("Enter");
|
||||
}
|
||||
|
||||
test("availability page loads with all components", async ({ page }) => {
|
||||
await page.goto("/availability");
|
||||
|
||||
await expect(page).toHaveURL("/availability");
|
||||
|
||||
await expect(page.locator('h1:has-text("Availability Settings")')).toBeVisible();
|
||||
|
||||
await expect(page.locator('button:has-text("Validate Form")')).toBeVisible();
|
||||
|
||||
await expect(page.locator('button:has-text("Submit Form")')).toBeVisible();
|
||||
|
||||
await expect(page.locator('[data-testid="Monday"]')).toBeVisible();
|
||||
await expect(page.locator('[data-testid="Tuesday"]')).toBeVisible();
|
||||
await expect(page.locator('[data-testid="Wednesday"]')).toBeVisible();
|
||||
await expect(page.locator('[data-testid="Thursday"]')).toBeVisible();
|
||||
await expect(page.locator('[data-testid="Friday"]')).toBeVisible();
|
||||
await expect(page.locator('[data-testid="Saturday"]')).toBeVisible();
|
||||
await expect(page.locator('[data-testid="Sunday"]')).toBeVisible();
|
||||
|
||||
await page.locator('[data-testid="Sunday-switch"]').click();
|
||||
await page.locator('[data-testid="Monday-switch"]').click();
|
||||
await page.locator('[data-testid="Thursday-switch"]').click();
|
||||
|
||||
await page.locator('[data-testid="Wednesday"] [data-testid="select-control"] div').first().click();
|
||||
|
||||
await selectOption(page, 5);
|
||||
|
||||
await page.locator('[data-testid="Wednesday"] [data-testid="select-control"] div').last().click();
|
||||
await selectOption(page, 7);
|
||||
|
||||
await page.locator('[data-testid="Friday"] [data-testid="select-control"] div').first().click();
|
||||
await selectOption(page, 3);
|
||||
|
||||
await page.locator('[data-testid="Friday"] [data-testid="select-control"] div').last().click();
|
||||
await selectOption(page, 10);
|
||||
|
||||
await page.locator('[data-testid="Friday"] [data-testid="add-time-availability"]').click();
|
||||
|
||||
await page.locator('[data-testid="timezone-select"] div').first().click();
|
||||
|
||||
await selectOption(page, 10);
|
||||
|
||||
await page.locator('[data-testid="add-override"]').click();
|
||||
await page.locator('[data-testid="day"]:not([data-disabled="true"])').first().click();
|
||||
await page.locator('[data-testid="add-override-submit-btn"]').click();
|
||||
|
||||
await page.locator('[data-testid="dialog-rejection"]').click();
|
||||
|
||||
await page.locator('button[form="availability-form"]').click();
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
import type { Page } from "@playwright/test";
|
||||
|
||||
async function selectOption(page: Page, optionNumber: number) {
|
||||
for (let i = 0; i < optionNumber; i++) {
|
||||
await page.keyboard.press("ArrowDown");
|
||||
}
|
||||
await page.keyboard.press("Enter");
|
||||
}
|
||||
|
||||
test("tweak availability using AvailabilitySettings Atom", async ({ page }) => {
|
||||
await page.goto("/booking");
|
||||
|
||||
await expect(page).toHaveURL("/booking");
|
||||
|
||||
await expect(page.locator("body")).toBeVisible();
|
||||
|
||||
await expect(page.locator('[data-testid="event-type-card"]').first()).toBeVisible();
|
||||
await page.locator('[data-testid="event-type-card"]').first().click();
|
||||
|
||||
await expect(page.locator('[data-testid="booker-container"]')).toBeVisible();
|
||||
|
||||
await page.locator('[data-testid="day"]:not([data-disabled="true"])').first().click();
|
||||
await page.locator('[data-testid="time"]:not([data-disabled="true"])').first().click();
|
||||
await page.locator('[data-testid="back"]').first().click();
|
||||
|
||||
await page.locator('[data-testid="event-meta-current-timezone"]').first().click();
|
||||
await selectOption(page, 7);
|
||||
|
||||
await page.locator('[data-testid="day"]:not([data-disabled="true"])').first().click();
|
||||
await page.locator('[data-testid="time"]:not([data-disabled="true"])').first().click();
|
||||
await page.locator('[data-testid="add-guests"]').click();
|
||||
await expect(page.locator('[data-testid="input-field"]')).toBeVisible();
|
||||
await page.locator('[data-testid="input-field"]').fill("[email protected]");
|
||||
await page.locator('[data-testid="confirm-book-button"]').click();
|
||||
|
||||
await expect(page.locator('[data-testid="booking-success-page"]')).toBeVisible();
|
||||
await expect(page.locator('[data-testid="booking-success-message"]')).toBeVisible();
|
||||
await expect(page.locator('[data-testid="booking-success-message"]')).toContainText(
|
||||
"This meeting is scheduled"
|
||||
);
|
||||
await expect(page.locator('[data-testid="booking-redirect-or-cancel-links"]')).toBeVisible();
|
||||
});
|
||||
Reference in new issue
Block a user