Add embed preview tests (#2969)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/2966/head^2
Hariom Balhara 2022-06-06 15:36:27 +05:30 committed by GitHub
parent f0a5b7734f
commit 079016052d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View File

@ -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);
});

View File

@ -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;