cesium/Specs/e2e/playwright.config.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

85 lines
1.8 KiB
JavaScript
Raw Permalink Normal View History

2023-06-12 23:46:09 +08:00
import { defineConfig, devices } from "@playwright/test";
import yargs from "yargs";
const argv = yargs(process.argv).options({
"update-snapshots": {
alias: "u",
description: "Update test snapshots.",
type: "boolean",
default: false,
},
}).argv;
const baseUrl = `http://localhost:3000`;
const updateSnapshots = argv["update-snapshots"];
let reporter = "line";
if (!process.env.CI) {
reporter = [
["html", { open: "never", outputFolder: "../../Build/Specs/e2e/report" }],
["list"],
];
}
2023-06-15 02:11:34 +08:00
const defaultViewport = { width: 960, height: 540 };
2023-06-12 23:46:09 +08:00
/**
* @see https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
testDir: ".",
outputDir: "../../Build/Specs/e2e/artifacts",
forbidOnly: !!process.env.CI,
2023-06-17 01:42:25 +08:00
retries: updateSnapshots ? 0 : 1,
2023-07-01 04:52:26 +08:00
fullyParallel: false,
workers: 1,
2023-06-12 23:46:09 +08:00
reporter: reporter,
use: {
baseURL: baseUrl,
trace: "on-first-retry",
2023-06-15 02:11:34 +08:00
viewport: defaultViewport,
2023-06-12 23:46:09 +08:00
},
expect: {
timeout: 10000,
toHaveScreenshot: {
2023-07-14 22:36:01 +08:00
threshold: 0.25,
2023-06-12 23:46:09 +08:00
maxDiffPixelRatio: 0.02,
},
},
updateSnapshots: updateSnapshots ? "all" : "missing",
projects: [
{
name: "chromium",
2024-03-28 04:34:21 +08:00
use: {
...devices["Desktop Chrome"],
viewport: defaultViewport,
launchOptions: {
// this forces chrome to use the gpu for webgl which greatly speeds up tests
args: ["--use-angle=gl"],
},
},
2023-06-12 23:46:09 +08:00
},
{
name: "firefox",
use: {
...devices["Desktop Firefox"],
2023-06-15 02:11:34 +08:00
viewport: defaultViewport,
2023-06-12 23:46:09 +08:00
},
},
{
name: "webkit",
use: {
...devices["Desktop Safari"],
2023-06-15 02:11:34 +08:00
viewport: defaultViewport,
2023-06-12 23:46:09 +08:00
},
},
],
webServer: {
command: "npm run start -- --production --port 3000",
url: baseUrl,
reuseExistingServer: false,
},
});