Files
LocalAI/core/http/react-ui/playwright.config.js
T
Ettore Di Giacinto 958f584b36 test(ui): build the add-on bundles once for the whole run
Each worker built the Studio and Talk bundles into the same dist
directory, and the build empties that directory first. A worker that
started, or restarted after a failure, removed the files another worker
was serving, so a Studio spec saw "the style sheet of the add-on could
not be loaded". Build once in a global setup before the workers start.
A run without the setup still builds per worker.

Assisted-by: Claude Code:claude-sonnet-5-5 node
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2026-10-21 00:20:01 +00:00

52 lines
2.3 KiB
JavaScript

import { defineConfig } from '@playwright/test'
export default defineConfig({
testDir: './e2e',
// The add-on and Tables specs need a server with authentication, a real
// add-on owner and a ready file the matching runner passes in an ADDONS_*
// variable; each reads it when the file loads, so the default run must not
// load them. Every one has its own config (playwright.<suite>.config.js) and
// is started by scripts/addons/*.sh.
testIgnore: [
'**/addons-foundation.spec.js', '**/addons-gallery.spec.js', '**/addons-proposals.spec.js',
'**/addons-recovery.spec.js', '**/addons-runtime.spec.js', '**/addons-slots.spec.js',
'**/addons-upgrade.spec.js', '**/tables-acceptance.spec.js', '**/tables-artifacts.spec.js',
'**/tables-ui.spec.js',
],
globalSetup: './e2e/global-setup.js',
timeout: 30_000,
retries: process.env.CI ? 2 : 0,
// TEMPORARY: cap parallelism. Playwright's default (cores/2) oversubscribes
// high-core dev machines and intermittently starves the page-teardown
// coverage harvest past the 30s test timeout (flaky "Tearing down page"
// failures, different specs each run). Capped at 8 pending a proper
// root-cause fix; override with PW_WORKERS.
workers: process.env.PW_WORKERS ? Number(process.env.PW_WORKERS) : 8,
reporter: process.env.CI ? 'html' : 'list',
use: {
baseURL: 'http://127.0.0.1:8089',
trace: 'on-first-retry',
},
projects: [
{
name: 'chromium',
use: {
browserName: 'chromium',
// Use a nix-provided Chromium when PLAYWRIGHT_CHROMIUM_PATH is set
// (the flake dev shell exports it). Avoids Playwright's downloaded
// browser, which can't resolve system libs (libglib-2.0, …) on NixOS.
// Unset in CI, where `playwright install --with-deps` is used instead.
...(process.env.PLAYWRIGHT_CHROMIUM_PATH
? { launchOptions: { executablePath: process.env.PLAYWRIGHT_CHROMIUM_PATH } }
: {}),
},
},
],
webServer: process.env.PLAYWRIGHT_EXTERNAL_SERVER ? undefined : {
command: '../../../tests/e2e-ui/ui-test-server --mock-backend=../../../tests/e2e/mock-backend/mock-backend --port=8089 > /tmp/ui-test-server.log 2>&1',
port: 8089,
timeout: 120_000,
reuseExistingServer: !process.env.CI,
},
})