Skip to content

Scheduling infrastructure for absolutely everyone.

Add embed preview tests (#2969)

Hariom Balhara079016052dcc
diff --git a/packages/embeds/embed-core/playwright/tests/preview.test.ts b/packages/embeds/embed-core/playwright/tests/preview.test.ts
new file mode 100644
index 00000000000..abe63ef9650
--- /dev/null
+++ b/packages/embeds/embed-core/playwright/tests/preview.test.ts
@@ -0,0 +1,25 @@
+import { expect } from "@playwright/test";
+
+import { test } from "../fixtures/fixtures";
+
+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);
+});
diff --git a/packages/embeds/vite.config.js b/packages/embeds/vite.config.js
index 2830d4d3343..20401676861 100644
--- a/packages/embeds/vite.config.js
+++ b/packages/embeds/vite.config.js
@@ -1,4 +1,5 @@
-require("dotenv").config({ path: "../../.env" });
+const path = require("path");
+require("dotenv").config({ path: path.join(__dirname, "..", "..", ".env") });
process.env.EMBED_PUBLIC_VERCEL_URL = process.env.VERCEL_URL;
process.env.EMBED_PUBLIC_WEBAPP_URL = process.env.NEXT_PUBLIC_WEBAPP_URL;
process.env.EMBED_PUBLIC_EMBED_LIB_URL = process.env.NEXT_PUBLIC_EMBED_LIB_URL;