feat: remove 2 steps from the onboarding flow for google signups (#17787)
This commit is contained in:
1 parent
a926e0b9d6
commit
046042a877
7 files changed
+170
-126
No files matched your search
@@ -880,7 +880,8 @@ type CustomUserOptsKeys =
|
||||
| "organizationId"
|
||||
| "twoFactorEnabled"
|
||||
| "disableImpersonation"
|
||||
| "role";
|
||||
| "role"
|
||||
| "identityProvider";
|
||||
type CustomUserOpts = Partial<Pick<Prisma.User, CustomUserOptsKeys>> & {
|
||||
timeZone?: TimeZoneEnum;
|
||||
eventTypes?: SupportedTestEventTypes[];
|
||||
@@ -946,6 +947,7 @@ const createUser = (
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
identityProvider: opts?.identityProvider,
|
||||
};
|
||||
|
||||
function getOrganizationRelatedProps({
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/* eslint-disable playwright/no-skipped-test */
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import { IdentityProvider } from "@calcom/prisma/enums";
|
||||
|
||||
import { test } from "./lib/fixtures";
|
||||
|
||||
test.describe.configure({ mode: "serial" });
|
||||
@@ -9,75 +11,89 @@ test.afterEach(({ users }) => users.deleteAll());
|
||||
|
||||
test.describe("Onboarding", () => {
|
||||
test.describe("Onboarding v2", () => {
|
||||
test("Onboarding Flow", async ({ page, users }) => {
|
||||
const user = await users.create({ completedOnboarding: false, name: null });
|
||||
await user.apiLogin();
|
||||
await page.goto("/getting-started");
|
||||
// tests whether the user makes it to /getting-started
|
||||
// after login with completedOnboarding false
|
||||
await page.waitForURL("/getting-started");
|
||||
const testOnboarding = (identityProvider: IdentityProvider) => {
|
||||
test(`Onboarding Flow - ${identityProvider} user`, async ({ page, users }) => {
|
||||
const user = await users.create({
|
||||
completedOnboarding: false,
|
||||
name: null,
|
||||
identityProvider,
|
||||
});
|
||||
await user.apiLogin();
|
||||
await page.goto("/getting-started");
|
||||
// tests whether the user makes it to /getting-started
|
||||
// after login with completedOnboarding false
|
||||
await page.waitForURL("/getting-started");
|
||||
|
||||
await test.step("step 1", async () => {
|
||||
// Check required fields
|
||||
await page.locator("button[type=submit]").click();
|
||||
await expect(page.locator("data-testid=required")).toBeVisible();
|
||||
await test.step("step 1 - User Settings", async () => {
|
||||
// Check required fields
|
||||
await page.locator("button[type=submit]").click();
|
||||
await expect(page.locator("data-testid=required")).toBeVisible();
|
||||
|
||||
// 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("*")
|
||||
.filter({ hasText: /^Europe\/London/ })
|
||||
.first()
|
||||
.click();
|
||||
// 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("*")
|
||||
.filter({ hasText: /^Europe\/London/ })
|
||||
.first()
|
||||
.click();
|
||||
await page.locator("button[type=submit]").click();
|
||||
|
||||
await page.locator("button[type=submit]").click();
|
||||
if (identityProvider === IdentityProvider.GOOGLE) {
|
||||
await expect(page).toHaveURL(/.*setup-availability/);
|
||||
} else {
|
||||
await expect(page).toHaveURL(/.*connected-calendar/);
|
||||
}
|
||||
|
||||
// should be on step 2 now.
|
||||
await expect(page).toHaveURL(/.*connected-calendar/);
|
||||
const userComplete = await user.self();
|
||||
expect(userComplete.name).toBe("new user 2");
|
||||
});
|
||||
|
||||
const userComplete = await user.self();
|
||||
expect(userComplete.name).toBe("new user 2");
|
||||
if (identityProvider !== IdentityProvider.GOOGLE) {
|
||||
await test.step("step 2 - Connected Calendar", 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();
|
||||
|
||||
await expect(page).toHaveURL(/.*connected-video/);
|
||||
});
|
||||
|
||||
await test.step("step 3 - Connected Video", async () => {
|
||||
const isDisabled = await page.locator("button[data-testid=save-video-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();
|
||||
|
||||
await expect(page).toHaveURL(/.*setup-availability/);
|
||||
});
|
||||
}
|
||||
|
||||
await test.step("step 4 - Setup Availability", 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=save-availability]").click();
|
||||
|
||||
await expect(page).toHaveURL(/.*user-profile/);
|
||||
});
|
||||
|
||||
await test.step("step 5- User Profile", async () => {
|
||||
await page.locator("button[type=submit]").click();
|
||||
|
||||
// should redirect to /event-types after onboarding
|
||||
await page.waitForURL("/event-types");
|
||||
|
||||
const userComplete = await user.self();
|
||||
|
||||
expect(userComplete.bio?.replace("<p><br></p>", "").length).toBe(0);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
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();
|
||||
|
||||
await expect(page).toHaveURL(/.*connected-video/);
|
||||
});
|
||||
|
||||
await test.step("step 3", async () => {
|
||||
const isDisabled = await page.locator("button[data-testid=save-video-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();
|
||||
|
||||
await expect(page).toHaveURL(/.*setup-availability/);
|
||||
});
|
||||
|
||||
await test.step("step 4", 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=save-availability]").click();
|
||||
|
||||
await expect(page).toHaveURL(/.*user-profile/);
|
||||
});
|
||||
|
||||
await test.step("step 5", async () => {
|
||||
await page.locator("button[type=submit]").click();
|
||||
|
||||
// should redirect to /event-types after onboarding
|
||||
await page.waitForURL("/event-types");
|
||||
|
||||
const userComplete = await user.self();
|
||||
|
||||
expect(userComplete.bio?.replace("<p><br></p>", "").length).toBe(0);
|
||||
});
|
||||
});
|
||||
testOnboarding(IdentityProvider.GOOGLE);
|
||||
testOnboarding(IdentityProvider.CAL);
|
||||
testOnboarding(IdentityProvider.SAML);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user