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.
fix: Support embedding org profile page (calcom#12116)
* support embedding org profile page * Add checkly tests * Fix test titles --------- Co-authored-by: Udit Takkar <[email protected]>
- Loading branch information
1 parent
31fc472
commit 9e3465e
Showing
7 changed files
with
1,010 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Checkly Tests | ||
|
||
Run as `yarn checkly test` | ||
Deploy the tests as `yarn checkly deploy` |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import type { Page } from "@playwright/test"; | ||
import { test, expect } from "@playwright/test"; | ||
|
||
test.describe("Org", () => { | ||
// Because these pages involve next.config.js rewrites, it's better to test them on production | ||
test.describe("Embeds - i.cal.com", () => { | ||
test("Org Profile Page should be embeddable", async ({ page }) => { | ||
const response = await page.goto("https://i.cal.com/embed"); | ||
expect(response?.status()).toBe(200); | ||
await page.screenshot({ path: "screenshot.jpg" }); | ||
await expectPageToBeServerSideRendered(page); | ||
}); | ||
|
||
test("Org User(Peer) Page should be embeddable", async ({ page }) => { | ||
const response = await page.goto("https://i.cal.com/peer/embed"); | ||
expect(response?.status()).toBe(200); | ||
await expect(page.locator("text=Peer Richelsen")).toBeVisible(); | ||
await expectPageToBeServerSideRendered(page); | ||
}); | ||
|
||
test("Org User Event(peer/meet) Page should be embeddable", async ({ page }) => { | ||
const response = await page.goto("https://i.cal.com/peer/meet/embed"); | ||
expect(response?.status()).toBe(200); | ||
await expect(page.locator('[data-testid="decrementMonth"]')).toBeVisible(); | ||
await expect(page.locator('[data-testid="incrementMonth"]')).toBeVisible(); | ||
await expectPageToBeServerSideRendered(page); | ||
}); | ||
|
||
test("Org Team Profile(/sales) page should be embeddable", async ({ page }) => { | ||
const response = await page.goto("https://i.cal.com/sales/embed"); | ||
expect(response?.status()).toBe(200); | ||
await expect(page.locator("text=Cal.com Sales")).toBeVisible(); | ||
await expectPageToBeServerSideRendered(page); | ||
}); | ||
|
||
test("Org Team Event page(/sales/hippa) should be embeddable", async ({ page }) => { | ||
const response = await page.goto("https://i.cal.com/sales/hipaa/embed"); | ||
expect(response?.status()).toBe(200); | ||
await expect(page.locator('[data-testid="decrementMonth"]')).toBeVisible(); | ||
await expect(page.locator('[data-testid="incrementMonth"]')).toBeVisible(); | ||
await expectPageToBeServerSideRendered(page); | ||
}); | ||
}); | ||
}); | ||
|
||
// This ensures that the route is actually mapped to a page that is using withEmbedSsr | ||
async function expectPageToBeServerSideRendered(page: Page) { | ||
expect( | ||
await page.evaluate(() => { | ||
return window.__NEXT_DATA__.props.pageProps.isEmbed; | ||
}) | ||
).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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import withEmbedSsr from "@lib/withEmbedSsr"; | ||
|
||
import { getServerSideProps as _getServerSideProps } from "./index"; | ||
|
||
export { default } from "./index"; | ||
|
||
export const getServerSideProps = withEmbedSsr(_getServerSideProps); |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { defineConfig } from "checkly"; | ||
|
||
/** | ||
* See https://www.checklyhq.com/docs/cli/project-structure/ | ||
*/ | ||
const config = defineConfig({ | ||
/* A human friendly name for your project */ | ||
projectName: "calcom-monorepo", | ||
/** A logical ID that needs to be unique across your Checkly account, | ||
* See https://www.checklyhq.com/docs/cli/constructs/ to learn more about logical IDs. | ||
*/ | ||
logicalId: "calcom-monorepo", | ||
/* An optional URL to your Git repo */ | ||
repoUrl: "https://github.com/checkly/checkly-cli", | ||
/* Sets default values for Checks */ | ||
checks: { | ||
/* A default for how often your Check should run in minutes */ | ||
frequency: 10, | ||
/* Checkly data centers to run your Checks as monitors */ | ||
locations: ["us-east-1", "eu-west-1"], | ||
/* An optional array of tags to organize your Checks */ | ||
tags: ["Web"], | ||
/** The Checkly Runtime identifier, determining npm packages and the Node.js version available at runtime. | ||
* See https://www.checklyhq.com/docs/cli/npm-packages/ | ||
*/ | ||
runtimeId: "2023.02", | ||
/* A glob pattern that matches the Checks inside your repo, see https://www.checklyhq.com/docs/cli/using-check-test-match/ */ | ||
checkMatch: "**/__checks__/**/*.check.ts", | ||
browserChecks: { | ||
/* A glob pattern matches any Playwright .spec.ts files and automagically creates a Browser Check. This way, you | ||
* can just write native Playwright code. See https://www.checklyhq.com/docs/cli/using-check-test-match/ | ||
* */ | ||
testMatch: "**/__checks__/**/*.spec.ts", | ||
}, | ||
}, | ||
cli: { | ||
/* The default datacenter location to use when running npx checkly test */ | ||
runLocation: "eu-west-1", | ||
/* An array of default reporters to use when a reporter is not specified with the "--reporter" flag */ | ||
reporters: ["list"], | ||
}, | ||
}); | ||
|
||
export default config; |
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
Oops, something went wrong.