2021-12-17 16:58:23 +00:00
|
|
|
import { expect, test } from "@playwright/test";
|
2021-10-13 13:26:56 +00:00
|
|
|
|
2021-12-15 16:25:49 +00:00
|
|
|
import { todo } from "./lib/testUtils";
|
2021-10-13 13:26:56 +00:00
|
|
|
|
2021-12-15 16:25:49 +00:00
|
|
|
test.describe("free user", () => {
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
|
|
await page.goto("/free");
|
|
|
|
});
|
|
|
|
test("only one visible event", async ({ page }) => {
|
|
|
|
await expect(page.locator(`[href="/free/30min"]`)).toBeVisible();
|
|
|
|
await expect(page.locator(`[href="/free/60min"]`)).not.toBeVisible();
|
2021-10-13 13:26:56 +00:00
|
|
|
});
|
|
|
|
|
2021-12-15 16:25:49 +00:00
|
|
|
todo("`/free/30min` is bookable");
|
2021-12-13 23:10:10 +00:00
|
|
|
|
2021-12-15 16:25:49 +00:00
|
|
|
todo("`/free/60min` is not bookable");
|
2021-10-13 13:26:56 +00:00
|
|
|
});
|
|
|
|
|
2021-12-15 16:25:49 +00:00
|
|
|
test.describe("pro user", () => {
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
|
|
await page.goto("/pro");
|
|
|
|
});
|
2021-10-13 13:26:56 +00:00
|
|
|
|
2021-12-15 16:25:49 +00:00
|
|
|
test("pro user's page has at least 2 visible events", async ({ page }) => {
|
2021-10-13 13:26:56 +00:00
|
|
|
const $eventTypes = await page.$$("[data-testid=event-types] > *");
|
|
|
|
expect($eventTypes.length).toBeGreaterThanOrEqual(2);
|
|
|
|
});
|
|
|
|
|
2021-12-15 16:25:49 +00:00
|
|
|
test("book an event first day in next month", async ({ page }) => {
|
2021-11-15 15:03:04 +00:00
|
|
|
// Click first event type
|
|
|
|
await page.click('[data-testid="event-type-link"]');
|
|
|
|
// Click [data-testid="incrementMonth"]
|
|
|
|
await page.click('[data-testid="incrementMonth"]');
|
2022-03-02 22:51:46 +00:00
|
|
|
|
|
|
|
// @TODO: Find a better way to make test wait for full month change render to end
|
|
|
|
// so it can click up on the right day, also when resolve remove other todos
|
|
|
|
// Waiting for full month increment
|
|
|
|
await page.waitForTimeout(400);
|
2021-11-15 15:03:04 +00:00
|
|
|
// Click [data-testid="day"]
|
2021-12-02 17:18:17 +00:00
|
|
|
await page.click('[data-testid="day"][data-disabled="false"]');
|
2021-11-15 15:03:04 +00:00
|
|
|
// Click [data-testid="time"]
|
|
|
|
await page.click('[data-testid="time"]');
|
|
|
|
// --- fill form
|
|
|
|
await page.fill('[name="name"]', "Test Testson");
|
|
|
|
await page.fill('[name="email"]', "test@example.com");
|
|
|
|
await page.press('[name="email"]', "Enter");
|
|
|
|
|
|
|
|
// Make sure we're navigated to the success page
|
|
|
|
await page.waitForNavigation({
|
|
|
|
url(url) {
|
|
|
|
return url.pathname.endsWith("/success");
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
2021-12-13 23:10:10 +00:00
|
|
|
|
2021-12-15 16:25:49 +00:00
|
|
|
todo("Can reschedule the recently created booking");
|
2021-12-13 23:10:10 +00:00
|
|
|
|
2021-12-15 16:25:49 +00:00
|
|
|
todo("Can cancel the recently created booking");
|
2021-10-13 13:26:56 +00:00
|
|
|
});
|