Files
nextcloud-server-mirror/playwright.config.ts
skjnldsv 87bbfc5291 build: scope the tooling configs to the frontend each app belongs to
files_sharing is symlinked into the Vue 3 frontend for its bridge entry point,
which also handed its Vue 2 sources to that project's lint and test configs. The
Vue 3 lint config rejects the hyphenated event listeners Vue 2 requires, so
following it broke the share editor, and its Vitest project picked the Vue 2
specs up a second time. Exclude the app from both; the legacy frontend already
covers it with the rules that match the code.

Sharing specs also move to their own serial Playwright project: which sidebar
the sharing tab renders is instance-wide state, so the unified specs and the
share editor specs cannot run beside each other.

Finally, ignore the worker teardown error Vitest raises when a worker still has
console output in flight as it shuts down. It fails a run in which every test
passed, and which files trip it only depends on how they are spread over the
workers.

Signed-off-by: Barthelemy Briand <barthelemy.briand@nextcloud.com>
Assisted-by: ClaudeCode:claude-opus-4-8
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
2026-09-08 08:47:27 +02:00

97 lines
2.6 KiB
TypeScript

/*
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/// <reference types="@types/node" />
import { defineConfig, devices } from '@playwright/test'
type DeviceDescriptor = typeof devices[string]
const BROWSWER_CONFIG_CHROME: DeviceDescriptor & { channel: string } = {
...devices['Desktop Chrome'],
channel: process.env.CI
? 'chrome' // on CI use the chrome browser provided by the GitHub Actions runner
: 'chromium', // locally use the default playwright chromium browser
}
export default defineConfig({
testDir: './tests/playwright/e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: process.env.CI ? 1 : undefined,
timeout: process.env.CI ? 45_000 : undefined, // on CI allow 1.5x the default timeout to compensate for shared server resources
reporter: process.env.CI ? [['blob'], ['dot'], ['github']] : 'html',
use: {
baseURL: 'http://localhost:8042/index.php/',
trace: 'on-first-retry',
},
projects: [
{
// Installation-wizard tests. They un-install and re-install the shared
// server, so they must never run alongside other tests
name: 'setup',
fullyParallel: false,
workers: 1,
grep: /@setup/,
use: {
...BROWSWER_CONFIG_CHROME,
},
},
{
name: 'admin-settings',
fullyParallel: false,
workers: 1, // only one admin setting test can run at a time due to shared state
testMatch: '**/admin-settings*.spec.ts',
// The sharing ones belong to the serial `sharing` project below
testIgnore: '**/e2e/files_sharing/**',
use: {
...BROWSWER_CONFIG_CHROME,
},
},
{
// Sharing tests. Which sidebar the sharing tab renders is an
// instance-wide switch (`sharing.unified_api_enable`): the unified specs
// need it on, the share editor specs need it off, so none of them may
// run alongside another
name: 'sharing',
fullyParallel: false,
workers: 1,
testMatch: '**/e2e/files_sharing/**/*.spec.ts',
use: {
...BROWSWER_CONFIG_CHROME,
},
},
{
name: 'default',
testMatch: /\/(?!admin-settings)[^/]*\.spec\.ts$/,
testIgnore: '**/e2e/files_sharing/**',
grepInvert: /@setup/,
use: {
...BROWSWER_CONFIG_CHROME,
},
},
],
webServer: {
command: 'node tests/playwright/start-nextcloud-server.js',
env: {
NEXTCLOUD_PORT: '8042',
},
stderr: 'pipe',
stdout: 'pipe',
gracefulShutdown: {
signal: 'SIGTERM',
timeout: 10_000,
},
reuseExistingServer: !process.env.CI,
timeout: 300_000,
wait: {
stdout: /Nextcloud container ready to run Playwright tests/,
},
},
})