2022-09-09 11:31:55 +00:00
|
|
|
/* eslint-disable playwright/no-skipped-test */
|
2022-09-02 02:00:48 +00:00
|
|
|
import { expect } from "@playwright/test";
|
2022-03-24 17:45:56 +00:00
|
|
|
|
2022-09-02 02:00:48 +00:00
|
|
|
import { test } from "./lib/fixtures";
|
2021-12-15 16:25:49 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
test.describe.configure({ mode: "serial" });
|
2022-09-06 22:58:16 +00:00
|
|
|
|
2022-09-02 02:00:48 +00:00
|
|
|
test.describe("Onboarding", () => {
|
2022-09-06 22:58:16 +00:00
|
|
|
test.describe("Onboarding v2", () => {
|
2022-09-09 11:31:55 +00:00
|
|
|
test("Onboarding Flow", async ({ page, users }) => {
|
2022-12-08 23:20:24 +00:00
|
|
|
const user = await users.create({ completedOnboarding: false, name: null });
|
2022-09-06 22:58:16 +00:00
|
|
|
await user.login();
|
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
// tests whether the user makes it to /getting-started
|
|
|
|
// after login with completedOnboarding false
|
|
|
|
await page.waitForURL("/getting-started");
|
2022-09-06 22:58:16 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
await test.step("step 1", async () => {
|
|
|
|
// Check required fields
|
|
|
|
await page.locator("button[type=submit]").click();
|
|
|
|
await expect(page.locator("data-testid=required")).toBeVisible();
|
2022-09-06 22:58:16 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
// happy path
|
|
|
|
await page.locator("input[name=username]").fill("new user onboarding");
|
|
|
|
await page.locator("input[name=name]").fill("new user 2");
|
|
|
|
await page.locator("input[role=combobox]").click();
|
2023-02-08 12:08:00 +00:00
|
|
|
await page.locator("text=Europe/London GMT +0:00").click();
|
2022-09-06 22:58:16 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
await page.locator("button[type=submit]").click();
|
2022-09-06 22:58:16 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
// should be on step 2 now.
|
|
|
|
await expect(page).toHaveURL(/.*connected-calendar/);
|
2022-09-06 22:58:16 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
const userComplete = await user.self();
|
|
|
|
expect(userComplete.name).toBe("new user 2");
|
|
|
|
});
|
2022-09-06 22:58:16 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
await test.step("step 2", async () => {
|
|
|
|
const isDisabled = await page.locator("button[data-testid=save-calendar-button]").isDisabled();
|
|
|
|
await expect(isDisabled).toBe(true);
|
|
|
|
// tests skip button, we don't want to test entire flow.
|
|
|
|
await page.locator("button[data-testid=skip-step]").click();
|
2022-09-06 22:58:16 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
await expect(page).toHaveURL(/.*setup-availability/);
|
2022-09-06 22:58:16 +00:00
|
|
|
});
|
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
await test.step("step 3", async () => {
|
|
|
|
const isDisabled = await page.locator("button[data-testid=save-availability]").isDisabled();
|
|
|
|
await expect(isDisabled).toBe(false);
|
|
|
|
// same here, skip this step.
|
2023-01-31 18:50:06 +00:00
|
|
|
await page.locator("button[data-testid=save-availability]").click();
|
2022-03-24 17:45:56 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
await expect(page).toHaveURL(/.*user-profile/);
|
|
|
|
});
|
2022-09-06 22:58:16 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
await test.step("step 4", async () => {
|
2023-01-25 01:08:10 +00:00
|
|
|
await page.locator("button[type=submit]").click();
|
2022-09-06 22:58:16 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
// should redirect to /event-types after onboarding
|
|
|
|
await page.waitForURL("/event-types");
|
2022-09-06 22:58:16 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
const userComplete = await user.self();
|
2023-01-25 01:08:10 +00:00
|
|
|
|
|
|
|
const userCompleteBio = userComplete.bio ? userComplete.bio : "";
|
|
|
|
|
|
|
|
expect(userCompleteBio.replace("<p><br></p>", "").length).toBe(0);
|
2022-09-09 11:31:55 +00:00
|
|
|
});
|
2022-03-24 17:45:56 +00:00
|
|
|
});
|
|
|
|
});
|
2021-11-08 14:10:02 +00:00
|
|
|
});
|