write-e2e-test
GitHub指导编写、更新、调试和运行Baserow项目的端到端测试。基于Playwright框架,涵盖测试架构、 fixtures使用、定位器选择及执行规范,确保E2E测试质量与可维护性。
触发场景
安装
npx skills add baserow/baserow --skill write-e2e-test -g -y
SKILL.md
Frontmatter
{
"name": "write-e2e-test",
"description": "Write, update, debug, or run Baserow end-to-end tests in e2e-tests using Playwright, the repo's e2e fixtures, page objects, Docker stack, and just e2e commands."
}
Write Baserow E2E Tests
Use this skill when a task involves adding, fixing, reviewing, debugging, or
executing end-to-end tests in e2e-tests.
Canonical repo docs live in docs/development/e2e-testing.md. Read that file
again if commands or environment details may have changed.
First Step
Before editing, identify the user-facing flow and inspect the closest existing spec, fixture, and page object in the same area.
Useful searches:
find e2e-tests/tests -type f -name '*.spec.ts' | sortrg -n "test\\.describe|test\\(|test\\.before|@fast|@slow|@enterprise" e2e-tests/testsrg -n "class .*Page|async .*\\(" e2e-tests/pages e2e-tests/fixturesrg -n "getByRole|getByLabel|getByText|locator\\(" e2e-tests/tests e2e-tests/pages
Local Test Architecture
The suite uses Playwright with Nuxt test utilities:
- Specs live under
e2e-tests/tests/**. - Import
testandexpectfrome2e-tests/tests/baserowTest.tswhen the test should use the repo fixtures. - Reuse API fixtures from
e2e-tests/fixtures/**for setup instead of creating state through the UI when setup is not the behavior under test. - Reuse or add page objects in
e2e-tests/pages/**for repeated navigation or complex UI operations. - The Playwright config is
e2e-tests/playwright.config.ts; default projects arechromeandfirefox, withchromeused byyarn test.
Important fixture behavior:
workspacePagecreates a fresh user and workspace, authenticates, suppresses the cookie notice, closes the AI sidebar, and cleans up withremoveAll().builderPagePagecreates a builder and default page in that workspace.automationWorkflowPagecreates an automation and default workflow.- Staff-only setup can use
getStaffUser()frome2e-tests/fixtures/user.ts, which logs in ase2e@baserow.iofrom the e2e database dump.
Writing Tests
Prefer a focused test that proves one visible behavior or one integration boundary.
- Put the spec in the existing feature directory, for example
e2e-tests/tests/database/**,e2e-tests/tests/builder/**, ore2e-tests/tests/automation/**. - Use API fixtures for initial data and reserve UI steps for the behavior being tested.
- Use role, label, placeholder, and text locators when stable. Use CSS class locators when matching existing page objects or when the app has no better accessible hook.
- Wait with Playwright assertions such as
await expect(locator).toBeVisible(),toHaveText(),toHaveURL(), ortoHaveTitle()instead of fixed sleeps. - If multiple tests share expensive setup, follow nearby specs that use
beforeAllplus reset helpers, and use serial mode only when the shared state makes parallel execution unsafe. - For network-sensitive behavior, use
page.waitForResponse,page.waitForRequest, or existing helpers ine2e-tests/fixtures/network.ts.
Keep docs/testing/*-test-plan.md files in sync when editing a spec that is
explicitly mapped to a test plan, such as grid view tests.
Running Tests
Use root just e2e commands. They delegate to e2e-tests/justfile.
Full clean cycle:
just e2e run
Step-by-step:
just e2e build
just e2e up
just e2e test
Run a narrow target:
just e2e up
just e2e test tests/builder/builderPage.spec.ts
just e2e test tests/database/grid/
just e2e test --grep "login"
Debug:
just e2e up
just e2e test tests/path/to/spec.ts --headed
just e2e test tests/path/to/spec.ts --ui
just e2e test tests/path/to/spec.ts --trace on
just e2e logs
just e2e logs backend
just e2e logs frontend
just e2e logs celery
Important command behavior:
just e2e testrequires the e2e stack to already be running.just e2e testtears down the e2e containers when it exits, even for a narrow test.- The default e2e URLs are frontend
http://localhost:3070and backendhttp://localhost:8070. - Override ports with
E2E_FRONTEND_PORTandE2E_BACKEND_PORT, or set values ine2e-tests/.env. - If migrations changed and the dump is stale, run
just e2e db-dumpand commite2e-tests/fixtures/e2e-db.dump.
Guardrails
- Do not use the deprecated
e2e-tests/run-e2e-tests-locally.shworkflow unless the user explicitly asks to run against a manually managed dev environment. - Do not create broad UI journeys when a fixture plus focused UI assertion proves the behavior.
- Do not use arbitrary
waitForTimeoutin specs. Existing page objects may have narrow compatibility sleeps; avoid adding new ones unless there is no better observable condition. - Do not leave
test.onlyor debug-only traces/headed settings in committed specs. - Do not assume
page.title()is immediately updated after navigation. For asynchronous public/builder page titles, useawait expect(page).toHaveTitle(...). - Do not update non-English locale files while supporting an e2e test change.
版本历史
- 2.3.4 当前 2026-09-22 22:44


