2022-05-14 03:02:10 +00:00
|
|
|
import { expect } from "@playwright/test";
|
2022-04-06 17:20:30 +00:00
|
|
|
|
2022-05-14 03:02:10 +00:00
|
|
|
import { test } from "./lib/fixtures";
|
2022-04-06 17:20:30 +00:00
|
|
|
import {
|
|
|
|
bookTimeSlot,
|
|
|
|
selectFirstAvailableTimeSlotNextMonth,
|
|
|
|
selectSecondAvailableTimeSlotNextMonth,
|
|
|
|
} from "./lib/testUtils";
|
|
|
|
|
2023-03-01 20:18:51 +00:00
|
|
|
test.afterEach(({ users }) => users.deleteAll());
|
|
|
|
|
2023-03-02 12:13:55 +00:00
|
|
|
// Due to some reason for Dynamic booking cancellation, daily video api_key is not set which causes cancellation to fail.
|
|
|
|
// This test is skipped until the issue is resolved in GH actions.
|
2023-06-06 11:59:57 +00:00
|
|
|
// eslint-disable-next-line playwright/no-skipped-test
|
2023-03-02 12:13:55 +00:00
|
|
|
test.skip("dynamic booking", async ({ page, users }) => {
|
2022-09-12 20:26:42 +00:00
|
|
|
const pro = await users.create();
|
2023-06-06 18:02:32 +00:00
|
|
|
await pro.apiLogin();
|
2023-03-02 12:13:55 +00:00
|
|
|
|
2022-12-08 23:20:24 +00:00
|
|
|
const free = await users.create({ username: "free" });
|
2022-09-12 20:26:42 +00:00
|
|
|
await page.goto(`/${pro.username}+${free.username}`);
|
2022-05-11 20:36:38 +00:00
|
|
|
|
2022-09-12 20:26:42 +00:00
|
|
|
await test.step("book an event first day in next month", async () => {
|
2022-04-06 17:20:30 +00:00
|
|
|
// Click first event type
|
|
|
|
await page.click('[data-testid="event-type-link"]');
|
|
|
|
await selectFirstAvailableTimeSlotNextMonth(page);
|
|
|
|
await bookTimeSlot(page);
|
2022-05-11 04:46:22 +00:00
|
|
|
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
2022-04-06 17:20:30 +00:00
|
|
|
});
|
|
|
|
|
2022-09-12 20:26:42 +00:00
|
|
|
await test.step("can reschedule a booking", async () => {
|
2022-04-06 17:20:30 +00:00
|
|
|
// Logged in
|
|
|
|
await page.goto("/bookings/upcoming");
|
2022-05-27 23:27:41 +00:00
|
|
|
await page.locator('[data-testid="edit_booking"]').nth(0).click();
|
|
|
|
await page.locator('[data-testid="reschedule"]').click();
|
2023-05-02 16:58:39 +00:00
|
|
|
await page.waitForURL((url) => {
|
|
|
|
const bookingId = url.searchParams.get("rescheduleUid");
|
|
|
|
return !!bookingId;
|
2022-04-06 17:20:30 +00:00
|
|
|
});
|
|
|
|
await selectSecondAvailableTimeSlotNextMonth(page);
|
|
|
|
// --- fill form
|
|
|
|
await page.locator('[data-testid="confirm-reschedule-button"]').click();
|
2023-05-02 16:58:39 +00:00
|
|
|
await page.waitForURL((url) => {
|
|
|
|
return url.pathname.startsWith("/booking");
|
2022-04-06 17:20:30 +00:00
|
|
|
});
|
2022-05-11 04:46:22 +00:00
|
|
|
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
2022-04-06 17:20:30 +00:00
|
|
|
});
|
|
|
|
|
2022-09-12 20:26:42 +00:00
|
|
|
await test.step("Can cancel the recently created booking", async () => {
|
2022-04-06 17:20:30 +00:00
|
|
|
await page.goto("/bookings/upcoming");
|
2023-06-10 03:47:50 +00:00
|
|
|
await page.locator('[data-testid="cancel"]').click();
|
2023-05-02 16:58:39 +00:00
|
|
|
await page.waitForURL((url) => {
|
|
|
|
return url.pathname.startsWith("/booking");
|
2022-04-06 17:20:30 +00:00
|
|
|
});
|
2023-06-10 03:47:50 +00:00
|
|
|
await page.locator('[data-testid="confirm_cancel"]').click();
|
2022-11-25 14:49:59 +00:00
|
|
|
|
2023-06-10 03:47:50 +00:00
|
|
|
const cancelledHeadline = page.locator('[data-testid="cancelled-headline"]');
|
|
|
|
await expect(cancelledHeadline).toBeVisible();
|
2022-04-06 17:20:30 +00:00
|
|
|
});
|
|
|
|
});
|