rallly/apps/landing/playwright.config.ts
Luke Vella c22b3abc4d
⬆️ v3.0.0 (#704)
2023-06-19 17:17:00 +01:00

34 lines
1 KiB
TypeScript

import { devices, PlaywrightTestConfig } from "@playwright/test";
const ci = process.env.CI === "true";
// Use process.env.PORT by default and fallback to port 3000
const PORT = process.env.PORT || 3000;
// Set webServer.url and use.baseURL with the location of the WebServer respecting the correct set port
const baseURL = `http://localhost:${PORT}`;
// Reference: https://playwright.dev/docs/test-configuration
const config: PlaywrightTestConfig = {
// Artifacts folder where screenshots, videos, and traces are stored.
outputDir: "test-results/",
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
use: {
viewport: { width: 1280, height: 720 },
baseURL,
permissions: ["clipboard-read"],
trace: "retain-on-failure",
},
webServer: {
command: `NODE_ENV=test yarn dev --port ${PORT}`,
url: baseURL,
timeout: 120 * 1000,
reuseExistingServer: !ci,
},
reporter: [
[ci ? "github" : "list"],
["html", { open: !ci ? "on-failure" : "never" }],
],
workers: 1,
};
export default config;