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();
|
|
|
|
await page.locator("text=Eastern Time").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.
|
|
|
|
await page.locator("button[data-testid=skip-step]").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 () => {
|
|
|
|
const finishButton = await page.locator("button[type=submit]");
|
|
|
|
// bio field is required, try to submit (and test whether that fails)
|
|
|
|
await finishButton.click();
|
2022-09-06 22:58:16 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
const requiredBio = await page.locator("data-testid=required");
|
|
|
|
await expect(requiredBio).toBeVisible();
|
2022-03-24 17:45:56 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
await page.locator("textarea[name=bio]").fill("Something about me");
|
2022-09-06 22:58:16 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
const isDisabled = await finishButton.isDisabled();
|
|
|
|
await expect(isDisabled).toBe(false);
|
2022-09-07 01:34:33 +00:00
|
|
|
|
2022-09-09 11:31:55 +00:00
|
|
|
await finishButton.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();
|
|
|
|
expect(userComplete.bio).toBe("Something about me");
|
|
|
|
});
|
2022-03-24 17:45:56 +00:00
|
|
|
});
|
|
|
|
});
|
2021-11-08 14:10:02 +00:00
|
|
|
});
|