app-e2e-tests
Skill9 starsChanged 27 days agoMITView on GitHub
Author and run environment-aware Playwright e2e tests for this Fusebase project. Use when: 1. Adding or scaffolding e2e tests (fusebase scaffold --template e2e), 2. Converting a manually verified scenario into a Playwright spec, 3. Running the same test set against dev and prod environments, 4. Wiring test users/fixtures per environment.
- Reads credentials
In this repository119 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/fusebase-flow-always.mdcCursor rule
- .cursor/rules/fusebase-flow-implementation.mdcCursor rule
- .cursor/rules/fusebase-flow-security.mdcCursor rule
- .cursor/rules/fusebase-flow-specs.mdcCursor rule
- .cursor/rules/fusebase-flow-validation.mdcCursor rule
- api-explorationSkill
- app-api-contract-testingSkill
- app-backendSkill
- app-business-docsSkill
- app-dev-practicesSkill
- app-quality-patternsSkill
- app-routingSkill
- app-secretsSkill
- app-sidecarSkill
- app-ui-designSkill
- business-logic-guardianSkill
- client-vs-internalSkill
- code-reviewSkill
- comment-policySkill
- communicationSkill
- design-discovery-ideationSkill
- dev-debug-logsSkill
- documentation-budgetSkill
- file-uploadSkill
- find-wasted-codeSkill
- find-wasted-effortSkill
- fusebase-cliSkill
- fusebase-dashboardsSkill
- fusebase-flow-health-checkSkill
- fusebase-gateSkill
- fusebase-portal-specific-appsSkill
- git-history-diagnosticSkill
- git-workflowSkill
- handling-authentication-errorsSkill
- handoffSkill
- implementation-planningSkill
- invite-with-passwordSkill
- lightweight-laneSkill
- liveness-disciplineSkill
- managed-integrationsSkill
- mcp-gate-debugSkill
- module-size-disciplineSkill
- north-starSkill
- phase-auditSkill
- product-apps-decompositionSkill
- product-docs-firstSkill
- product-ownerSkill
- project-onboardingSkill
- release-deploy-reportingSkill
- remote-logsSkill
- repo-onboarding-context-mapSkill
- requirements-specificationSkill
- role-disciplineSkill
- security-permissions-reviewSkill
- skill-authoringSkill
- smoke-testingSkill
- task-delegationSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
When e2e is being added as part of an environment migration, first follow the local guide App Environment Migration Guide, then use this …
- Distinctive: line 16
When adding e2e to an existing project, first follow the local guide
- Very specific: line 60
Fixtures self-skip: Use the fixtureUser(env, key) + test.skip pattern (see examples/role-matrix.spec.ts) so specs stay runnable while …
- Distinctive: line 96
When the user (or QA) describes a manually verified scenario:
- Distinctive: line 101
Write one spec per behavior.
- Very specific: line 104
Prefer stable selectors: data-testid in app code (add them when missing) over text/CSS.
- Very specific: line 108
Run against dev first, then the prod-test env: FUSEBASE_ENV=dev npm test && FUSEBASE_ENV=prod-test npm test.
- Very specific: line 119
Keep protected environments on schedules/manual runs.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
App E2E tests (environment-aware)
One suite in tests/e2e/, same specs against every environment of the
project. Environments (fusebase env) supply everything varying between
stages: base URLs, org/app ids, test users.
When e2e is being added as part of an environment migration, first follow the local guide App Environment Migration Guide, then use this skill for the Playwright harness and CI details.
When adding e2e to an existing project, first follow the local guide E2E Playwright Setup Guide: audit environments, prefer non-prod targets, warn before any prod run, scaffold from the CLI template, and wire GitLab CI.
Scaffold
fusebase scaffold --template e2e --dir tests/e2e
cd tests/e2e && npx playwright install chromium
FUSEBASE_ENV=<env> npm testLayout — one project per app
playwright.config.ts generates one Playwright project per app in
fusebase.json (name = the app's key, falling back to subdomain), each
pinned to that app's env-effective URL. Specs live in:
specs/common/**— universal specs, run for EVERY app, app-aware viatest.info().project.name.specs/<appKey>/**— that app's own specs.
Adding an app: give it a short key in fusebase.json (e.g. probe),
mkdir specs/<key>, add specs, add the key to the CI matrix APP list. Run a
single app with --project=<appKey>.
Cross-app / portal flows (registration → access propagation across apps +
portal) span more than one app and have NO single baseURL — they do not
belong to any app's project. Put them in specs/integration/; the config
adds an integration project whose specs build each app's URL via
appBaseUrl(env, key). Add integration to the CI matrix APP list.
Recipes: examples/cross-app-access.spec.ts, examples/portal-access.spec.ts.
(Product-scoped magic links + one org = shared session across app subdomains,
which is exactly what these flows assert.)
Non-negotiables
- Stage guard stays.
specs/common/stage.spec.tsasserts each app's deployedfusebase-env.jsonmatches the target env AND app. Never delete it — a run against the wrong stage/app is worse than no run. - No hardcoded env data. Hosts, org/app ids, credentials come only from
helpers/env.ts(environments/<name>.json+.env.<name>) and the project'sbaseURL. A spec that embeds a URL or id silently breaks on another environment or app. - Fixtures self-skip. Use the
fixtureUser(env, key)+test.skippattern (seeexamples/role-matrix.spec.ts) so specs stay runnable while fixtures roll out per env. - Cleanup. Tests that create data must delete it — prod-test environments are real orgs.
- No secrets in git. Passwords via
PW_USER_<KEY>_PASSWORDin.env.<name>locally / CI variables in pipelines. Reports and traces are gitignored.
The first run after a deploy hits a cold backend
This suite runs against a cold backend (skill app-backend § Cold Starts). A
first-request timeout is therefore not flakiness — playwright.config.ts is already
sized for it; do not paper over it with retries or per-call timeout: overrides.
Before minting magic links: pin the app's access principals
createAppMagicLink appends a user principal to the app
(addToAccessPrincipals defaults to true). If the app's principal list was
EMPTY (platform default = "open for org roles"), that first append flips the
semantics to "ONLY the listed principals" — locking out the owner and
everyone else (Access Denied on /_auth/). Field incident, not a theory.
Fix/prevention: give the app explicit principals before the first magic-link test run, e.g.
fusebase app update <appId> --env <name> \
--access=orgRole:owner,orgRole:manager,orgRole:member,orgRole:client(add visitor for public envs). Fixture users keep access via
orgRole:client.
Converting a manual QA scenario into a spec
When the user (or QA) describes a manually verified scenario:
- Identify the role it runs under → fixture key (add the identity to
environments/<name>.jsonfixtures.testUsersif missing; ask the human to set the password secret — never invent or commit one). - Write one spec per behavior; assert role-differential outcomes: what this role must see AND what it must not (403/absence assertions catch the platform's fail-open regressions, which are the expensive ones).
- Prefer stable selectors:
data-testidin app code (add them when missing) over text/CSS. The env panel exposesfbs-env-panel*test ids. - On failure, surface triage data: response status + body and the
x-request-idheader in the assertion message where relevant. - Run against dev first, then the prod-test env:
FUSEBASE_ENV=dev npm test && FUSEBASE_ENV=prod-test npm test.
Reports / CI
reports/<env>.json is the machine-readable result per environment — the
contract for any CI is FUSEBASE_ENV=<env> npm test. Ready-made templates
ship in tests/e2e/ci/: gitlab-e2e.yml (copy the job into the root
.gitlab-ci.yml) and github-e2e.yml (copy to .github/workflows/e2e.yml).
CI has no dotenv files — the harness falls back to process env, plain or
env-suffixed (GATE_MCP_TOKEN_DEV, PW_USER_CLIENT_PASSWORD_PROD_TEST).
Keep protected environments on schedules/manual runs. Central publishing to
the platform registry is planned as fusebase test publish.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

