fix: fixed more flaky e2e tests (round 2) (#16660)

* fix: fixed more flaky e2e tests (round 2)

* update

* fix and update

* update
This commit is contained in:
Anik Dhabal Babu
2024-09-18 23:25:44 +09:00
committed by GitHub
parent 5b5a42e72d
commit 021e5f3833
32 changed files with 29 additions and 191 deletions
-1
View File
@@ -39,7 +39,6 @@ test.describe("Availablity", () => {
const nextMonth = dayjs().add(1, "month").startOf("month");
const troubleshooterURL = `/availability/troubleshoot?date=${nextMonth.format("YYYY-MM-DD")}`;
await page.goto(troubleshooterURL);
// await page.waitForLoadState("networkidle");
await expect(page.locator('[data-testid="troubleshooter-busy-time"]')).toHaveCount(1);
});
@@ -165,7 +165,6 @@ test.describe("Booking limits", () => {
await page.locator('[data-testid="confirm-reschedule-button"]').click();
// await page.waitForLoadState("networkidle");
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
const newBooking = await prisma.booking.findFirstOrThrow({ where: { fromReschedule: bookingId } });
+6 -17
View File
@@ -28,15 +28,12 @@ test("check SSR and OG - User Event Type", async ({ page, users }) => {
const user = await users.create({
name,
});
const [response] = await Promise.all([
// This promise resolves to the main resource response
page.waitForResponse(
(response) => response.url().includes(`/${user.username}/30-min`) && response.status() === 200
),
// Trigger the page navigation
page.goto(`/${user.username}/30-min`),
]);
const responsePromise = page.waitForResponse(
(response) => response.url().includes(`/${user.username}/30-min`) && response.status() === 200
);
await page.goto(`/${user.username}/30-min`);
await page.content();
const response = await responsePromise;
const ssrResponse = await response.text();
const document = new JSDOM(ssrResponse).window.document;
@@ -300,10 +297,8 @@ testBothFutureAndLegacyRoutes.describe("pro user", () => {
await eventTypeLink.waitFor();
await eventTypeLink.click();
// await pageTwo.waitForLoadState("networkidle");
await pageTwo.locator('[data-testid="incrementMonth"]').waitFor();
await pageTwo.click('[data-testid="incrementMonth"]');
// await pageTwo.waitForLoadState("networkidle");
await pageTwo.locator('[data-testid="day"][data-disabled="false"]').nth(0).waitFor();
await pageTwo.locator('[data-testid="day"][data-disabled="false"]').nth(0).click();
@@ -337,10 +332,8 @@ testBothFutureAndLegacyRoutes.describe("pro user", () => {
await page.locator('[data-testid="back"]').waitFor();
await page.click('[data-testid="back"]');
// await pageTwo.waitForLoadState("networkidle");
await pageTwo.locator('[data-testid="incrementMonth"]').waitFor();
await pageTwo.click('[data-testid="incrementMonth"]');
// await pageTwo.waitForLoadState("networkidle");
await pageTwo.locator('[data-testid="day"][data-disabled="false"]').nth(0).waitFor();
await pageTwo.locator('[data-testid="day"][data-disabled="false"]').nth(0).click();
@@ -509,8 +502,6 @@ testBothFutureAndLegacyRoutes.describe("Booking round robin event", () => {
// books 9AM slots for 120 minutes (test-user is not available at this time, availability starts at 10)
await page.locator('[data-testid="time"]').nth(0).click();
// await page.waitForLoadState("networkidle");
await page.locator('[name="name"]').fill("Test name");
await page.locator('[name="email"]').fill(`${randomString(4)}@example.com`);
@@ -541,8 +532,6 @@ testBothFutureAndLegacyRoutes.describe("Booking round robin event", () => {
// Again book a 9AM slot for 120 minutes where test-user is not available
await page.locator('[data-testid="time"]').nth(0).click();
// await page.waitForLoadState("networkidle");
await page.locator('[name="name"]').fill("Test name");
await page.locator('[name="email"]').fill(`${randomString(4)}@example.com`);
-7
View File
@@ -104,7 +104,6 @@ test.describe("Booking with Seats", () => {
// confirm cancellation
await page.locator('[data-testid="confirm_cancel"]').click();
// await page.waitForLoadState("networkidle");
await expect(page.locator("text=This event is canceled")).toBeVisible();
@@ -229,8 +228,6 @@ test.describe("Reschedule for booking with seats", () => {
await page.locator('[data-testid="confirm_cancel"]').click();
// await page.waitForLoadState("networkidle");
await expect(page.locator("text=You are no longer attending this event")).toBeVisible();
await page.goto(
@@ -240,8 +237,6 @@ test.describe("Reschedule for booking with seats", () => {
// Page should not be 404
await page.locator('[data-testid="confirm_cancel"]').click();
// await page.waitForLoadState("networkidle");
await expect(page.locator("text=You are no longer attending this event")).toBeVisible();
});
@@ -408,8 +403,6 @@ test.describe("Reschedule for booking with seats", () => {
await expect(page).toHaveURL(/\/booking\/.*/);
// await page.waitForLoadState("networkidle");
const updatedBooking = await prisma.booking.findFirst({
where: { id: booking.id },
});
@@ -13,8 +13,6 @@ test.describe("Change Password Test", () => {
expect(pro.username).toBeTruthy();
// await page.waitForLoadState("networkidle");
// Fill form
await page.locator('[name="oldPassword"]').fill(String(pro.username));
-2
View File
@@ -9,7 +9,6 @@ test.describe("Change Theme Test", () => {
await page.goto("/settings/my-account/appearance");
// await page.waitForLoadState("networkidle");
//Click the "Dark" theme label
await page.click('[data-testid="theme-dark"]');
//Click the update button
@@ -29,7 +28,6 @@ test.describe("Change Theme Test", () => {
await page.goto("/settings/my-account/appearance");
// await page.waitForLoadState("networkidle");
//Click the "Light" theme label
await page.click('[data-testid="theme-light"]');
//Click the update theme button
@@ -60,7 +60,6 @@ test.describe("Change username on settings", () => {
page.click("[data-testid=save-username]"),
page.getByTestId("toast-success").waitFor(),
]);
// await page.waitForLoadState("networkidle");
const updatedUser = await prisma.user.findUniqueOrThrow({
where: {
@@ -149,7 +148,6 @@ test.describe("Change username on settings", () => {
const usernameInput = page.locator("[data-testid=username-input]");
await usernameInput.fill(previousUsername);
// await page.waitForLoadState("networkidle");
await expect(page.locator("[data-testid=update-username-btn]").nth(0)).toBeHidden();
await expect(page.locator("[data-testid=update-username-btn]").nth(1)).toBeHidden();
});
@@ -70,8 +70,6 @@ test("dynamic booking info prefilled by query params", async ({ page, users }) =
const free = await users.create({ username: "free.example" });
await page.goto(`/${pro.username}+${free.username}?duration=${duration}`);
// await page.waitForLoadState("networkidle");
const listItemByDurationTestId = (duration: number) => `multiple-choice-${duration}mins`;
let listItemLocator = await page.getByTestId(listItemByDurationTestId(duration));
-3
View File
@@ -64,7 +64,6 @@ testBothFutureAndLegacyRoutes.describe("Event Types tests", () => {
const nonce = randomString(3);
const eventTitle = `my recurring event ${nonce}`;
await createNewEventType(page, { eventTitle });
// await page.waitForLoadState("networkidle");
await page.click("[data-testid=vertical-tab-recurring]");
await expect(page.locator("[data-testid=recurring-event-collapsible]")).toBeHidden();
@@ -270,14 +269,12 @@ testBothFutureAndLegacyRoutes.describe("Event Types tests", () => {
await addAnotherLocation(page, "Cal Video (Global)");
await saveEventType(page);
// await page.waitForLoadState("networkidle");
// Remove Attendee Phone Number Location
const removeButtomId = "delete-locations.0.type";
await page.getByTestId(removeButtomId).click();
await saveEventType(page);
// await page.waitForLoadState("networkidle");
await gotoBookingPage(page);
await selectFirstAvailableTimeSlotNextMonth(page);
-4
View File
@@ -62,11 +62,9 @@ export function createAppsFixture(page: Page) {
}
await page.locator("[data-testid=display-location]").last().check();
await saveEventType(page);
// await page.waitForLoadState("networkidle");
await gotoBookingPage(page);
await selectFirstAvailableTimeSlotNextMonth(page);
await bookTimeSlot(page);
// await page.waitForLoadState("networkidle");
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
await expect(page.locator("[data-testid=where] ")).toContainText(app.label);
@@ -94,11 +92,9 @@ export function createAppsFixture(page: Page) {
verifyConferencingAppNew: async (app: TApp, eventTypeIds: number[]) => {
for (const id of eventTypeIds) {
await page.goto(`/event-types/${id}`);
// await page.waitForLoadState("networkidle");
await gotoBookingPage(page);
await selectFirstAvailableTimeSlotNextMonth(page);
await bookTimeSlot(page, { name: `Test Testson`, email: `test@example.com` });
// await page.waitForLoadState("networkidle");
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
await expect(page.locator("[data-testid=where] ")).toContainText(app.label);
}
-3
View File
@@ -32,8 +32,6 @@ test.describe("hash my url", () => {
// click update
await page.locator('[data-testid="update-eventtype"]').press("Enter");
// await page.waitForLoadState("networkidle");
// book using generated url hash
await page.goto($url);
await selectFirstAvailableTimeSlotNextMonth(page);
@@ -61,7 +59,6 @@ test.describe("hash my url", () => {
await page.locator("[data-testid=update-eventtype]").click();
const response = await submitPromise;
expect(response.status()).toBe(200);
// await page.waitForLoadState("networkidle");
await page.locator(".primary-navigation >> text=Advanced").click();
const $url2 = await page.locator('//*[@data-testid="generated-hash-url"]').inputValue();
expect($url2.includes("somethingrandom")).toBeTruthy();
-1
View File
@@ -41,7 +41,6 @@ test.describe("Users can impersonate", async () => {
await stopImpersonatingButton.click();
await expect(stopImpersonatingButton).toBeHidden();
// await page.waitForLoadState("networkidle");
// Return to user
const ogUser = await impersonatedUsernameInput.inputValue();
-6
View File
@@ -110,8 +110,6 @@ test.describe("Insights", async () => {
// go to insights page
await page.goto("/insights");
// await page.waitForLoadState("networkidle");
// get div from team select filter with this class flex flex-col gap-0.5 [&>*:first-child]:mt-1 [&>*:last-child]:mb-1
await page.getByTestId("dashboard-shell").getByText("Team: test-insights").click();
await page
@@ -134,7 +132,6 @@ test.describe("Insights", async () => {
await owner.apiLogin();
await page.goto("/insights");
// await page.waitForLoadState("networkidle");
await page.getByTestId("dashboard-shell").getByText("All").nth(1).click();
@@ -220,7 +217,6 @@ test.describe("Insights", async () => {
)
.nth(0)
.click();
// await page.waitForLoadState("networkidle");
await page
.locator(
@@ -228,7 +224,6 @@ test.describe("Insights", async () => {
)
.nth(1)
.click();
// await page.waitForLoadState("networkidle");
// press escape button to close the filter
await page.keyboard.press("Escape");
@@ -247,7 +242,6 @@ test.describe("Insights", async () => {
await owner.apiLogin();
await page.goto("/insights");
// await page.waitForLoadState("networkidle");
const downloadPromise = page.waitForEvent("download");
+1 -1
View File
@@ -207,7 +207,7 @@ export async function gotoRoutingLink({
await page.goto(`${previewLink}${queryString ? `?${queryString}` : ""}`);
// HACK: There seems to be some issue with the inputs to the form getting reset if we don't wait.
await new Promise((resolve) => setTimeout(resolve, 1000));
await new Promise((resolve) => setTimeout(resolve, 2000));
}
export async function installAppleCalendar(page: Page) {
@@ -31,8 +31,6 @@ test.describe("OAuth Provider", () => {
await page.goto(
`auth/oauth2/authorize?client_id=${client.clientId}&redirect_uri=${client.redirectUri}&response_type=code&scope=READ_PROFILE&state=1234`
);
// await page.waitForLoadState("networkidle");
await page.getByTestId("allow-button").click();
await page.waitForFunction(() => {
@@ -112,8 +110,6 @@ test.describe("OAuth Provider", () => {
`auth/oauth2/authorize?client_id=${client.clientId}&redirect_uri=${client.redirectUri}&response_type=code&scope=READ_PROFILE&state=1234`
);
// await page.waitForLoadState("networkidle");
await page.locator("#account-select").click();
await page.locator("#react-select-2-option-1").click();
@@ -47,7 +47,6 @@ test.describe("user1NotMemberOfOrg1 is part of team1MemberOfOrg1", () => {
await user1NotMemberOfOrg1.apiLogin();
await page.goto("/event-types");
// await page.waitForLoadState("networkidle");
const userEventLinksSelector = `[data-testid=slug-${user1NotMemberOfOrg1.username}] [data-testid="preview-link-button"]`;
await page.waitForSelector(userEventLinksSelector);
@@ -163,6 +163,7 @@ test.describe("Bookings", () => {
const { team } = await owner.getFirstTeamMembership();
const teamEvent = await owner.getFirstTeamEvent(team.id);
const eventHostsObj = [...teamMatesObj, { name: "pro-user" }];
await expectPageToBeNotFound({ page, url: `/team/${team.slug}/${teamEvent.slug}` });
@@ -172,7 +173,7 @@ test.describe("Bookings", () => {
page,
},
async () => {
await bookTeamEvent({ page, team, event: teamEvent, teamMatesObj });
await bookTeamEvent({ page, team, event: teamEvent, teamMatesObj: eventHostsObj });
// Since all the users have the same leastRecentlyBooked value
// Anyone of the teammates could be the Host of the booking.
@@ -542,6 +543,7 @@ test.describe("Bookings", () => {
await expectPageToBeNotFound({ page, url: `/${usernameInOrg}` });
await userOutsideOrganization.apiLogin();
await acceptTeamOrOrgInvite(page);
await userOutsideOrganization.logout();
await test.step("Book through new link", async () => {
await doOnOrgDomain(
{
@@ -13,7 +13,6 @@ export const inviteUserToOrganization = async ({
usersFixture: ReturnType<typeof createUsersFixture>;
}) => {
await page.goto("/settings/organizations/members");
// await page.waitForLoadState("networkidle");
const invitedUserEmail = usersFixture.trackEmail({
username: email.split("@")[0],
domain: email.split("@")[1],
@@ -36,7 +35,6 @@ export const inviteExistingUserToOrganization = async ({
usersFixture: ReturnType<typeof createUsersFixture>;
}) => {
await page.goto("/settings/organizations/members");
// await page.waitForLoadState("networkidle");
await inviteAnEmail(page, user.email);
await page.waitForSelector('[data-testid="toast-success"]');
@@ -46,12 +44,10 @@ export const inviteExistingUserToOrganization = async ({
export async function acceptTeamOrOrgInvite(page: Page) {
await page.goto("/settings/teams");
await page.click('[data-testid^="accept-invitation"]');
// await page.waitForLoadState("networkidle");
}
async function inviteAnEmail(page: Page, invitedUserEmail: string) {
await page.locator('button:text("Add")').click();
await page.locator('input[name="inviteUser"]').fill(invitedUserEmail);
await page.locator('button:text("Send invite")').click();
// await page.waitForLoadState("networkidle");
}
@@ -131,7 +131,6 @@ test.describe("Organization", () => {
const orgName = capitalize(`${orgOwnerUser.username}`);
const orgSlug = `myOrg-${uuid()}`.toLowerCase();
await page.goto("/settings/organizations/new");
// await page.waitForLoadState("networkidle");
await test.step("Basic info", async () => {
// Check required fields
@@ -192,7 +191,6 @@ test.describe("Organization", () => {
await expect(page.getByTestId("pending-member-item")).toHaveCount(2);
const lastRemoveMemberButton = page.getByTestId("remove-member-button").last();
await lastRemoveMemberButton.click();
// await page.waitForLoadState("networkidle");
await expect(page.getByTestId("pending-member-item")).toHaveCount(1);
await page.getByTestId("publish-button").click();
// Waiting to be in next step URL
@@ -232,7 +230,6 @@ test.describe("Organization", () => {
expect(url).toContain(expectedUrl);
await fillStripeTestCheckout(page);
// await page.waitForLoadState("networkidle");
const upgradeButtonHidden = await page.getByTestId("upgrade_org_banner_button");
@@ -268,7 +265,6 @@ test.describe("Organization", () => {
});
await page.goto("/settings/organizations/new");
// await page.waitForLoadState("networkidle");
await test.step("Basic info", async () => {
// Check required fields
@@ -309,7 +305,6 @@ test.describe("Organization", () => {
await orgOwnerUser.apiLogin();
const orgName = capitalize(`${orgOwnerUsername}`);
await page.goto("/settings/organizations/new");
// await page.waitForLoadState("networkidle");
await test.step("Basic info", async () => {
// These values are infered due to an existing user being signed
@@ -320,7 +315,6 @@ test.describe("Organization", () => {
await page.locator("input[name=slug]").fill(orgOwnerUsername);
await page.locator("button[type=submit]").click();
// await page.waitForLoadState("networkidle");
});
await test.step("About the organization", async () => {
@@ -364,7 +358,6 @@ test.describe("Organization", () => {
await expect(page.getByTestId("pending-member-item")).toHaveCount(2);
const lastRemoveMemberButton = page.getByTestId("remove-member-button").last();
await lastRemoveMemberButton.click();
// await page.waitForLoadState("networkidle");
await expect(page.getByTestId("pending-member-item")).toHaveCount(1);
await page.getByTestId("publish-button").click();
// Waiting to be in next step URL
@@ -402,7 +395,6 @@ test.describe("Organization", () => {
expect(url).toContain(expectedUrl);
await fillStripeTestCheckout(page);
// await page.waitForLoadState("networkidle");
const upgradeButtonHidden = await page.getByTestId("upgrade_org_banner_button");
@@ -455,7 +447,6 @@ test.describe("Organization", () => {
await slugLocator.fill(`example-${stringUUID}`);
await page.locator("button[type=submit]").click();
// await page.waitForLoadState("networkidle");
});
await test.step("About the organization", async () => {
@@ -499,7 +490,6 @@ test.describe("Organization", () => {
await expect(page.getByTestId("pending-member-item")).toHaveCount(2);
const lastRemoveMemberButton = page.getByTestId("remove-member-button").last();
await lastRemoveMemberButton.click();
// await page.waitForLoadState("networkidle");
await expect(page.getByTestId("pending-member-item")).toHaveCount(1);
await page.getByTestId("publish-button").click();
// Waiting to be in next step URL
@@ -547,7 +537,6 @@ test.describe("Organization", () => {
expect(url).toContain(expectedUrl);
await fillStripeTestCheckout(page);
// await page.waitForLoadState("networkidle");
const upgradeButtonHidden = await page.getByTestId("upgrade_org_banner_button");
@@ -557,7 +546,6 @@ test.describe("Organization", () => {
await test.step("Ensure correctnumberOfTeams are migrated", async () => {
// eslint-disable-next-line playwright/no-skipped-test
await page.goto("/teams");
// await page.waitForLoadState("networkidle");
const teamListItems = await page.getByTestId("team-list-item-link").all();
// Number of teams migrated + the two created in the create teams step
@@ -24,7 +24,6 @@ test.describe("Organization", () => {
const { team: org } = await orgOwner.getOrgMembership();
await orgOwner.apiLogin();
await page.goto("/settings/organizations/members");
// await page.waitForLoadState("networkidle");
await test.step("By email", async () => {
const invitedUserEmail = users.trackEmail({ username: "rick", domain: "domain.com" });
@@ -104,7 +103,6 @@ test.describe("Organization", () => {
await test.step("By email", async () => {
await page.goto(`/settings/teams/${team.id}/members`);
// await page.waitForLoadState("networkidle");
const invitedUserEmail = users.trackEmail({ username: "rick", domain: "domain.com" });
// '-domain' because the email doesn't match orgAutoAcceptEmail
const usernameDerivedFromEmail = `${invitedUserEmail.split("@")[0]}-domain`;
@@ -126,7 +124,6 @@ test.describe("Organization", () => {
email: invitedUserEmail,
});
// await page.waitForLoadState("networkidle");
const inviteLink = await expectInvitationEmailToBeReceived(
page,
emails,
@@ -206,7 +203,6 @@ test.describe("Organization", () => {
const { team: org } = await orgOwner.getOrgMembership();
await orgOwner.apiLogin();
await page.goto("/settings/organizations/members");
// await page.waitForLoadState("networkidle");
await test.step("By email", async () => {
const invitedUserEmail = users.trackEmail({ username: "rick", domain: "example.com" });
@@ -300,16 +296,14 @@ test.describe("Organization", () => {
await test.step("Signing up with the previous username of the migrated user - shouldn't be allowed", async () => {
await page.goto("/signup");
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
await expect(page.locator("text=Create your account")).toBeVisible();
const usernameInput = page.locator('input[name="username"]');
await usernameInput.waitFor({ state: "attached" });
await usernameInput.waitFor({ state: "visible" });
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
await usernameInput.fill(existingUser.username!);
await page
.locator('input[name="email"]')
.fill(`${existingUser.username}-differnet-email@example.com`);
await page.locator('input[name="password"]').fill("Password99!");
// await page.waitForLoadState("networkidle");
await expect(page.locator('button[type="submit"]')).toBeDisabled();
});
});
@@ -334,7 +328,6 @@ test.describe("Organization", () => {
await test.step("By email", async () => {
await page.goto(`/settings/teams/${team.id}/members`);
// await page.waitForLoadState("networkidle");
const invitedUserEmail = users.trackEmail({ username: "rick", domain: "example.com" });
const usernameDerivedFromEmail = invitedUserEmail.split("@")[0];
await inviteAnEmail(page, invitedUserEmail);
@@ -489,7 +482,6 @@ export async function signupFromEmailInviteLink({
async function inviteAnEmail(page: Page, invitedUserEmail: string) {
await page.locator('button:text("Add")').click();
await page.locator('input[name="inviteUser"]').fill(invitedUserEmail);
// await page.waitForLoadState("networkidle");
const submitPromise = page.waitForResponse("/api/trpc/teams/inviteMember?batch=1");
await page.locator('button:text("Send invite")').click();
const response = await submitPromise;
@@ -57,7 +57,6 @@ test.describe("Teams", () => {
await expect(page.getByTestId("pending-member-item")).toHaveCount(2);
const lastRemoveMemberButton = page.getByTestId("remove-member-button").last();
await lastRemoveMemberButton.click();
// await page.waitForLoadState("networkidle");
await expect(page.getByTestId("pending-member-item")).toHaveCount(1);
// Cleanup here since this user is created without our fixtures.
@@ -31,7 +31,6 @@ export {};
// await test.step("Settings should so no calendars connected", async () => {
// const settingsCog = page.locator(`[data-testid=overlay-calendar-settings-button]`);
// await settingsCog.click();
// // await page.waitForLoadState("networkidle");
// const emptyScreenLocator = page.locator(`[data-testid=empty-screen]`);
// await expect(emptyScreenLocator).toBeVisible();
// });
-2
View File
@@ -43,8 +43,6 @@ testBothFutureAndLegacyRoutes.describe("Payment", (routeVariant) => {
await page.goto(`${user.username}/30-min`);
// await page.waitForLoadState("networkidle");
await selectFirstAvailableTimeSlotNextMonth(page);
await bookTimeSlot(page);
await page.waitForURL((url) => url.pathname.includes("/payment/"));
-2
View File
@@ -198,7 +198,6 @@ test.describe("Update Profile", () => {
secondaryEmail: string;
}) => {
await test.step("the user receives the correct invitation link", async () => {
// await page.waitForLoadState("networkidle");
const verificationToken = await prisma.verificationToken.findFirst({
where: {
identifier: secondaryEmail,
@@ -248,7 +247,6 @@ test.describe("Update Profile", () => {
expect(await secondaryEmailConfirmDialog.isVisible()).toBe(false);
await test.step("the user receives the correct invitation link", async () => {
// await page.waitForLoadState("networkidle");
const verificationToken = await prisma.verificationToken.findFirst({
where: {
identifier: secondaryEmail,
-2
View File
@@ -96,8 +96,6 @@ test.describe("Reschedule Tests", async () => {
await page.locator('[data-testid="confirm-reschedule-button"]').click();
// await page.waitForLoadState("networkidle");
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
const newBooking = await prisma.booking.findFirstOrThrow({ where: { fromReschedule: booking.uid } });
+10 -10
View File
@@ -25,7 +25,7 @@ test.describe("Signup Flow Test", async () => {
});
await page.goto("/signup");
// await page.waitForLoadState("networkidle");
await expect(page.locator("text=Create your account")).toBeVisible();
const alertMessage = "Username or email is already taken";
@@ -52,7 +52,8 @@ test.describe("Signup Flow Test", async () => {
});
await page.goto("/signup");
// await page.waitForLoadState("networkidle");
await expect(page.locator("text=Create your account")).toBeVisible();
const alertMessage = "Username or email is already taken";
@@ -83,7 +84,7 @@ test.describe("Signup Flow Test", async () => {
// Signup with premium username name
await page.goto("/signup");
// await page.waitForLoadState("networkidle");
await expect(page.locator("text=Create your account")).toBeVisible();
// Fill form
await page.locator('input[name="username"]').fill("rock");
@@ -111,7 +112,7 @@ test.describe("Signup Flow Test", async () => {
});
await page.goto("/signup");
// await page.waitForLoadState("networkidle");
await expect(page.locator("text=Create your account")).toBeVisible();
// Fill form
await page.locator('input[name="username"]').fill(userToCreate.username);
@@ -130,6 +131,7 @@ test.describe("Signup Flow Test", async () => {
test("Signup fields prefilled with query params", async ({ page, users }) => {
const signupUrlWithParams = "/signup?username=rick-jones&email=rick-jones%40example.com";
await page.goto(signupUrlWithParams);
await expect(page.locator("text=Create your account")).toBeVisible();
// Fill form
const usernameInput = page.locator('input[name="username"]');
@@ -179,7 +181,7 @@ test.describe("Signup Flow Test", async () => {
const signupUrlWithToken = `/signup?token=${token}`;
await page.goto(signupUrlWithToken);
// await page.waitForLoadState("networkidle");
await expect(page.locator("text=Create your account")).toBeVisible();
const usernameField = page.locator('input[name="username"]');
const emailField = page.locator('input[name="email"]');
@@ -210,7 +212,7 @@ test.describe("Signup Flow Test", async () => {
});
await page.goto("/signup");
await page.waitForLoadState("domcontentloaded");
await expect(page.locator("text=Create your account")).toBeVisible();
// Fill form
await page.locator('input[name="username"]').fill(userToCreate.username);
@@ -218,7 +220,6 @@ test.describe("Signup Flow Test", async () => {
await page.locator('input[name="password"]').fill(userToCreate.password);
const submitButton = page.locator('button[type="submit"]');
await submitButton.waitFor({ state: "attached" });
await expect(submitButton).toBeEnabled();
await submitButton.click();
@@ -250,7 +251,6 @@ test.describe("Signup Flow Test", async () => {
const { team } = await teamOwner.getFirstTeamMembership();
await teamOwner.apiLogin();
await page.goto(`/settings/teams/${team.id}/members`);
// await page.waitForLoadState("networkidle");
await test.step("Invite User to team", async () => {
// TODO: This invite logic should live in a fixture - its used in team and orgs invites (Duplicated from team/org invites)
@@ -258,7 +258,7 @@ test.describe("Signup Flow Test", async () => {
await page.locator(`button:text("${t("add")}")`).click();
await page.locator('input[name="inviteUser"]').fill(invitedUserEmail);
await page.locator(`button:text("${t("send_invite")}")`).click();
// await page.waitForLoadState("networkidle");
const inviteLink = await expectInvitationEmailToBeReceived(
page,
emails,
@@ -279,7 +279,7 @@ test.describe("Signup Flow Test", async () => {
const context = await browser.newContext();
const newPage = await context.newPage();
await newPage.goto(inviteLink);
await newPage.waitForLoadState("networkidle");
await expect(newPage.locator("text=Create your account")).toBeVisible();
const url = new URL(newPage.url());
expect(url.pathname).toBe("/signup");
@@ -19,7 +19,6 @@ test.describe("Team", () => {
const { team } = await teamOwner.getFirstTeamMembership();
await teamOwner.apiLogin();
await page.goto(`/settings/teams/${team.id}/members`);
// await page.waitForLoadState("networkidle");
await test.step("To the team by email (external user)", async () => {
const invitedUserEmail = users.trackEmail({
@@ -29,7 +28,6 @@ test.describe("Team", () => {
await page.locator(`button:text("${t("add")}")`).click();
await page.locator('input[name="inviteUser"]').fill(invitedUserEmail);
await page.locator(`button:text("${t("send_invite")}")`).click();
// await page.waitForLoadState("networkidle");
const inviteLink = await expectInvitationEmailToBeReceived(
page,
emails,
@@ -66,7 +64,6 @@ test.describe("Team", () => {
// Check newly invited member is not pending anymore
await page.bringToFront();
await page.goto(`/settings/teams/${team.id}/members`);
// await page.waitForLoadState("networkidle");
await expect(
page.locator(`[data-testid="email-${invitedUserEmail.replace("@", "")}-pending"]`)
).toHaveCount(0);
@@ -103,7 +100,6 @@ test.describe("Team", () => {
const { team } = await teamOwner.getFirstTeamMembership();
await teamOwner.apiLogin();
await page.goto(`/settings/teams/${team.id}/members`);
// await page.waitForLoadState("networkidle");
await test.step("To the organization by email (internal user)", async () => {
const invitedUserEmail = users.trackEmail({
@@ -113,7 +109,6 @@ test.describe("Team", () => {
await page.locator(`button:text("${t("add")}")`).click();
await page.locator('input[name="inviteUser"]').fill(invitedUserEmail);
await page.locator(`button:text("${t("send_invite")}")`).click();
// await page.waitForLoadState("networkidle");
await expectInvitationEmailToBeReceived(
page,
emails,
-47
View File
@@ -36,53 +36,6 @@ testBothFutureAndLegacyRoutes.describe("Teams A/B tests", (routeVariant) => {
testBothFutureAndLegacyRoutes.describe("Teams - NonOrg", (routeVariant) => {
test.afterEach(({ users }) => users.deleteAll());
test("Team Onboarding Invite Members", async ({ page, users }) => {
const user = await users.create(undefined, { hasTeam: true });
const { team } = await user.getFirstTeamMembership();
const inviteeEmail = `${user.username}+invitee@example.com`;
await user.apiLogin();
page.goto(`/settings/teams/${team.id}/onboard-members`);
// await page.waitForLoadState("networkidle");
await test.step("Can add members", async () => {
// Click [data-testid="new-member-button"]
await page.locator('[data-testid="new-member-button"]').click();
// Fill [placeholder="email\@example\.com"]
await page.locator('[placeholder="email\\@example\\.com"]').fill(inviteeEmail);
// Click [data-testid="invite-new-member-button"]
await page.locator('[data-testid="invite-new-member-button"]').click();
await expect(page.locator(`li:has-text("${inviteeEmail}")`)).toBeVisible();
await expect(page.locator('[data-testid="pending-member-item"]')).toHaveCount(2);
});
await test.step("Can remove members", async () => {
const removeMemberButton = page.locator('[data-testid="remove-member-button"]');
await removeMemberButton.click();
await removeMemberButton.waitFor({ state: "hidden" });
await expect(page.locator('[data-testid="pending-member-item"]')).toHaveCount(1);
// Cleanup here since this user is created without our fixtures.
await prisma.user.delete({ where: { email: inviteeEmail } });
});
await test.step("Finishing brings you to team profile page", async () => {
await page.locator("[data-testid=publish-button]").click();
await expect(page).toHaveURL(/\/settings\/teams\/(\d+)\/event-type$/i);
await page.locator("[data-testid=handle-later-button]").click();
await page.waitForURL(/\/settings\/teams\/(\d+)\/profile$/i);
});
await test.step("Can disband team", async () => {
await page.locator("text=Disband Team").click();
await page.locator("text=Yes, disband team").click();
await page.waitForURL("/teams");
await expect(await page.locator(`text=${user.username}'s Team`).count()).toEqual(0);
// FLAKY: If other tests are running async this may mean there are >0 teams, empty screen will not be shown.
// await expect(page.locator('[data-testid="empty-screen"]')).toBeVisible();
});
});
test("Can create a booking for Collective EventType", async ({ page, users }) => {
const teamMatesObj = [
{ name: "teammate-1" },
-5
View File
@@ -47,7 +47,6 @@ test.describe("Unpublished", () => {
const { team: org } = await owner.getOrgMembership();
const { requestedSlug } = org.metadata as { requestedSlug: string };
await page.goto(`/org/${requestedSlug}`);
// await page.waitForLoadState("networkidle");
await expect(page.locator('[data-testid="empty-screen"]')).toHaveCount(1);
await expect(page.locator(`h2:has-text("${title(org.name)}")`)).toHaveCount(1);
await expect(page.locator(`div:text("${description("organization")}")`)).toHaveCount(1);
@@ -65,7 +64,6 @@ test.describe("Unpublished", () => {
const { requestedSlug } = org.metadata as { requestedSlug: string };
const [{ slug: subteamSlug }] = org.children as { slug: string }[];
await page.goto(`/org/${requestedSlug}/team/${subteamSlug}`);
// await page.waitForLoadState("networkidle");
await expect(page.locator('[data-testid="empty-screen"]')).toHaveCount(1);
await expect(page.locator(`h2:has-text("${title(org.name)}")`)).toHaveCount(1);
await expect(page.locator(`div:text("${description("organization")}")`)).toHaveCount(1);
@@ -84,7 +82,6 @@ test.describe("Unpublished", () => {
const [{ slug: subteamSlug, id: subteamId }] = org.children as { slug: string; id: number }[];
const { slug: subteamEventSlug } = await owner.getFirstTeamEvent(subteamId);
await page.goto(`/org/${requestedSlug}/team/${subteamSlug}/${subteamEventSlug}`);
// await page.waitForLoadState("networkidle");
await expect(page.locator('[data-testid="empty-screen"]')).toHaveCount(1);
await expect(page.locator(`h2:has-text("${title(org.name)}")`)).toHaveCount(1);
@@ -97,7 +94,6 @@ test.describe("Unpublished", () => {
const { team: org } = await owner.getOrgMembership();
const { requestedSlug } = org.metadata as { requestedSlug: string };
await page.goto(`/org/${requestedSlug}/${owner.username}`);
// await page.waitForLoadState("networkidle");
await expect(page.locator('[data-testid="empty-screen"]')).toHaveCount(1);
await expect(page.locator(`h2:has-text("${title(org.name)}")`)).toHaveCount(1);
await expect(page.locator(`div:text("${description("organization")}")`)).toHaveCount(1);
@@ -110,7 +106,6 @@ test.describe("Unpublished", () => {
const { requestedSlug } = org.metadata as { requestedSlug: string };
const [{ slug: ownerEventType }] = owner.eventTypes;
await page.goto(`/org/${requestedSlug}/${owner.username}/${ownerEventType}`);
// await page.waitForLoadState("networkidle");
await expect(page.locator('[data-testid="empty-screen"]')).toHaveCount(1);
await expect(page.locator(`h2:has-text("${title(org.name)}")`)).toHaveCount(1);
await expect(page.locator(`div:text("${description("organization")}")`)).toHaveCount(1);
+2 -27
View File
@@ -577,30 +577,10 @@ test.describe("MEETING_ENDED, MEETING_STARTED", async () => {
expect(newMeetingEndedTriggers.length).toBe(0);
// disable webhook
await page.click('[data-testid="webhook-switch"]');
const submitPromise = page.waitForResponse("/api/trpc/webhook/edit?batch=1");
await page.getByTestId("webhook-switch").click();
const response = await page.waitForResponse("/api/trpc/webhook/edit?batch=1");
const response = await submitPromise;
expect(response.status()).toBe(200);
// await page.waitForLoadState("networkidle");
const scheduledTriggersAfterDisabling = await prisma.webhookScheduledTriggers.findMany({
where: {
webhook: {
userId: user.id,
},
},
select: {
payload: true,
webhook: {
select: {
userId: true,
},
},
startAfter: true,
},
});
expect(scheduledTriggersAfterDisabling.length).toBe(0);
});
});
@@ -610,7 +590,6 @@ test.describe("FORM_SUBMITTED", async () => {
await user.apiLogin();
const webhookReceiver = await webhooks.createReceiver();
// await page.waitForLoadState("networkidle");
const form = await routingForms.create({
name: "Test Form",
@@ -626,8 +605,6 @@ test.describe("FORM_SUBMITTED", async () => {
],
});
// await page.waitForLoadState("networkidle");
await gotoRoutingLink({ page, formId: form.id });
const fieldName = "name";
await page.fill(`[data-testid="form-field-${fieldName}"]`, "John Doe");
@@ -695,8 +672,6 @@ test.describe("FORM_SUBMITTED", async () => {
],
});
// await page.waitForLoadState("networkidle");
await gotoRoutingLink({ page, formId: form.id });
const textFieldIdentifier = "name";
const multiSelectFieldIdentifier = "multi";
@@ -28,8 +28,6 @@ const Identifiers = {
test.describe("Routing Forms", () => {
test.describe("Zero State Routing Forms", () => {
test("should be able to add a new form and view it", async ({ page }) => {
await page.waitForSelector('[data-testid="empty-screen"]');
const formId = await addForm(page);
await page.click('[href*="/forms"]');
@@ -81,6 +79,7 @@ test.describe("Routing Forms", () => {
test.describe("F1<-F2 Relationship", () => {
test("Create relationship by adding F1 as route.Editing F1 should update F2", async ({ page }) => {
const form1Id = await addForm(page, { name: "F1" });
await page.goto(`/routing-forms/forms`);
const form2Id = await addForm(page, { name: "F2" });
await addOneFieldAndDescriptionAndSaveForm(form1Id, page, {
@@ -198,7 +197,6 @@ test.describe("Routing Forms", () => {
}
);
await user.apiLogin();
await page.goto(`/routing-forms/forms`);
});
test.afterEach(async ({ users }) => {
@@ -210,6 +208,9 @@ test.describe("Routing Forms", () => {
todo("should be able to duplicate form");
test.describe("Seeded Routing Form ", () => {
test.beforeEach(async ({ page }) => {
await page.goto(`/routing-forms/forms`);
});
test.afterEach(async ({ users }) => {
// This also delete forms on cascade
await users.deleteAll();
@@ -365,7 +366,6 @@ test.describe("Routing Forms", () => {
const routingForm = user.routingForms[0];
await page.goto(`apps/routing-forms/form-edit/${routingForm.id}`);
await page.click('[data-testid="test-preview"]');
// await page.waitForLoadState("networkidle");
//event redirect
await page.fill('[data-testid="form-field-Test field"]', "event-routing");
@@ -2,7 +2,7 @@ import type { Page } from "@playwright/test";
import { expect } from "@playwright/test";
export async function addForm(page: Page, { name = "Test Form Name" } = {}) {
await page.goto("/routing-forms/forms");
await page.goto(`/routing-forms/forms`);
await page.click('[data-testid="new-routing-form"]');
// Choose to create the Form for the user(which is the first option) and not the team
await page.click('[data-testid="option-0"]');