Upgrades yarn v1 to v3. Improves CI times by 2x (#7738)
* 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 <[email protected]> * fix: create new api route for fetching code Signed-off-by: Udit Takkar <[email protected]> * chore: replace city with country Signed-off-by: Udit Takkar <[email protected]> * refactor: create hook for country Signed-off-by: Udit Takkar <[email protected]> --------- Signed-off-by: Udit Takkar <[email protected]> * Team Workflows (#7038) Co-authored-by: Hariom Balhara <[email protected]> Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: zomars <[email protected]> Co-authored-by: Peer Richelsen <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * Remove booking select object * Revert "Remove booking select object" This reverts commit 9f121ff4ebbaec9a0643111f96c5337b930ddd5b. * Refactor email manager (#7270) Co-authored-by: zomars <[email protected]> * Type change * Remove conditional check for updateAllCalendarEvents --------- Co-authored-by: zomars <[email protected]> * 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 commit 5e8d1983cc5ac309fa6875a2fee77aa6287b7151. * Fix? * One more time * Revert "One more time" This reverts commit fd8b559a135820567f40dbb47a4b4dfc2ef44755. * 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 <[email protected]> Co-authored-by: Esaú Morais <[email protected]> Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Carina Wollendorfer <[email protected]> Co-authored-by: Hariom Balhara <[email protected]> Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]>
This commit is contained in:
41 files changed
+41893
-29127
No files matched your search
@@ -43,8 +43,8 @@
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.31.2",
|
||||
"autoprefixer": "^10.4.12",
|
||||
"eslint": "^8.34.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"postcss": "^8.4.18",
|
||||
"tailwindcss": "^3.2.1",
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
async function globalSetup(/* config: FullConfig */) {}
|
||||
|
||||
export default globalSetup;
|
||||
@@ -1,204 +0,0 @@
|
||||
import type { PlaywrightTestConfig, Frame } from "@playwright/test";
|
||||
import { devices, expect } from "@playwright/test";
|
||||
import * as path from "path";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
require("dotenv").config({ path: "../../../../../.env" });
|
||||
|
||||
const outputDir = path.join("../results");
|
||||
const testDir = path.join("../tests");
|
||||
const quickMode = process.env.QUICK === "true";
|
||||
const CI = process.env.CI;
|
||||
const config: PlaywrightTestConfig = {
|
||||
forbidOnly: !!CI,
|
||||
retries: quickMode && !CI ? 0 : 1,
|
||||
workers: 1,
|
||||
timeout: 60_000,
|
||||
reporter: [
|
||||
[CI ? "github" : "list"],
|
||||
["@deploysentinel/playwright"],
|
||||
[
|
||||
"html",
|
||||
{ outputFolder: path.join(__dirname, "..", "reports", "playwright-html-report"), open: "never" },
|
||||
],
|
||||
["junit", { outputFile: path.join(__dirname, "..", "reports", "results.xml") }],
|
||||
],
|
||||
globalSetup: require.resolve("./globalSetup"),
|
||||
outputDir,
|
||||
expect: {
|
||||
toMatchSnapshot: {
|
||||
// Opacity transitions can cause small differences
|
||||
// Every month the rendered month changes failing the snapshot tests. So, increase the threshold to catch major bugs only.
|
||||
maxDiffPixelRatio: 0.1,
|
||||
},
|
||||
},
|
||||
webServer: {
|
||||
// Run servers in parallel as Playwright doesn't support two different webserver commands at the moment See https://github.com/microsoft/playwright/issues/8206
|
||||
command: "yarn run-p 'embed-dev' 'embed-web-start'",
|
||||
port: 3100,
|
||||
timeout: 60_000,
|
||||
reuseExistingServer: !CI,
|
||||
},
|
||||
use: {
|
||||
baseURL: "http://localhost:3100",
|
||||
locale: "en-US",
|
||||
trace: "retain-on-failure",
|
||||
headless: !!CI || !!process.env.PLAYWRIGHT_HEADLESS,
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
name: "chromium",
|
||||
testDir,
|
||||
use: { ...devices["Desktop Chrome"] },
|
||||
},
|
||||
quickMode
|
||||
? {}
|
||||
: {
|
||||
name: "firefox",
|
||||
testDir,
|
||||
use: { ...devices["Desktop Firefox"] },
|
||||
},
|
||||
quickMode
|
||||
? {}
|
||||
: {
|
||||
name: "webkit",
|
||||
testDir,
|
||||
use: { ...devices["Desktop Safari"] },
|
||||
},
|
||||
],
|
||||
};
|
||||
export type ExpectedUrlDetails = {
|
||||
searchParams?: Record<string, string | string[]>;
|
||||
pathname?: string;
|
||||
origin?: string;
|
||||
};
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace PlaywrightTest {
|
||||
//FIXME: how to restrict it to Frame only
|
||||
interface Matchers<R> {
|
||||
toBeEmbedCalLink(
|
||||
calNamespace: string,
|
||||
// eslint-disable-next-line
|
||||
getActionFiredDetails: (a: { calNamespace: string; actionType: string }) => Promise<any>,
|
||||
expectedUrlDetails?: ExpectedUrlDetails
|
||||
): Promise<R>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -1,85 +0,0 @@
|
||||
import { test as base, Page } from "@playwright/test";
|
||||
|
||||
export interface Fixtures {
|
||||
addEmbedListeners: (calNamespace: string) => Promise<void>;
|
||||
getActionFiredDetails: (a: { calNamespace: string; actionType: string }) => Promise<any>;
|
||||
}
|
||||
export const test = base.extend<Fixtures>({
|
||||
addEmbedListeners: async ({ page }: { page: Page }, use) => {
|
||||
await use(async (calNamespace: string) => {
|
||||
await page.addInitScript(
|
||||
({ calNamespace }: { calNamespace: string }) => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
//@ts-ignore
|
||||
window.eventsFiredStoreForPlaywright = window.eventsFiredStoreForPlaywright || {};
|
||||
document.addEventListener("DOMContentLoaded", function tryAddingListener() {
|
||||
if (parent !== window) {
|
||||
// Firefox seems to execute this snippet for iframe as well. Avoid that. It must be executed only for parent frame.
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
//@ts-ignore
|
||||
window.initialBodyVisibility = document.body.style.visibility;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
//@ts-ignore
|
||||
window.initialBodyBackground = document.body.style.background;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
//@ts-ignore
|
||||
window.initialValuesSet = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
//@ts-ignore
|
||||
let api = window.Cal;
|
||||
|
||||
if (!api) {
|
||||
setTimeout(tryAddingListener, 500);
|
||||
return;
|
||||
}
|
||||
if (calNamespace) {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
//@ts-ignore
|
||||
api = window.Cal.ns[calNamespace];
|
||||
}
|
||||
console.log("PlaywrightTest:", "Adding listener for __iframeReady");
|
||||
if (!api) {
|
||||
throw new Error(`namespace "${calNamespace}" not found`);
|
||||
}
|
||||
api("on", {
|
||||
action: "*",
|
||||
callback: (e: any) => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
window.iframeReady = true; // Technically if there are multiple cal embeds, it can be set due to some other iframe. But it works for now. Improve it when it doesn't work
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const store = window.eventsFiredStoreForPlaywright;
|
||||
const eventStore = (store[`${e.detail.type}-${e.detail.namespace}`] =
|
||||
store[`${e.detail.type}-${e.detail.namespace}`] || []);
|
||||
eventStore.push(e.detail);
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
{ calNamespace }
|
||||
);
|
||||
});
|
||||
},
|
||||
getActionFiredDetails: async ({ page }, use) => {
|
||||
await use(async ({ calNamespace, actionType }) => {
|
||||
if (!page.isClosed()) {
|
||||
return await page.evaluate(
|
||||
({ actionType, calNamespace }) => {
|
||||
//@ts-ignore
|
||||
return window.eventsFiredStoreForPlaywright[`${actionType}-${calNamespace}`];
|
||||
},
|
||||
{ actionType, calNamespace }
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -1,8 +1,9 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect } from "@playwright/test";
|
||||
|
||||
import type { Fixtures } from "../fixtures/fixtures";
|
||||
import { test } from "../fixtures/fixtures";
|
||||
import { test } from "@calcom/web/playwright/lib/fixtures";
|
||||
import type { Fixtures } from "@calcom/web/playwright/lib/fixtures";
|
||||
|
||||
import {
|
||||
todo,
|
||||
getEmbedIframe,
|
||||
|
||||
Reference in new issue
Block a user