etherpad-lite/src/playwright.config.ts
John McLear cafd60aa21
test(playwright): un-skip ep_headings2 spec under WITH_PLUGINS (#7634)
Remove the FRONTEND_IGNORE entry that suppressed
ep_headings2/static/tests/frontend-new/specs/headings.spec.ts under
WITH_PLUGINS=1. The skip was added in #7628 while the keystroke-drop
flake (#7611) was still being chased; #7630 then identified the actual
root cause as ep_cursortrace's per-keystroke cursorPosition socket
spam saturating Firefox's input pipeline, removed ep_cursortrace
from the WITH_PLUGINS plugin set, and added waitForEditorReady() to
goToNewPad/goToPad. With both root causes addressed, this skip is
likely stale — the spec's own "Option select is changed when heading
is changed" test already uses insertText for the second-line typing,
so it should clear the same bar that #7630 cleared for ep_markdown
and ep_spellcheck (both now passing on develop).

Closes ether/etherpad#7626 if CI confirms — the issue's three plugin
specs (markdown, spellcheck, headings2) and timeslider_identity_changeset
are all addressed once this lands. If headings2 is still flaky after
this, FRONTEND_IGNORE comes back with a narrower comment about what
specifically still races.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 06:12:23 +01:00

109 lines
4 KiB
TypeScript

import {defineConfig, devices, test} from '@playwright/test';
export const defaultExpectTimeout = process.env.CI ? 20 * 1000 : 5000
export const defaultTestTimeout = 90 * 1000
// Mirror of how tests/backend/specs picks up plugin specs from
// `../node_modules/ep_*/static/tests/backend/specs/**`. Plugins that
// ship Playwright frontend tests at the conventional location below
// are discovered automatically when the plugin is installed alongside
// core. See doc/PLUGIN_FRONTEND_TESTS.md.
const CORE_SPECS = 'tests/frontend-new/specs/**/*.spec.ts';
const ADMIN_SPECS = 'tests/frontend-new/admin-spec/**/*.spec.ts';
const PLUGIN_SPECS = [
// Plugins installed via `pnpm add -w ep_*` (CI / dev workspace).
'../node_modules/ep_*/static/tests/frontend-new/specs/**/*.spec.ts',
// Plugins installed via the admin UI / live-plugin-manager land
// here instead of node_modules.
'plugin_packages/ep_*/static/tests/frontend-new/specs/**/*.spec.ts',
];
const FRONTEND_MATCH = [CORE_SPECS, ...PLUGIN_SPECS];
const FRONTEND_IGNORE: string[] = [];
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
// testDir is project-root for src/ so the testMatch globs reach both
// tests under src/tests/... and node_modules/ep_*/... above src/.
testDir: '.',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: process.env.CI ? [['github'], ['list']] : 'html',
expect: { timeout: defaultExpectTimeout },
timeout: defaultTestTimeout,
// Plugin-loaded suites are inherently flakier (slower pad boot,
// extra hooks racing) so give them a bigger retry cushion. Strict
// equality on '1' so WITH_PLUGINS=0 doesn't accidentally enable the
// with-plugins behaviour (any non-empty string is truthy in JS).
retries: process.env.CI ? (process.env.WITH_PLUGINS === '1' ? 5 : 2) : 0,
workers: 2,
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
baseURL: "localhost:9001",
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
video: 'on-first-retry',
},
/* Configure projects for major browsers */
projects: [
// Frontend / pad-editor specs (core + plugins).
{
name: 'chromium',
testMatch: FRONTEND_MATCH,
testIgnore: FRONTEND_IGNORE,
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
testMatch: FRONTEND_MATCH,
testIgnore: FRONTEND_IGNORE,
use: { ...devices['Desktop Firefox'] },
},
// Admin-UI specs are isolated from the regular frontend run so the
// existing test-admin script + frontend-admin-tests workflow keep
// their own scope (different fixtures, different server state).
{
name: 'chromium-admin',
testMatch: ADMIN_SPECS,
use: { ...devices['Desktop Chrome'] },
},
// Webkit dropped from CI — see https://github.com/ether/etherpad-lite/issues/XXXX
// Kept chromium and firefox as the supported browsers.
/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
});