import { defineConfig, devices } from "@playwright/test"; import { reservePort, TEST_PORT_VARIABLES, testRunPath, } from "./scripts/lib/run-isolation.ts"; import { storybookStaticServer } from "./scripts/lib/storybook-static.ts"; // 1105/12-04. Under TEST_RUN_ID the workshop build (storybookStaticServer), // the results and the report are the run's own. The static server listens on // a free port (TEST_STORYBOOK_PORT pins one). const port = await reservePort(TEST_PORT_VARIABLES.storybook); const origin = `http://127.0.0.1:${port}`; export default defineConfig({ testDir: "./tests/storybook", forbidOnly: true, outputDir: testRunPath("artifacts/tests/storybook/results"), reporter: [ ["list"], [ "html", { outputFolder: testRunPath("artifacts/tests/storybook/report"), open: "never", }, ], [ "junit", { outputFile: testRunPath("artifacts/tests/storybook/results.xml") }, ], ], use: { baseURL: origin, trace: "retain-on-failure", screenshot: "only-on-failure", }, webServer: { command: storybookStaticServer(port).command, url: origin, reuseExistingServer: false, }, projects: [ { name: "chromium-workshop", use: { ...devices["Desktop Chrome"] } }, ], });