docs/solutions/test-failures/2026-05-23-playwright-reuses-stale-existing-server.md
Slate v2 Playwright tests default to reuseExistingServer locally. If a server
is already running on the configured port, tests can exercise stale built output
instead of the source just edited.
For source edits that affect rendered examples, build the static site and run Playwright against a fresh server on a separate port:
cd .tmp/slate-v2
bun build:next
PORT=3111 bun serve:playwright
PLAYWRIGHT_BASE_URL=http://localhost:3111 PLAYWRIGHT_RETRIES=0 \
bunx playwright test playwright/integration/examples/tables.test.ts \
--project=chromium --workers=1
When a test needs the current example text, derive it from the rendered page:
const trailingParagraph =
(await editor.root.locator('p').last().textContent()) ?? ''
PLAYWRIGHT_BASE_URL disables the Playwright config's managed web server and
points tests at the fresh server. Using a separate port avoids killing the
developer server the user may be using. Deriving text from the page prevents
source/test string duplication from becoming a false failure.