forked from calcom/cal.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: New Booker Tests for Embed (calcom#9666)
- Loading branch information
1 parent
79b3875
commit 2272da5
Showing
5 changed files
with
72 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import { expect } from "@playwright/test"; | |
|
||
import { test } from "@calcom/web/playwright/lib/fixtures"; | ||
import type { Fixtures } from "@calcom/web/playwright/lib/fixtures"; | ||
import { testBothBookers } from "@calcom/web/playwright/lib/new-booker"; | ||
|
||
import { | ||
todo, | ||
|
@@ -17,10 +18,12 @@ async function bookFirstFreeUserEventThroughEmbed({ | |
addEmbedListeners, | ||
page, | ||
getActionFiredDetails, | ||
bookerVariant, | ||
}: { | ||
addEmbedListeners: Fixtures["addEmbedListeners"]; | ||
page: Page; | ||
getActionFiredDetails: Fixtures["getActionFiredDetails"]; | ||
bookerVariant: string; | ||
}) { | ||
const embedButtonLocator = page.locator('[data-cal-link="free"]').first(); | ||
await page.goto("/"); | ||
|
@@ -40,11 +43,11 @@ async function bookFirstFreeUserEventThroughEmbed({ | |
if (!embedIframe) { | ||
throw new Error("Embed iframe not found"); | ||
} | ||
const booking = await bookFirstEvent("free", embedIframe, page); | ||
const booking = await bookFirstEvent("free", embedIframe, page, bookerVariant); | ||
return booking; | ||
} | ||
|
||
test.describe("Popup Tests", () => { | ||
testBothBookers.describe("Popup Tests", (bookerVariant) => { | ||
test.afterEach(async () => { | ||
await deleteAllBookingsByEmail("[email protected]"); | ||
}); | ||
|
@@ -72,7 +75,7 @@ test.describe("Popup Tests", () => { | |
if (!embedIframe) { | ||
throw new Error("Embed iframe not found"); | ||
} | ||
const { uid: bookingId } = await bookFirstEvent("free", embedIframe, page); | ||
const { uid: bookingId } = await bookFirstEvent("free", embedIframe, page, bookerVariant); | ||
const booking = await getBooking(bookingId); | ||
|
||
expect(booking.attendees.length).toBe(1); | ||
|
@@ -85,6 +88,7 @@ test.describe("Popup Tests", () => { | |
page, | ||
addEmbedListeners, | ||
getActionFiredDetails, | ||
bookerVariant, | ||
}); | ||
}); | ||
|
||
|
@@ -97,7 +101,7 @@ test.describe("Popup Tests", () => { | |
if (!embedIframe) { | ||
throw new Error("Embed iframe not found"); | ||
} | ||
await rescheduleEvent("free", embedIframe, page); | ||
await rescheduleEvent("free", embedIframe, page, bookerVariant); | ||
}); | ||
}); | ||
|
||
|
55 changes: 29 additions & 26 deletions
55
packages/embeds/embed-core/playwright/tests/inline.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,38 @@ | ||
import { expect } from "@playwright/test"; | ||
|
||
import { test } from "@calcom/web/playwright/lib/fixtures"; | ||
import { testBothBookers } from "@calcom/web/playwright/lib/new-booker"; | ||
|
||
import { bookFirstEvent, deleteAllBookingsByEmail, getEmbedIframe, todo } from "../lib/testUtils"; | ||
|
||
test("Inline Iframe - Configured with Dark Theme", async ({ | ||
page, | ||
getActionFiredDetails, | ||
addEmbedListeners, | ||
}) => { | ||
await deleteAllBookingsByEmail("[email protected]"); | ||
await addEmbedListeners(""); | ||
await page.goto("/?only=ns:default"); | ||
const calNamespace = ""; | ||
const embedIframe = await getEmbedIframe({ calNamespace, page, pathname: "/pro" }); | ||
expect(embedIframe).toBeEmbedCalLink(calNamespace, getActionFiredDetails, { | ||
pathname: "/pro", | ||
searchParams: { | ||
theme: "dark", | ||
}, | ||
testBothBookers.describe("Inline Iframe", (bookerVariant) => { | ||
test("Inline Iframe - Configured with Dark Theme", async ({ | ||
page, | ||
getActionFiredDetails, | ||
addEmbedListeners, | ||
}) => { | ||
await deleteAllBookingsByEmail("[email protected]"); | ||
await addEmbedListeners(""); | ||
await page.goto("/?only=ns:default"); | ||
const calNamespace = ""; | ||
const embedIframe = await getEmbedIframe({ calNamespace, page, pathname: "/pro" }); | ||
expect(embedIframe).toBeEmbedCalLink(calNamespace, getActionFiredDetails, { | ||
pathname: "/pro", | ||
searchParams: { | ||
theme: "dark", | ||
}, | ||
}); | ||
// expect(await page.screenshot()).toMatchSnapshot("event-types-list.png"); | ||
if (!embedIframe) { | ||
throw new Error("Embed iframe not found"); | ||
} | ||
await bookFirstEvent("pro", embedIframe, page, bookerVariant); | ||
await deleteAllBookingsByEmail("[email protected]"); | ||
}); | ||
// expect(await page.screenshot()).toMatchSnapshot("event-types-list.png"); | ||
if (!embedIframe) { | ||
throw new Error("Embed iframe not found"); | ||
} | ||
await bookFirstEvent("pro", embedIframe, page); | ||
await deleteAllBookingsByEmail("[email protected]"); | ||
}); | ||
|
||
todo( | ||
"Ensure that on all pages - [user], [user]/[type], team/[slug], team/[slug]/book, UI styling works if these pages are directly linked in embed" | ||
); | ||
todo( | ||
"Ensure that on all pages - [user], [user]/[type], team/[slug], team/[slug]/book, UI styling works if these pages are directly linked in embed" | ||
); | ||
|
||
todo("Check that UI Configuration doesn't work for Free Plan"); | ||
todo("Check that UI Configuration doesn't work for Free Plan"); | ||
}); |
39 changes: 21 additions & 18 deletions
39
packages/embeds/embed-core/playwright/tests/preview.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
import { expect } from "@playwright/test"; | ||
|
||
import { test } from "@calcom/web/playwright/lib/fixtures"; | ||
import { testBothBookers } from "@calcom/web/playwright/lib/new-booker"; | ||
|
||
test("Preview - embed-core should load", async ({ page }) => { | ||
await page.goto("http://localhost:3000/embed/preview.html"); | ||
const libraryLoaded = await page.evaluate(() => { | ||
return new Promise((resolve) => { | ||
setInterval(() => { | ||
if ( | ||
( | ||
window as unknown as { | ||
Cal: { | ||
__css: string; | ||
}; | ||
} | ||
).Cal.__css | ||
) { | ||
resolve(true); | ||
} | ||
}, 1000); | ||
testBothBookers.describe("Preview", () => { | ||
test("Preview - embed-core should load", async ({ page }) => { | ||
await page.goto("http://localhost:3000/embed/preview.html"); | ||
const libraryLoaded = await page.evaluate(() => { | ||
return new Promise((resolve) => { | ||
setInterval(() => { | ||
if ( | ||
( | ||
window as unknown as { | ||
Cal: { | ||
__css: string; | ||
}; | ||
} | ||
).Cal.__css | ||
) { | ||
resolve(true); | ||
} | ||
}, 1000); | ||
}); | ||
}); | ||
expect(libraryLoaded).toBe(true); | ||
}); | ||
expect(libraryLoaded).toBe(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters