64 lines
1.6 KiB
TypeScript
64 lines
1.6 KiB
TypeScript
import { defineConfig } from "@playwright/test";
|
|
|
|
const port = Number(process.env.UI_TEST_PORT || 3107);
|
|
if (!Number.isInteger(port) || port < 1024 || port > 65535)
|
|
throw Error("Invalid UI_TEST_PORT");
|
|
const baseURL = `http://127.0.0.1:${port}`;
|
|
export default defineConfig({
|
|
testDir: "./e2e/ui",
|
|
testMatch: "**/*.spec.ts",
|
|
fullyParallel: false,
|
|
workers: 1,
|
|
retries: process.env.CI ? 1 : 0,
|
|
timeout: 45000,
|
|
expect: {
|
|
timeout: 10000,
|
|
toHaveScreenshot: {
|
|
animations: "disabled",
|
|
caret: "hide",
|
|
maxDiffPixelRatio: 0.002,
|
|
},
|
|
},
|
|
snapshotPathTemplate: `{testDir}/__screenshots__/${process.platform}/{projectName}/{testFilePath}/{arg}{ext}`,
|
|
reporter: [
|
|
["list"],
|
|
["html", { outputFolder: "playwright-report/ui", open: "never" }],
|
|
],
|
|
outputDir: "test-results/ui",
|
|
use: {
|
|
baseURL,
|
|
locale: "en-US",
|
|
timezoneId: "UTC",
|
|
colorScheme: "dark",
|
|
contextOptions: { reducedMotion: "reduce" },
|
|
trace: "retain-on-failure",
|
|
screenshot: "only-on-failure",
|
|
launchOptions: process.env.UI_TEST_BROWSER_PATH
|
|
? { executablePath: process.env.UI_TEST_BROWSER_PATH }
|
|
: {},
|
|
},
|
|
projects: [
|
|
{
|
|
name: "desktop",
|
|
use: { browserName: "chromium", viewport: { width: 1280, height: 900 } },
|
|
},
|
|
{
|
|
name: "mobile",
|
|
use: {
|
|
browserName: "chromium",
|
|
viewport: { width: 390, height: 844 },
|
|
isMobile: true,
|
|
deviceScaleFactor: 1,
|
|
hasTouch: true,
|
|
},
|
|
},
|
|
],
|
|
webServer: {
|
|
command: "node e2e/ui/fixture-server.mjs",
|
|
url: `${baseURL}/health`,
|
|
timeout: 60000,
|
|
reuseExistingServer: false,
|
|
env: { UI_TEST_PORT: String(port) },
|
|
},
|
|
});
|