Skip to content

Commit

Permalink
Update managed-event-types.e2e.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
zomars committed Sep 4, 2024
1 parent 0f6d3ab commit a890978
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions apps/web/playwright/managed-event-types.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,9 @@ test.describe("Managed Event Types", () => {

await page.locator("#location-select").click();
const optionText = (await localize("en"))("organizer_default_conferencing_app");
await expect(optionText).toBeVisible();
await page.locator(`text=${optionText}`).click();
await page.locator("[data-testid=update-eventtype]").click();
await page.getByTestId("toast-success").waitFor();
await page.waitForLoadState("networkidle");
await submitAndWaitForResponse(page);

await page.getByTestId("vertical-tab-assignment").click();
await gotoBookingPage(page);
Expand Down Expand Up @@ -183,9 +182,7 @@ test.describe("Managed Event Types", () => {
await expect(page.locator('input[name="title"]')).toBeEditable();
await page.locator('input[name="title"]').fill(`Managed Event Title`);
// Save changes
await page.locator('[type="submit"]').click();
await page.getByTestId("toast-success").waitFor();
await page.waitForLoadState("networkidle");
await submitAndWaitForResponse(page);

await page.goto("/auth/logout");

Expand All @@ -196,9 +193,7 @@ test.describe("Managed Event Types", () => {

await page.locator('input[name="length"]').fill(`45`);
// Save changes
await page.locator('[type="submit"]').click();
await page.getByTestId("toast-success").waitFor();
await page.waitForLoadState("networkidle");
await submitAndWaitForResponse(page);

await page.goto("/auth/logout");

Expand All @@ -214,8 +209,7 @@ test.describe("Managed Event Types", () => {
expect(await page.locator(`input[name="title"]`).getAttribute("value")).toBe(`Managed Event Title`);
await page.locator('input[name="title"]').fill(`managed`);
// Save changes
await page.locator('[type="submit"]').click();
await page.getByTestId("toast-success").waitFor();
await submitAndWaitForResponse(page);
});

const MANAGED_EVENT_TABS: { slug: string; locator: (page: Page) => Locator | Promise<Locator> }[] = [
Expand All @@ -226,7 +220,7 @@ test.describe("Managed Event Types", () => {
},
{
slug: "availability",
locator: (page) => getByKey(page, "automatically_add_all_team_members"),
locator: (page) => getByKey(page, "members_default_schedule_description"),
},
{
slug: "limits",
Expand Down Expand Up @@ -266,3 +260,10 @@ async function gotoBookingPage(page: Page) {

await page.goto(previewLink ?? "");
}

async function submitAndWaitForResponse(page: Page) {
const submitPromise = page.waitForResponse("/api/trpc/eventTypes/update?batch=1");
await page.locator('[type="submit"]').click();
const response = await submitPromise;
expect(response.status()).toBe(200);
}

0 comments on commit a890978

Please sign in to comment.