* Create env file workflow * Add env-cache * Fix env setter * Fix * Another fix * Fix * Fix * Fixes * FFS * Fix * Fix * Fix * Fix * Fix * Cache fixes * Fixes * Adds skipping steps * db-cache fixes * Test * Cache fixes * e2e * Possible caching conflicts * Running out of ideas * Caching is hard * One more time * cache-build not skipping * Fingers crossed * a * Test * Pls * Please * LFG * Build fix * fix * Whitespace!! * Zomars/cal 884 paid events not sending the link (#7318) * WIP * Sends correct emails for paid bookings * Update PaymentService.ts * Update webhook.ts * Update webhook.ts * Update settings back button redirect link (#7403) * fix(schedule): close on click #7143 * fix(EventSetupTab): validLocations length will always match validLocations length #7138 * fix(SettingsLayout): go back to right route #7379 * feat: get country code from ip geolocation (#6880) * feat: get coutnry code from ip geolocation Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * fix: create new api route for fetching code Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * chore: replace city with country Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * refactor: create hook for country Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> --------- Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * Team Workflows (#7038) Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> * Add destination calendar name to DestinationCalendarSelector (#6701) * Add destination calendar name * Type fix * Search through calendars only for destination calendar credential * Refactor get connected calendars * Clean up --------- Co-authored-by: zomars <zomars@me.com> * Update viewer.tsx (#7428) * Fix - add team members to emails (#7207) * On booking add team members & translation * Add team members to round robin create * Only update calendars on reschedule if there is a calendar reference * Send email on reschedules * Send team email on cancelled event * Add team members to calendar event description * Clean up * Convert other emails to organizer & teams * Type check fixes * More type fixes * Change organizer scheduled input to an object * early return updateCalendarEvent * Introduce team member type * Fix type errors * Put team members before attendees * Remove lodash cloneDeep * Update packages/core/EventManager.ts Co-authored-by: Omar López <zomars@me.com> * Remove booking select object * Revert "Remove booking select object" This reverts commit9f121ff4eb
. * Refactor email manager (#7270) Co-authored-by: zomars <zomars@me.com> * Type change * Remove conditional check for updateAllCalendarEvents --------- Co-authored-by: zomars <zomars@me.com> * Typefix * Updates webhook response * Update pr.yml * Update action.yml * Update action.yml * Update action.yml * Update action.yml * Update action.yml * Is this redundant? * Removed setup * Update action.yml * Update action.yml * Consolitades setup step * Revert "Consolitades setup step" This reverts commit5e8d1983cc
. * Fix? * One more time * Revert "One more time" This reverts commitfd8b559a13
. * Benchmarking buildjet * Update action.yml * Re-introduce setup * Adds embeds to missing pro cache * Lint fixes * Adds prettier ignore * Upgrades to yarn 3 * Updates lockfile * Reverts CI to ubuntu * Testing new yarn install * We cannot use immutable due to our private submodules * Adds CI skip * Fixes * Adds plugin * Forces local embed package * Moves eslint to root * Update yarn.lock * Playwright fixes * Embed test fixes * Splits embed react tests * Splits embed react tests * Removes install step to benchmark * Update playwright.config.ts * One playwright config for all * More test fixes * Update basic.e2e.ts * Added typescript as a global monorepo dev * Update to v18 * Update yarn.lock * Update env-create-file.yml * Update .github/workflows/pr.yml --------- Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> Co-authored-by: Esaú Morais <55207584+esau-morais@users.noreply.github.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
249 lines
7.7 KiB
TypeScript
249 lines
7.7 KiB
TypeScript
import type { Frame, PlaywrightTestConfig } from "@playwright/test";
|
|
import { devices, expect } from "@playwright/test";
|
|
import dotEnv from "dotenv";
|
|
import * as os from "os";
|
|
import * as path from "path";
|
|
|
|
dotEnv.config({ path: ".env" });
|
|
|
|
const outputDir = path.join(__dirname, "test-results");
|
|
|
|
// Dev Server on local can be slow to start up and process requests. So, keep timeouts really high on local, so that tests run reliably locally
|
|
|
|
// So, if not in CI, keep the timers high, if the test is stuck somewhere and there is unnecessary wait developer can see in browser that it's stuck
|
|
const DEFAULT_NAVIGATION_TIMEOUT = process.env.CI ? 15000 : 50000;
|
|
const DEFAULT_EXPECT_TIMEOUT = process.env.CI ? 10000 : 50000;
|
|
|
|
// Test Timeout can hit due to slow expect, slow navigation.
|
|
// So, it should me much higher than sum of expect and navigation timeouts as there can be many async expects and navigations in a single test
|
|
const DEFAULT_TEST_TIMEOUT = process.env.CI ? 60000 : 120000;
|
|
|
|
const headless = !!process.env.CI || !!process.env.PLAYWRIGHT_HEADLESS;
|
|
|
|
const IS_EMBED_TEST = process.argv.some((a) => a.startsWith("--project=@calcom/embed-core"));
|
|
const IS_EMBED_REACT_TEST = process.argv.some((a) => a.startsWith("--project=@calcom/embed-react"));
|
|
|
|
const webServer: PlaywrightTestConfig["webServer"] = [
|
|
{
|
|
command: "NEXT_PUBLIC_IS_E2E=1 yarn workspace @calcom/web start -p 3000",
|
|
port: 3000,
|
|
timeout: 60_000,
|
|
reuseExistingServer: !process.env.CI,
|
|
},
|
|
];
|
|
|
|
if (IS_EMBED_TEST) {
|
|
webServer.push({
|
|
command: "yarn workspace @calcom/embed-core dev",
|
|
port: 3100,
|
|
timeout: 60_000,
|
|
reuseExistingServer: !process.env.CI,
|
|
});
|
|
}
|
|
|
|
if (IS_EMBED_REACT_TEST) {
|
|
webServer.push({
|
|
command: "yarn workspace @calcom/embed-react dev",
|
|
port: 3101,
|
|
timeout: 60_000,
|
|
reuseExistingServer: !process.env.CI,
|
|
});
|
|
}
|
|
|
|
const config: PlaywrightTestConfig = {
|
|
forbidOnly: !!process.env.CI,
|
|
retries: 2,
|
|
workers: os.cpus().length,
|
|
timeout: DEFAULT_TEST_TIMEOUT,
|
|
maxFailures: headless ? 10 : undefined,
|
|
fullyParallel: true,
|
|
reporter: [
|
|
[process.env.CI ? "github" : "list"],
|
|
["@deploysentinel/playwright"],
|
|
["html", { outputFolder: "./test-results/reports/playwright-html-report", open: "never" }],
|
|
["junit", { outputFile: "./test-results/reports/results.xml" }],
|
|
],
|
|
outputDir: path.join(outputDir, "results"),
|
|
webServer,
|
|
use: {
|
|
baseURL: "http://localhost:3000/",
|
|
locale: "en-US",
|
|
trace: "retain-on-failure",
|
|
headless,
|
|
},
|
|
projects: [
|
|
{
|
|
name: "@calcom/web",
|
|
testDir: "./apps/web/playwright",
|
|
testMatch: /.*\.e2e\.tsx?/,
|
|
expect: {
|
|
timeout: DEFAULT_EXPECT_TIMEOUT,
|
|
},
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
/** If navigation takes more than this, then something's wrong, let's fail fast. */
|
|
navigationTimeout: DEFAULT_NAVIGATION_TIMEOUT,
|
|
},
|
|
},
|
|
{
|
|
name: "@calcom/app-store",
|
|
testDir: "./packages/app-store/",
|
|
testMatch: /.*\.e2e\.tsx?/,
|
|
expect: {
|
|
timeout: DEFAULT_EXPECT_TIMEOUT,
|
|
},
|
|
use: {
|
|
...devices["Desktop Chrome"],
|
|
/** If navigation takes more than this, then something's wrong, let's fail fast. */
|
|
navigationTimeout: DEFAULT_NAVIGATION_TIMEOUT,
|
|
},
|
|
},
|
|
{
|
|
name: "@calcom/embed-core",
|
|
testDir: "./packages/embeds/embed-core/",
|
|
testMatch: /.*\.(e2e|test)\.tsx?/,
|
|
use: { ...devices["Desktop Chrome"] },
|
|
},
|
|
{
|
|
name: "@calcom/embed-react",
|
|
testDir: "./packages/embeds/embed-react/",
|
|
testMatch: /.*\.(e2e|test)\.tsx?/,
|
|
use: { ...devices["Desktop Chrome"] },
|
|
},
|
|
{
|
|
name: "@calcom/embed-core--firefox",
|
|
testDir: "./packages/embeds/",
|
|
testMatch: /.*\.e2e\.tsx?/,
|
|
use: { ...devices["Desktop Firefox"] },
|
|
},
|
|
{
|
|
name: "@calcom/embed-core--webkit",
|
|
testDir: "./packages/embeds/",
|
|
testMatch: /.*\.e2e\.tsx?/,
|
|
use: { ...devices["Desktop Safari"] },
|
|
},
|
|
],
|
|
};
|
|
|
|
export type ExpectedUrlDetails = {
|
|
searchParams?: Record<string, string | string[]>;
|
|
pathname?: string;
|
|
origin?: string;
|
|
};
|
|
|
|
expect.extend({
|
|
async toBeEmbedCalLink(
|
|
iframe: Frame,
|
|
calNamespace: string,
|
|
//TODO: Move it to testUtil, so that it doesn't need to be passed
|
|
// eslint-disable-next-line
|
|
getActionFiredDetails: (a: { calNamespace: string; actionType: string }) => Promise<any>,
|
|
expectedUrlDetails: ExpectedUrlDetails = {}
|
|
) {
|
|
if (!iframe || !iframe.url) {
|
|
return {
|
|
pass: false,
|
|
message: () => `Expected to provide an iframe, got ${iframe}`,
|
|
};
|
|
}
|
|
|
|
const u = new URL(iframe.url());
|
|
const frameElement = await iframe.frameElement();
|
|
|
|
if (!(await frameElement.isVisible())) {
|
|
return {
|
|
pass: false,
|
|
message: () => `Expected iframe to be visible`,
|
|
};
|
|
}
|
|
const pathname = u.pathname;
|
|
const expectedPathname = expectedUrlDetails.pathname + "/embed";
|
|
if (expectedPathname && expectedPathname !== pathname) {
|
|
return {
|
|
pass: false,
|
|
message: () => `Expected pathname to be ${expectedPathname} but got ${pathname}`,
|
|
};
|
|
}
|
|
|
|
const origin = u.origin;
|
|
const expectedOrigin = expectedUrlDetails.origin;
|
|
if (expectedOrigin && expectedOrigin !== origin) {
|
|
return {
|
|
pass: false,
|
|
message: () => `Expected origin to be ${expectedOrigin} but got ${origin}`,
|
|
};
|
|
}
|
|
|
|
const searchParams = u.searchParams;
|
|
const expectedSearchParams = expectedUrlDetails.searchParams || {};
|
|
for (const [expectedKey, expectedValue] of Object.entries(expectedSearchParams)) {
|
|
const value = searchParams.get(expectedKey);
|
|
if (value !== expectedValue) {
|
|
return {
|
|
message: () => `${expectedKey} should have value ${expectedValue} but got value ${value}`,
|
|
pass: false,
|
|
};
|
|
}
|
|
}
|
|
let iframeReadyCheckInterval;
|
|
const iframeReadyEventDetail = await new Promise(async (resolve) => {
|
|
iframeReadyCheckInterval = setInterval(async () => {
|
|
const iframeReadyEventDetail = await getActionFiredDetails({
|
|
calNamespace,
|
|
actionType: "linkReady",
|
|
});
|
|
if (iframeReadyEventDetail) {
|
|
resolve(iframeReadyEventDetail);
|
|
}
|
|
}, 500);
|
|
});
|
|
|
|
clearInterval(iframeReadyCheckInterval);
|
|
|
|
//At this point we know that window.initialBodyVisibility would be set as DOM would already have been ready(because linkReady event can only fire after that)
|
|
const {
|
|
visibility: visibilityBefore,
|
|
background: backgroundBefore,
|
|
initialValuesSet,
|
|
} = await iframe.evaluate(() => {
|
|
return {
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
//@ts-ignore
|
|
visibility: window.initialBodyVisibility,
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
//@ts-ignore
|
|
background: window.initialBodyBackground,
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
//@ts-ignore
|
|
initialValuesSet: window.initialValuesSet,
|
|
};
|
|
});
|
|
expect(initialValuesSet).toBe(true);
|
|
expect(visibilityBefore).toBe("hidden");
|
|
expect(backgroundBefore).toBe("transparent");
|
|
|
|
const { visibility: visibilityAfter, background: backgroundAfter } = await iframe.evaluate(() => {
|
|
return {
|
|
visibility: document.body.style.visibility,
|
|
background: document.body.style.background,
|
|
};
|
|
});
|
|
|
|
expect(visibilityAfter).toBe("visible");
|
|
expect(backgroundAfter).toBe("transparent");
|
|
if (!iframeReadyEventDetail) {
|
|
return {
|
|
pass: false,
|
|
message: () => `Iframe not ready to communicate with parent`,
|
|
};
|
|
}
|
|
|
|
return {
|
|
pass: true,
|
|
message: () => `passed`,
|
|
};
|
|
},
|
|
});
|
|
|
|
export default config;
|