mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-29 02:06:34 +02:00
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { devices, PlaywrightTestConfig } from "@playwright/test";
|
|
import dotenv from "dotenv";
|
|
import path from "path";
|
|
|
|
const ci = process.env.CI === "true";
|
|
|
|
dotenv.config({ path: path.resolve(__dirname, "../../", ".env.test") });
|
|
|
|
// 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,
|
|
},
|
|
expect: {
|
|
timeout: 10000, // 10 seconds
|
|
},
|
|
reporter: [
|
|
[ci ? "github" : "list"],
|
|
["html", { open: !ci ? "on-failure" : "never" }],
|
|
],
|
|
workers: 1,
|
|
};
|
|
export default config;
|