test: verify embed helpers#11318
Conversation
|
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@ologbonowiwi is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for following the naming conventions! 🙏 |
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
|
|
||
| import { test } from "@calcom/web/playwright/lib/fixtures"; | ||
|
|
||
| import "../../src/types.d"; |
There was a problem hiding this comment.
now window.isEmbed type definition would be available.
6bf85b5 to
f8b0b45
Compare
|
|
||
| test("should change to embed when window.name is changed to cal-embed=", async ({ page }) => { | ||
| await page.goto("http://localhost:3000/free/30min"); | ||
| test.describe("isEmbed, getEmbedNamespace, getEmbedTheme testing", () => { |
There was a problem hiding this comment.
Clubbed the tests under one describe.
| page, | ||
| }) => { | ||
| const queryParamTheme = "dark"; | ||
| await page.evaluate(() => { |
There was a problem hiding this comment.
We can set window.name before going to the URL and then load the URL. It avoids an unnecessary page load saving time per test.
| test("should change to embed when window.name is changed to cal-embed=", async ({ page }) => { | ||
| await page.goto("http://localhost:3000/free/30min"); | ||
| test.describe("isEmbed, getEmbedNamespace, getEmbedTheme testing", () => { | ||
| test("when `window.name` is set to 'cal-embed=' and `theme` is supplied as a query param", async ({ |
There was a problem hiding this comment.
Also clubbed the different test sections for isEmbed and getEmbedNamespace together so that we can test both on a single page visit. This is to again save time as we really want to not increase time taken by our E2E tests significantly
There was a problem hiding this comment.
Moved global type augmentation here so that they can be shared with others.
…ngs for embed functions on window
f8b0b45 to
a5fce79
Compare
hariombalhara
left a comment
There was a problem hiding this comment.
Thanks @ologbonowiwi 🙏 LGTM!!
40045cd to
3fd3085
Compare
687459a to
ba705b7
Compare
* test: add test cases to `window.getEmbedNamespace` * test: add test cases when window.name doesn't have cal-embed= * test: add test case to `getembedTheme` returning the theme from embedStore * test: add test to `getEmbedTheme` returning the theme from query params * Small refactor to reduce the time taken by tests and fix missing typings for embed functions on window * Fix weird test failure * Fix type import error caught by api.test.test --------- Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
* test: add test cases to `window.getEmbedNamespace` * test: add test cases when window.name doesn't have cal-embed= * test: add test case to `getembedTheme` returning the theme from embedStore * test: add test to `getEmbedTheme` returning the theme from query params * Small refactor to reduce the time taken by tests and fix missing typings for embed functions on window * Fix weird test failure * Fix type import error caught by api.test.test --------- Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
window.getEmbedNamespacegetembedThemereturning the theme from embedStoregetEmbedThemereturning the theme from query paramsWhat does this PR do?
Adding tests to
getEmbedTheme,getEmbedNamespaceandisEmbedFixes #9086
/claim #9086
Type of change
How should this be tested?
It should be run via
yarn e2e:embed. Probably the automated pipelines will run these new tests.None of the tests added on this PR should break.