/ test / playwright / playwright.config.ts
playwright.config.ts
 1  /**
 2   * Copyright 2024 Defense Unicorns
 3   * SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial
 4   */
 5  
 6  import { defineConfig, devices } from "@playwright/test";
 7  
 8  export const playwrightDir = ".playwright";
 9  export const authFile = `${playwrightDir}/auth/user.json`;
10  
11  /**
12   * See https://playwright.dev/docs/test-configuration.
13   */
14  export default defineConfig({
15    fullyParallel: true,
16    forbidOnly: !!process.env.CI, // fail CI if you accidentally leave `test.only` in source
17    retries: 1,
18    workers: 20, // Support up to 20 parallel workers
19    timeout: 45000, // 45 second timeout for tests
20    reporter: [
21      // Reporter to use. See https://playwright.dev/docs/test-reporters
22      ["html", { outputFolder: `${playwrightDir}/reports`, open: "never" }],
23    ],
24  
25    outputDir: `${playwrightDir}/output`,
26  
27    // ignore running private pki tests from top level to avoid failures
28    testIgnore: ["**/private-pki/**"],
29  
30    use: {
31      trace: "retain-on-failure", // save trace for failed tests. See https://playwright.dev/docs/trace-viewer#opening-the-trace
32    },
33  
34    projects: [
35      { name: "setup", testMatch: /.*\.setup\.ts/ }, // authentication
36  
37      ...["Desktop Chrome"].map(p => ({
38        name: devices[p].defaultBrowserType,
39        dependencies: ["setup"],
40        use: {
41          ...devices[p],
42          storageState: authFile,
43        },
44      })),
45    ],
46  });