webui: Streamline playwright reporter config
diff --git a/webui/package.json b/webui/package.json
index ef77988..d046c6e 100644
--- a/webui/package.json
+++ b/webui/package.json
@@ -19,8 +19,7 @@
"gentypes": "go run ../cmd/go2ts -o src/types.ts",
"build": "go run ../cmd/go2ts -o src/types.ts && tsc",
"watch": "tsc --watch",
- "test": "tsc && CI=1 npm run test:playwright",
- "test:interactive": "tsc && npm run test:playwright",
+ "test": "tsc && npm run test:playwright",
"test:playwright": "playwright test -c playwright-ct.config.ts"
},
"dependencies": {
diff --git a/webui/playwright-ct.config.ts b/webui/playwright-ct.config.ts
index 0acbc5e..8f75fcd 100644
--- a/webui/playwright-ct.config.ts
+++ b/webui/playwright-ct.config.ts
@@ -1,4 +1,8 @@
-import { defineConfig, devices } from "@sand4rt/experimental-ct-web";
+import {
+ defineConfig,
+ devices,
+ PlaywrightTestConfig,
+} from "@sand4rt/experimental-ct-web";
/**
* See https://playwright.dev/docs/test-configuration.
@@ -18,7 +22,7 @@
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
- reporter: [["html", { open: process.env.CI ? "never" : "on-failure" }]],
+ reporter: getReporterConfig(),
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
@@ -44,3 +48,11 @@
// },
],
});
+
+function getReporterConfig(): PlaywrightTestConfig["reporter"] {
+ if (process.env.SKETCH) {
+ return [["junit"]];
+ }
+
+ return [["html", { open: "never" }]];
+}