Embed Miscellaneous Improvements and Fixes (#2499)

This commit is contained in:
Hariom Balhara authored and GitHub committed 2022-04-25 10:03:00 +05:30
1 parent 53d7e57142
commit 93c75b5fef
83 files changed
+1139 -746

No files matched your search

@@ -0,0 +1,34 @@
import { PlaywrightTestConfig, devices } from "@playwright/test";
import path from "path";
//TODO: Move the common config to embed-playwright-config and let core and react use the base. Along with config there would be base fixtures and expect custom matchers as well.
import baseConfig from "@calcom/embed-core/playwright/config/playwright.config";
const testDir = path.join("../tests");
const projects = baseConfig.projects?.map((project) => {
if (!project.name) {
return {};
}
return {
...project,
testDir,
};
});
const config: PlaywrightTestConfig = {
...baseConfig,
webServer: {
// Start App Server manually - Can't be handled here. See https://github.com/microsoft/playwright/issues/8206
command: "yarn workspace @calcom/embed-react dev",
port: 3101,
timeout: 60_000,
reuseExistingServer: true,
},
use: {
...baseConfig.use,
baseURL: "http://localhost:3101",
},
projects,
};
export default config;
@@ -0,0 +1,18 @@
import { expect } from "@playwright/test";
import { test } from "@calcom/embed-core/playwright/fixtures/fixtures";
import { getEmbedIframe } from "@calcom/embed-core/playwright/lib/testUtils";
test("Inline Usage Snapshot", async ({ page, getActionFiredDetails, addEmbedListeners }) => {
//TODO: Do it with page.goto automatically
await addEmbedListeners("");
await page.goto("/");
const embedIframe = await getEmbedIframe({ page, pathname: "/pro" });
expect(embedIframe).toBeEmbedCalLink("", getActionFiredDetails, {
pathname: "/pro",
searchParams: {
theme: "dark",
},
});
expect(await page.screenshot()).toMatchSnapshot("react-component-inline.png");
});
Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB