cal/tests/config/playwright.config.ts

62 lines
1.7 KiB
TypeScript
Raw Normal View History

2022-05-11 00:51:24 -03:00
import { devices, PlaywrightTestConfig } from "@playwright/test";
import dotEnv from "dotenv";
2022-05-11 13:46:52 -03:00
import * as os from "os";
import * as path from "path";
dotEnv.config({ path: "../../.env" });
2022-05-14 00:02:10 -03:00
const outputDir = path.join(__dirname, "..", "..", "test-results");
const testDir = path.join(__dirname, "..", "..", "apps/web/playwright");
2022-05-12 11:16:27 -03:00
const DEFAULT_NAVIGATION_TIMEOUT = 15000;
2022-05-11 00:51:24 -03:00
2022-05-11 13:46:52 -03:00
const headless = !!process.env.CI || !!process.env.PLAYWRIGHT_HEADLESS;
const config: PlaywrightTestConfig = {
forbidOnly: !!process.env.CI,
retries: 1,
workers: headless ? os.cpus().length : 1,
timeout: 60_000,
2022-05-12 11:16:27 -03:00
maxFailures: headless ? 10 : undefined,
reporter: [
[process.env.CI ? "github" : "list"],
2022-05-18 13:54:36 -03:00
["html", { outputFolder: path.join(outputDir, "reports/playwright-html-report"), open: "never" }],
["junit", { outputFile: path.join(outputDir, "reports/results.xml") }],
],
globalSetup: require.resolve("./globalSetup"),
outputDir: path.join(outputDir, "results"),
webServer: {
command: "NEXT_PUBLIC_IS_E2E=1 yarn workspace @calcom/web start -p 3000",
port: 3000,
timeout: 60_000,
reuseExistingServer: !process.env.CI,
},
use: {
2022-05-11 13:46:52 -03:00
baseURL: "http://localhost:3000/",
locale: "en-US",
trace: "retain-on-failure",
2022-05-11 13:46:52 -03:00
headless,
},
projects: [
{
name: "chromium",
testDir,
2022-05-11 00:51:24 -03:00
use: {
...devices["Desktop Chrome"],
/** If navigation takes more than this, then something's wrong, let's fail fast. */
navigationTimeout: DEFAULT_NAVIGATION_TIMEOUT,
},
},
/* {
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},
{
name: "webkit",
use: { ...devices["Desktop Safari"] },
}, */
],
};
export default config;