e2e-test
Skill8.6k starsChanged 2 months agoApache-2.0View on GitHub
Write, run, debug, and auto-update Playwright E2E tests following Bifrost's established patterns and conventions. Automatically detects UI changes and updates affected tests. When invoked with sync, or when UI changes are detected, automatically update E2E tests: Detect UI changes by checking git diff against the base branch: Categorize changes into: - data-testid changes - Renamed, removed, or added test IDs - Route/URL changes - Modified page routes or navigation paths - Component structure changes - New/removed form fields, buttons, tables,…
9 other projects use a version of this.
Trending
Quiet since October.about the whole repository
Most recently taken up by
- nwiizo/tfmcptheir own version, first seen Oct 2, 2026
- sherparc/Sherpatheir own version, first seen Sep 19, 2026
- korya/swd-skillstheir own version, first seen Sep 9, 2026
- liaohch3/claude-taptheir own version, first seen Aug 25, 2026
- addisonk/skillstheir own version, first seen Aug 5, 2026
- hideki5123/agent-skill-settheir own version, first seen Jul 9, 2026
Who's talking about maximhq/bifrost
- @ponceto91.bsky.social“permettant d'unifier l'accès à plusieurs fournisseurs avec une API compatible OpenAI ⬇️ …”Bluesky · Jan 25, 2026 · 26 likes
- A Hacker News story“Bitfrost – LLM gateway 90x faster than Litellm at p99”Hacker News · Aug 7, 2025 · 8 points
- A Hacker News story“50× faster than LiteLLM: Bifrost is a Go-based LLM gateway built for scale.”Hacker News · Dec 8, 2025 · 5 points
- A Hacker News story“I Found One Interesting Open Source GitHub Gem”Hacker News · Sep 16, 2026 · 3 points
- A Hacker News story“Show HN: Changed how I use agent harnesses”Hacker News · Aug 3, 2026 · 3 points
The biggest 5 of 54 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 54
Talked about on GitHub, Hacker News and Bluesky (54 times).
On GitHub · 35
- Jul 22, 2026feat: dispatch binding tiers — post-merge audit + production wiring 5/5 + real Bifrost SDK — KooshaPari/OmniRoute2 reactions · 7 comments
- Oct 5, 2026deps: Bump the "all-dependencies" group with 1 update across multiple ecosystems — cynative/cynative1 reaction · 2 comments
- Sep 30, 2026Add verified Bifrost CLI 0.10.6 to Zeus — rcamarda390/my-docker-images1 reaction
- Sep 17, 2026chore(main): release 1.12.2 — cynative/cynative1 reaction · 2 comments
- Sep 16, 2026[Bug] openai_compatible 渠道的 Responses→Chat 转换会静默丢弃工具调用(同 chunk 并行调用只剩第一个 / 无 id 的调用整块丢失) — tbphp/gpt-load1 reaction · 1 comment
30 more on GitHub
- Sep 15, 2026deps: Bump the "all-dependencies" group with 2 updates across multiple ecosystems — cynative/cynative1 reaction · 2 comments
- Sep 11, 2026deps: Bump the "all-dependencies" group with 1 update across multiple ecosystems — cynative/cynative1 reaction · 2 comments
- Sep 7, 2026Assistant: support for OpenCode Go provider — posit-dev/positron1 reaction · 3 comments
- Sep 7, 2026Bifrost Gemini chat completions drops inlineData image/audio parts — Atharva-Kanherkar/kairo1 reaction
- Sep 3, 2026chore(deps): remediate PROD-5181 non-critical findings — pluralsh/console1 reaction · 5 comments
- Sep 3, 2026chore(deps): remediate PROD-5181 dependencies — pluralsh/console1 reaction · 5 comments
- Sep 3, 2026fix(deps): remediate Nexus and agent image CVEs — pluralsh/console1 reaction · 3 comments
- Sep 3, 2026feat(search): add Search1API as a search provider — BerriAI/litellm1 reaction · 7 comments
- Sep 2, 2026fix(nexus): remediate Go dependency vulnerabilities — pluralsh/console1 reaction · 3 comments
- Sep 1, 2026fix(nexus): remediate Bifrost and x/crypto vulnerabilities — pluralsh/console1 reaction · 3 comments
- Aug 31, 2026deps: Bump the "all-dependencies" group with 2 updates across multiple ecosystems — cynative/cynative1 reaction · 1 comment
- Aug 28, 2026chore(main): release 1.10.2 — cynative/cynative1 reaction · 1 comment
- Aug 25, 2026docs: add Bifrost to Deployment and observability — owainlewis/awesome-artificial-intelligence1 reaction · 3 comments
- Aug 24, 2026deps: Bump the "all-dependencies" group with 2 updates across multiple ecosystems — cynative/cynative1 reaction
- Aug 21, 2026deps: Bump the "all-dependencies" group with 1 update across multiple ecosystems — cynative/cynative1 reaction · 3 comments
- Aug 19, 2026chore(main): release 1.10.0 — cynative/cynative1 reaction · 1 comment
- Aug 18, 2026chore(main): release 1.9.4 — cynative/cynative1 reaction · 1 comment
- Aug 17, 2026deps: Bump the "all-dependencies" group with 1 update across multiple ecosystems — cynative/cynative1 reaction
- Aug 17, 2026deps: Bump the "all-dependencies" group with 2 updates across multiple ecosystems — cynative/cynative1 reaction
- Aug 14, 2026chore(main): release 1.9.3 — cynative/cynative1 reaction · 1 comment
- Aug 14, 2026deps: Bump the "all-dependencies" group with 1 update across multiple ecosystems — cynative/cynative1 reaction
- Aug 10, 2026deps: Bump the "all-dependencies" group with 1 update across multiple ecosystems — cynative/cynative1 reaction
- Jul 30, 2026deps: Bump the "all-dependencies" group with 2 updates across multiple ecosystems — cynative/cynative1 reaction
- Jul 29, 2026chore(main): release 1.9.0 — cynative/cynative1 reaction · 1 comment
- Jul 27, 2026deps: Bump the "all-dependencies" group with 1 update across multiple ecosystems — cynative/cynative1 reaction
- Jul 18, 2026fix(argis): restore full Go suite after Bifrost schema/API drift — KooshaPari/OmniRoute1 reaction · 2 comments
- Jul 9, 2026Enterprise-grade audit: docs, prompts, examples — luminik-io/alfred1 reaction · 4 comments
- Apr 30, 2026MM-68606: Support Claude Opus 4.7 — mattermost/mattermost-plugin-agents1 reaction · 2 comments
- Mar 5, 2026Add structured output support and update bifrost to v1.4.6 — mattermost/mattermost-plugin-agents1 reaction · 4 comments
- Feb 2, 2026[Feature] - Support Bifrost — kaitranntt/ccs1 reaction · 2 comments
On Hacker News · 15
- Aug 7, 2025Bitfrost – LLM gateway 90x faster than Litellm at p99says it tested it8 points · 1 comment
- Dec 8, 202550× faster than LiteLLM: Bifrost is a Go-based LLM gateway built for scale.5 points
- Sep 16, 2026I Found One Interesting Open Source GitHub Gem3 points
- Aug 3, 2026Show HN: Changed how I use agent harnesses3 points
- Dec 9, 2025Show HN: Bifrost – open-source LLM Gateway (50x lower latency than LiteLLM)3 points
10 more on Hacker News
- Aug 7, 2026Show HN: A model router should also provide a MCP gateway2 points
- Jul 2, 2026Show HN: Fastest Enterprise AI Gateway2 points
- Jan 30, 2026Show HN: Fastest LLM gateway (50x faster than LiteLLM)says it tested it2 points
- Dec 10, 2025Every LLM gateway we tested failed at scale – ended up building Bifrostsays it tested it2 points · 1 comment
- Aug 11, 2026The worst part of using multiple LLM providers is not the API differences1 point
- Aug 10, 2026I thought an LLM gateway was unnecessary. Then we added a second model provider1 point · 1 comment
- Aug 5, 2026Show HN: Bifrost: Enterprise MCP Gateway with Built-In Security: OAuth 2.0, RBAC1 point
- Aug 3, 2026Is Hermes Agent unusable without a model router?1 point · 1 comment
- Mar 19, 2026Bifrost CLI and Codex CLI: One Command to Set Up OpenAI Agent with Any Model1 point
- Feb 13, 2026Show HN: Bifrost: Fastest enterprise AI gateway1 point
On Bluesky · 4
- Jan 25, 2026permettant d'unifier l'accès à plusieurs fournisseurs avec une API compatible OpenAI ⬇️ github.com/maximhq/bifr... — @ponceto91.bsky.social26 likes and reposts
- Oct 29, 2025https://github.com/maximhq/bifrost/ — @tom-doerr.bsky.social1 likes and repost
- Jun 11, 2025An open-source middleware that serves as a unified gateway to various AI model providers, enabling seamless integration and fallback… — @golangch.bsky.social1 likes and repost
- Jun 8, 2025Bifrost seems interesting at least. An LLM proxy that claims to be 40x faster than LiteLLM, production oriented (ie handling high… — @pedromadruga.comsays it tested it1 likes and repost
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- liaohch3/claude-tap★ 3.3ksame name
- nwiizo/tfmcp★ 373same name
- fimoklei/pm-ai-playbook★ 42same name
- DongDuong2001/pudo-code-system★ 5same name
- hideki5123/agent-skill-set★ 2same name
- korya/swd-skills★ 2same name
- sherparc/Sherpa★ 2same name
- addisonk/skills★ 1same name
- ijufumi/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- add-pricing-fieldSkill
- api-validatorSkill
- changelog-writerSkill
- docs-writerSkill
- harness-test-writerSkill
- helm-updateSkill
- investigate-issueSkill
- release-checklistSkill
- resolve-pr-commentsSkill
- resolve-pr-comments-stackSkill
- review-prSkill
- security-auditSkill
- split-commit-into-stackSkill
- stack-absorbSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
84 rules. 0 are common, 35 are distinctive, and 49 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
35
Distinctive
This author's own choices. Worth a look.
49
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Write, run, debug, and auto-update Playwright E2E tests following Bifrost's established patterns and conventions.
- Distinctive: line 27
Understand the feature: - Read the UI code to understand what needs testing
- Distinctive: line 30
Write/update tests: - Follow the established patterns (page objects, data factories, fixtures)
- Very specific: line 36
When invoked with sync, or when UI changes are detected, automatically update E2E tests:
- Very specific: line 80
Search the old testid across all test files: grep -r 'old-testid' tests/e2e/
- Distinctive: line 81
Update every reference in page objects, selectors, and spec files
- Distinctive: line 82
If a testid was removed without replacement, check if the element still exists with a different selector and add a new testid to the UI
- Distinctive: line 85
If a new form field was added to a create/edit form:
- Very specific: line 86
Add the field to the page object's interface (e.g., FeatureConfig)
- Distinctive: line 87
Add a locator for the field in the page object constructor
- Very specific: line 88
Update the createFeature() / editFeature() methods to fill the field
- Distinctive: line 89
Update the data factory to include the new field with a default value
- Distinctive: line 90
Add a test case that exercises the new field
- Distinctive: line 91
If a form field was removed:
- Distinctive: line 92
Remove it from the interface, locators, and methods
- Distinctive: line 93
Remove or update test cases that depended on it
- Distinctive: line 96
Add locators to the page object
- Distinctive: line 97
Add methods to interact with the new action
- Distinctive: line 98
Add test cases covering the new action
- Very specific: line 101
Update goto() methods in page objects
- Very specific: line 102
Update navigation helpers in core/actions/navigation.ts
- Distinctive: line 103
Update any hardcoded URLs in test specs
- Very specific: line 107
Update any waitForResponse() URL patterns in page objects
- Distinctive: line 110
Create the full test structure (page object, data factory, spec, fixture registration)
- Distinctive: line 111
Follow Step 3 from the main workflow
- Distinctive: line 115
After making changes, run the affected tests to verify:
- Distinctive: line 151
ALWAYS: check for and sync E2E tests when ANY of these happen:
- Very specific: line 182
If a specific feature is given, read only that feature's spec, page object, and data files.
- Distinctive: line 203
Check each spec file for these anti-patterns (ordered by severity):
- Distinctive: line 240
Fix: After create, open/view the item and verify its fields match what was submitted.
- Distinctive: line 288
Fix: Remove the catch/conditional and make the assertion unconditional.
- Distinctive: line 293
If the state genuinely depends on external factors, use count-based branching with both branches making meaningful assertions:
- Distinctive: line 317
Fix: Add assertions verifying the action's observable effect:
- Distinctive: line 341
Fix: Wait for the state change to complete before asserting:
- Distinctive: line 369
Behavior matches: - If the UI shows a confirmation dialog on delete, does the test handle it?
- Very specific: line 438
All E2E tests live in tests/e2e/:
- Distinctive: line 467
Before writing tests, read the relevant UI code to understand:
- Distinctive: line 488
Always review existing patterns before writing new tests:
- Very specific: line 510
Use data-testid attributes as the primary selector strategy
- Very specific: line 511
Use page.getByRole() as a secondary strategy
- Very specific: line 512
NEVER use brittle CSS selectors or chained parent locators (.locator('..'))
- Very specific: line 624
Use Date.now() for unique test names
- Distinctive: line 627
Create sample constant objects for reusable configurations
- Very specific: line 654
Import test and expect from ../../core/fixtures/base.fixture
- Very specific: line 656
Use test.describe() blocks for logical grouping
- Very specific: line 657
Use test.beforeEach() to navigate to the page
- Very specific: line 658
Use test.afterEach() to clean up resources
- Very specific: line 659
Use unique names with Date.now() for test data
- Very specific: line 660
Write deterministic assertions (never expect(count >= 0).toBe(true))
- Very specific: line 661
Use test.describe.configure({ mode: 'serial' }) when tests have write ordering dependencies
- Very specific: line 720
If creating a brand new feature, add it to core/fixtures/base.fixture.ts:
- Distinctive: line 722
Import the page class
- Very specific: line 723
Add to BifrostFixtures type
- Very specific: line 794
Check if the data-testid attribute exists in the UI component
- Very specific: line 795
Verify the page has loaded: add await waitForNetworkIdle(page) after navigation
- Very specific: line 796
Check for loading spinners: await page.locator('[data-testid="loading-spinner"]').waitFor({ state: 'hidden' })
- Very specific: line 802
Wait for animation: await page.waitForSheetAnimation()
- Very specific: line 803
Wait for sheet visibility: await expect(sheet).toBeVisible()
- Very specific: line 807
Use polling patterns like waitForVirtualKeyGone() for eventual consistency
- Very specific: line 810
Check cleanup: ensure afterEach deletes all created resources
- Very specific: line 811
Use unique names with Date.now() timestamps
- Distinctive: line 812
Check for state pollution between test files
- Very specific: line 815
Use the fillSelect() helper from core/utils/test-helpers.ts
- Very specific: line 816
Wait for [role="listbox"] to appear before clicking options
- Very specific: line 817
Wait for [role="listbox"] to disappear after selection
- Very specific: line 843
ALWAYS: use data-testid attributes as the primary selector strategy
- Very specific: line 844
ALWAYS: use page.getByTestId() or page.getByRole() - never raw CSS selectors for interactive elements
- Very specific: line 845
NEVER: use chained parent locators (.locator('..'))
- Very specific: line 846
NEVER: use { force: true } on clicks - fix the underlying visibility issue instead
- Very specific: line 847
If a needed data-testid doesn't exist in the UI, add it to the UI component first
- Very specific: line 850
ALWAYS: use semantic waits (waitFor(), expect().toBeVisible(), waitForLoadState())
- Very specific: line 851
NEVER: use page.waitForTimeout() except as last resort in cleanup/polling (and document why)
- Very specific: line 852
ALWAYS: wait for page load after navigation: await waitForNetworkIdle(page)
- Distinctive: line 853
ALWAYS: wait for sheet animations before interacting with sheet contents
- Very specific: line 856
ALWAYS: use Date.now() or TestDataFactory.uniqueId() for unique test names
- Distinctive: line 857
NEVER: use static/hardcoded test data names (causes collisions in parallel runs)
- Very specific: line 858
ALWAYS: create test data factory functions in <feature>.data.ts
- Distinctive: line 867
ALWAYS: write deterministic assertions that can actually fail
- Very specific: line 868
NEVER: write expect(count >= 0).toBe(true) - this always passes
- Distinctive: line 869
Use count-based branching for state-dependent assertions:
- Very specific: line 879
ALWAYS: import test and expect from ../../core/fixtures/base.fixture
- Very specific: line 880
NEVER: import directly from @playwright/test in spec files (use the custom fixture)
- Very specific: line 884
When a UI component is missing a required data-testid, add it directly.
- Very specific: line 900
Every page object inherits these from BasePage (core/pages/base.page.ts):
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
name: e2e-test description: Write, run, debug, audit, and auto-update Playwright E2E tests for the Bifrost UI. Use when asked to create new E2E tests, add test coverage, fix flaky tests, debug failing tests, audit test correctness, update tests after UI changes, or sync tests with modified components. Invoked with /e2e-test <FEATURE_NAME>, /e2e-test fix <SPEC_FILE>, /e2e-test sync, or /e2e-test audit. allowed-tools: Read, Grep, Glob, Bash, Edit, Write, Task, AskUserQuestion, TodoWrite
Playwright E2E Testing
Write, run, debug, and auto-update Playwright E2E tests following Bifrost's established patterns and conventions. Automatically detects UI changes and updates affected tests.
Usage
/e2e-test <FEATURE_NAME> # Create or update tests for a feature
/e2e-test fix <SPEC_FILE> # Debug and fix a failing test
/e2e-test run <FEATURE_NAME> # Run tests for a specific feature
/e2e-test run # Run all E2E tests
/e2e-test sync # Detect UI changes and update affected tests
/e2e-test sync <FEATURE_NAME> # Sync tests for a specific feature with UI changes
/e2e-test audit # Audit all specs for incorrect/weak assertions
/e2e-test audit <FEATURE_NAME> # Audit a specific feature's specsWorkflow Overview
- Understand the feature - Read the UI code to understand what needs testing
- Check existing tests - Review existing test patterns for the feature or similar features
- Identify data-testid attributes - Find selectors in the UI code
- Write/update tests - Follow the established patterns (page objects, data factories, fixtures)
- Run the tests - Execute and verify they pass
- Fix failures - Debug and fix any issues
Auto-Update Workflow (sync mode)
When invoked with sync, or when UI changes are detected, automatically update E2E tests:
Step 0: Detect What Changed
Detect UI changes by checking git diff against the base branch:
# Get all changed UI files
git diff main --name-only -- 'ui/'
# Get changed files with diff content for analysis
git diff main -- 'ui/app/workspace/' 'ui/components/'Categorize changes into:
- data-testid changes - Renamed, removed, or added test IDs
- Route/URL changes - Modified page routes or navigation paths
- Component structure changes - New/removed form fields, buttons, tables, dialogs
- API endpoint changes - Modified API calls that tests rely on
- New features - Entirely new pages or components that need test coverage
Step 1: Map UI Changes to Affected Tests
For each changed UI file, find the corresponding test files:
UI File Path → Test Feature Folder
ui/app/workspace/providers/** → tests/e2e/features/providers/
ui/app/workspace/virtual-keys/** → tests/e2e/features/virtual-keys/
ui/app/workspace/dashboard/** → tests/e2e/features/dashboard/
ui/app/workspace/logs/** → tests/e2e/features/logs/
ui/app/workspace/mcp-logs/** → tests/e2e/features/mcp-logs/
ui/app/workspace/mcp-registry/** → tests/e2e/features/mcp-registry/
ui/app/workspace/routing-rules/** → tests/e2e/features/routing-rules/
ui/app/workspace/observability/** → tests/e2e/features/observability/
ui/app/workspace/config/** → tests/e2e/features/config/
ui/app/workspace/plugins/** → tests/e2e/features/plugins/
ui/components/sidebar.tsx → tests/e2e/core/pages/sidebar.page.ts
ui/components/** → May affect multiple test featuresStep 2: Analyze Each Change Type and Update
A. data-testid renamed or removed:
- Search the old testid across all test files:
grep -r 'old-testid' tests/e2e/ - Update every reference in page objects, selectors, and spec files
- If a testid was removed without replacement, check if the element still exists with a different selector and add a new testid to the UI
B. Form fields added/removed:
- If a new form field was added to a create/edit form:
- Add the field to the page object's interface (e.g.,
FeatureConfig) - Add a locator for the field in the page object constructor
- Update the
createFeature()/editFeature()methods to fill the field - Update the data factory to include the new field with a default value
- Add a test case that exercises the new field
- Add the field to the page object's interface (e.g.,
- If a form field was removed:
- Remove it from the interface, locators, and methods
- Remove or update test cases that depended on it
C. New buttons/actions added:
- Add locators to the page object
- Add methods to interact with the new action
- Add test cases covering the new action
D. Route changes:
- Update
goto()methods in page objects - Update navigation helpers in
core/actions/navigation.ts - Update any hardcoded URLs in test specs
E. API endpoint changes:
- Update
core/actions/api.tshelpers - Update any
waitForResponse()URL patterns in page objects
F. New page/feature added:
- Create the full test structure (page object, data factory, spec, fixture registration)
- Follow Step 3 from the main workflow
Step 3: Validate Updates
After making changes, run the affected tests to verify:
# Run only the affected feature tests
npx playwright test features/<affected-feature> --reporter=list
# If multiple features affected, run them all
npx playwright test features/providers features/virtual-keys --reporter=listStep 4: Report Changes
Present a summary to the user:
## E2E Test Sync Summary
### UI Changes Detected
- <list of changed UI files>
### Tests Updated
- **<feature>.page.ts**: Updated locators for renamed data-testid, added new field method
- **<feature>.spec.ts**: Added test for new "export" button, updated form fill sequence
- **<feature>.data.ts**: Added new field to factory defaults
### Tests Created
- **<new-feature>/**: Full test suite for new feature (page object, data, spec)
### Tests Requiring Manual Review
- <any changes that couldn't be auto-resolved, e.g., complex interaction flow changes>
### Verification
- Ran `npx playwright test features/<feature>` → X passed, Y failedImportant: Proactive Sync Triggers
ALWAYS check for and sync E2E tests when ANY of these happen:
- You modify a UI component that has
data-testidattributes — check if tests reference those IDs - You add a new
data-testidto a component — consider if existing tests should use it - You rename or remove a component/prop — search for test references and update them
- You change a form's fields (add/remove inputs, change validation) — update page object methods and test data
- You modify an API route that tests call — update API helpers and response wait patterns
- You change page navigation/routing — update
goto()methods and navigation helpers
To check quickly if tests are affected by your UI change:
# Find test files that reference any testid from the changed component
grep -rl 'data-testid-from-component' tests/e2e/Audit Workflow (audit mode) — Fix Incorrect Specs
Tests that pass but validate the wrong things are worse than no tests — they give false confidence. When invoked with audit, systematically scan specs for correctness issues and fix them.
Step 0: Scope the Audit
# Audit all specs
/e2e-test audit
# Audit a specific feature
/e2e-test audit virtual-keysIf a specific feature is given, read only that feature's spec, page object, and data files. Otherwise, scan all features/**/*.spec.ts files.
Step 1: Read the UI Code First
For every spec file being audited, read the actual UI component code to understand what the UI really does. This is the source of truth — tests must match real behavior, not assumed behavior.
# For each feature, read the UI code
# e.g. for virtual-keys:
grep -r 'data-testid' ui/app/workspace/virtual-keys/ --include='*.tsx'Understand:
- What fields are in the create/edit form (from the UI code, not the test)
- What the save button actually does (API call, toast, sheet close)
- What the table actually renders (columns, row content, empty state)
- What validation rules exist (required fields, format checks)
- What error states exist (API failures, permission errors)
Step 2: Scan for Incorrect Assertion Patterns
Check each spec file for these anti-patterns (ordered by severity):
P0 — Tests That Can Never Fail (always-true assertions)
These are the most dangerous — they provide zero coverage while appearing green.
// WRONG: Always true — count is always >= 0
const count = await page.getCount()
expect(count >= 0).toBe(true)
// WRONG: Always true — empty string is a string
const text = await element.textContent()
expect(typeof text).toBe('string')
// WRONG: Always true — isVisible returns a boolean, not asserted correctly
const visible = await element.isVisible()
// (no assertion at all, or expect(visible).toBeDefined())
// WRONG: Catching error means it never fails
try { await doSomething(); expect(true).toBe(true) } catch { expect(true).toBe(true) }Fix: Replace with deterministic assertions that verify actual expected state.
P1 — Tests That Assert Existence But Not Correctness
The test creates an item and checks it exists, but never verifies the item has the right data.
// WEAK: Only checks existence, not content
await page.createVirtualKey({ name: 'Test VK', description: 'My desc', budget: { maxLimit: 100 } })
const exists = await page.virtualKeyExists('Test VK')
expect(exists).toBe(true)
// Never checks that description, budget, or other fields were actually saved correctlyFix: After create, open/view the item and verify its fields match what was submitted. Compare against the actual UI state:
// BETTER: Verify the data was saved correctly
await page.viewVirtualKey(vkData.name)
await expect(page.descriptionInput).toHaveValue('My desc')
await expect(page.page.locator('#budgetMaxLimit')).toHaveValue('100')P2 — Tests That Assert the Wrong Thing
The test name says one thing but asserts something unrelated.
// WRONG: Test says "should validate email" but only checks button state
test('should validate email format', async ({ page }) => {
await page.fillEmail('invalid')
await expect(page.saveBtn).toBeDisabled() // Tests button, not validation message
})
// WRONG: Test says "should delete" but only checks toast, not actual deletion
test('should delete item', async ({ page }) => {
await page.deleteItem('foo')
await page.waitForSuccessToast()
// Never checks the item is actually gone from the table
})Fix: Align assertions with test intent. A delete test must verify the item is gone. A validation test must check the validation message.
P3 — Tests With Swallowed Errors / Catch-All Handlers
Tests that catch errors and silently continue, hiding real failures.
// WRONG: Error is caught and ignored — test always passes
const isVisible = await element.isVisible().catch(() => false)
if (isVisible) {
expect(isVisible).toBe(true) // Only asserts when visible, silently passes when not
}
// WRONG: Optional assertion that can be skipped entirely
const providerSection = page.getByText(/Providers/i).first()
const isProviderVisible = await providerSection.isVisible().catch(() => false)
if (isProviderVisible) {
expect(isProviderVisible).toBe(true) // Tautology when reached, skipped when not
}Fix: Remove the catch/conditional and make the assertion unconditional. If the element should be visible, assert it directly:
await expect(element).toBeVisible()If the state genuinely depends on external factors, use count-based branching with both branches making meaningful assertions:
const count = await page.getCount()
if (count === 0) {
await expect(page.emptyState).toBeVisible()
} else {
expect(count).toBeGreaterThan(0)
await expect(page.emptyState).not.toBeVisible()
}P4 — Tests That Don't Assert After Actions
Tests that perform actions (clicks, form fills, navigation) but have no assertion afterward.
// WRONG: Action with no assertion — test only checks nothing throws
test('should toggle visibility', async ({ page }) => {
await page.toggleKeyVisibility('my-key')
await page.toggleKeyVisibility('my-key')
// No assertion that the visibility state actually changed
})Fix: Add assertions verifying the action's observable effect:
test('should toggle visibility', async ({ page }) => {
await page.toggleKeyVisibility('my-key')
// Verify key value is now visible
await expect(page.getKeyValueText('my-key')).toBeVisible()
await page.toggleKeyVisibility('my-key')
// Verify key value is now hidden again
await expect(page.getKeyValueText('my-key')).not.toBeVisible()
})P5 — Tests Asserting Against Stale State
Tests that read state before an action completes, or compare to a stale snapshot.
// WRONG: Reads count before table finishes refreshing
await page.deleteItem('foo')
const count = await page.getCount() // Table hasn't refreshed yet!
expect(count).toBe(previousCount - 1) // May pass by coincidenceFix: Wait for the state change to complete before asserting:
await page.deleteItem('foo')
await page.waitForItemGone('foo') // Wait for table refresh
const count = await page.getCount()
expect(count).toBe(previousCount - 1)P6 — Tests That Duplicate Other Tests Without Additional Value
Multiple tests covering the exact same code path with only cosmetic differences (different name strings, same logic).
// REDUNDANT: These three tests do the same thing with different budget values
test('should create VK with small budget', ...) // creates + checks exists
test('should create VK with medium budget', ...) // creates + checks exists
test('should create VK with daily budget', ...) // creates + checks exists
// None of them verify the budget value was saved correctlyFix: Either consolidate into a parameterized test, or make each test verify something unique (e.g., verify the actual budget value appears in the UI).
Step 3: Cross-Check Against UI Code
For each test, verify:
- Form fields match - Does the test fill all required fields from the UI? Does it test fields that actually exist?
- Selectors are correct - Does
data-testid="vk-name-input"actually exist in the current UI code? Has it been renamed? - Behavior matches - If the UI shows a confirmation dialog on delete, does the test handle it? If the form has validation, do tests exercise it?
- Error paths exist - Does the UI show error toasts? Are there tests for error scenarios?
- New UI capabilities untested - Has the UI added new features (export, filter, sort, pagination) that have no test coverage?
# Compare what testids exist in UI vs what tests reference
grep -roh 'data-testid="[^"]*"' ui/app/workspace/<feature>/ | sort -u > /tmp/ui-testids.txt
grep -roh "getByTestId('[^']*')\|getByTestId(\"[^\"]*\")" tests/e2e/features/<feature>/ | sort -u > /tmp/test-testids.txt
# Diff to find gaps
diff /tmp/ui-testids.txt /tmp/test-testids.txtStep 4: Fix and Strengthen
For each issue found:
- Read the UI code for that specific component/interaction
- Understand the expected behavior from the UI implementation
- Rewrite the assertion to verify actual, observable, correct state
- Run the fixed test to ensure it passes with correct behavior and would fail if the behavior broke
Step 5: Report Findings
Present results to the user:
## E2E Audit Report — <feature>
### Issues Found: X
#### P0 — Always-True Assertions (X found)
| Test | File:Line | Issue | Fix |
|------|-----------|-------|-----|
| "should show empty state" | vk.spec.ts:374 | `count >= 0` always true | Use count-based branching |
#### P1 — Missing Data Verification (X found)
| Test | File:Line | Issue | Fix |
|------|-----------|-------|-----|
| "should create with budget" | vk.spec.ts:108 | Only checks `exists`, not budget value | Add field verification after create |
#### P2 — Wrong Assertion Target (X found)
...
#### P3 — Swallowed Errors (X found)
...
#### P4 — Missing Assertions (X found)
...
#### P5 — Stale State (X found)
...
#### P6 — Redundant Tests (X found)
...
### Coverage Gaps
- No test for: <UI feature that exists but has no test>
- Missing error path test for: <error scenario>
### Summary
- X tests fixed
- X tests need manual review (complex interaction flows)
- X new tests added for coverage gapsProject Structure
All E2E tests live in tests/e2e/:
tests/e2e/
├── playwright.config.ts # Playwright configuration
├── global-setup.ts # Global setup (plugin build, MCP servers, Bifrost connectivity)
├── core/ # Shared utilities & fixtures
│ ├── fixtures/
│ │ ├── base.fixture.ts # Main fixture - exports `test` and `expect` with all page objects
│ │ └── test-data.fixture.ts # TestDataFactory for generating unique test data
│ ├── pages/
│ │ ├── base.page.ts # BasePage class with common methods (toasts, forms, waits)
│ │ └── sidebar.page.ts # Sidebar navigation
│ ├── actions/
│ │ ├── navigation.ts # Navigation helpers (goToProviders, goToVirtualKeys, etc.)
│ │ └── api.ts # API helpers for setup/cleanup (providersApi, virtualKeysApi, etc.)
│ └── utils/
│ ├── selectors.ts # Centralized selector definitions
│ └── test-helpers.ts # Utilities: waitForNetworkIdle, retry, fillSelect, assertToast, etc.
└── features/ # One folder per feature
└── <feature>/
├── <feature>.spec.ts # Test cases
├── <feature>.data.ts # Test data factories & sample constants
└── pages/
└── <feature>.page.ts # Page object extending BasePageStep 1: Understand the Feature
Before writing tests, read the relevant UI code to understand:
- What pages/routes exist for the feature
- What
data-testidattributes are already in the UI components - What CRUD operations are available
- What form fields, buttons, and interactive elements exist
- What API endpoints the UI calls
Search for data-testid in UI code:
# Find all data-testid attributes for a feature
grep -r 'data-testid' ui/app/workspace/<feature>/ --include='*.tsx' --include='*.ts'Check what routes exist:
ls ui/app/workspace/Step 2: Check Existing Tests
Always review existing patterns before writing new tests:
# List all existing feature test folders
ls tests/e2e/features/
# Read an existing spec for patterns
cat tests/e2e/features/virtual-keys/virtual-keys.spec.ts
# Read existing page objects for patterns
cat tests/e2e/features/virtual-keys/pages/virtual-keys.page.tsStep 3: Create the Feature Test Structure
For a new feature, create these files:
3a. Page Object (features/<feature>/pages/<feature>.page.ts)
CRITICAL RULES:
- Always extend
BasePage - Define all locators in the constructor using
page.getByTestId() - Use
data-testidattributes as the primary selector strategy - Use
page.getByRole()as a secondary strategy - NEVER use brittle CSS selectors or chained parent locators (
.locator('..')) - Methods should be async and use semantic waits
- Include
goto(), CRUD methods, and acleanupmethod
Template:
import { Locator, Page, expect } from '@playwright/test'
import { BasePage } from '../../../core/pages/base.page'
import { waitForNetworkIdle } from '../../../core/utils/test-helpers'
// Define interfaces for the feature's data
export interface FeatureConfig {
name: string
description?: string
// ... other fields
}
export class FeaturePage extends BasePage {
// Main page elements
readonly createBtn: Locator
readonly table: Locator
// Sheet/form elements
readonly sheet: Locator
readonly nameInput: Locator
readonly saveBtn: Locator
readonly cancelBtn: Locator
constructor(page: Page) {
super(page)
// Use getByTestId for all locators
this.createBtn = page.getByTestId('create-feature-btn')
this.table = page.getByTestId('feature-table')
this.sheet = page.getByTestId('feature-sheet')
this.nameInput = page.getByTestId('feature-name-input')
this.saveBtn = page.getByTestId('feature-save-btn')
this.cancelBtn = page.getByTestId('feature-cancel-btn')
}
async goto(): Promise<void> {
await this.page.goto('/workspace/<feature>')
await waitForNetworkIdle(this.page)
}
async createFeature(config: FeatureConfig): Promise<void> {
await this.createBtn.click()
await expect(this.sheet).toBeVisible()
await this.waitForSheetAnimation()
// Fill form fields
await this.nameInput.fill(config.name)
// Save
await this.saveBtn.click()
await this.waitForSuccessToast()
await this.dismissToasts()
await expect(this.sheet).not.toBeVisible({ timeout: 5000 })
}
async featureExists(name: string): Promise<boolean> {
const row = this.page.getByTestId(`feature-row-${name}`)
return (await row.count()) > 0
}
async deleteFeature(name: string): Promise<void> {
const deleteBtn = this.page.getByTestId(`feature-delete-btn-${name}`)
await deleteBtn.click()
// Handle confirmation dialog
const confirmDialog = this.page.locator('[role="alertdialog"]')
await confirmDialog.waitFor({ state: 'visible', timeout: 5000 })
const confirmBtn = confirmDialog.getByRole('button', { name: /Delete/i })
await confirmBtn.click()
await this.waitForSuccessToast()
await this.dismissToasts()
}
async closeSheet(): Promise<void> {
const isSheetVisible = await this.sheet.isVisible().catch(() => false)
if (isSheetVisible) {
const closeBtn = this.sheet.locator('button[aria-label*="close"], button:has(svg.lucide-x)').first()
if (await closeBtn.isVisible()) {
await closeBtn.click()
}
await expect(this.sheet).not.toBeVisible({ timeout: 5000 }).catch(() => {})
}
}
async cleanupFeatures(names: string[]): Promise<void> {
if (names.length === 0) return
await this.goto()
await this.closeSheet()
await this.dismissToasts()
for (const name of names) {
try {
const exists = await this.featureExists(name)
if (!exists) continue
await this.closeSheet()
await this.deleteFeature(name)
} catch (error) {
console.error(`[CLEANUP] Failed to delete: ${name}`)
}
}
}
}3b. Test Data Factory (features/<feature>/<feature>.data.ts)
CRITICAL RULES:
- Use
Date.now()for unique test names - Provide factory functions with sensible defaults
- Allow partial overrides via the spread pattern
- Create sample constant objects for reusable configurations
- Never marshal payloads to a
Record/Mapand re-serialize — field ordering matters for backend validation and snapshot comparisons. Always construct payloads as object literals with fields in the intended order. Do NOT useObject.fromEntries(),JSON.parse(JSON.stringify(...))round-trips, or destructure into an intermediateRecord<string, unknown>— these can reorder fields.
Template:
import { FeatureConfig } from './pages/feature.page'
export function createFeatureData(overrides: Partial<FeatureConfig> = {}): FeatureConfig {
const timestamp = Date.now()
return {
name: `Test Feature ${timestamp}`,
description: 'E2E test feature',
// ... sensible defaults
...overrides,
}
}
// Sample configurations for different scenarios
export const SAMPLE_CONFIGS = {
basic: { /* ... */ },
advanced: { /* ... */ },
} as const3c. Test Spec (features/<feature>/<feature>.spec.ts)
CRITICAL RULES:
- Import
testandexpectfrom../../core/fixtures/base.fixture - Track created resources in arrays for cleanup in
afterEach - Use
test.describe()blocks for logical grouping - Use
test.beforeEach()to navigate to the page - Use
test.afterEach()to clean up resources - Use unique names with
Date.now()for test data - Write deterministic assertions (never
expect(count >= 0).toBe(true)) - Use
test.describe.configure({ mode: 'serial' })when tests have write ordering dependencies - Never marshal API payloads to a
Record/Map— pass object literals directly to Playwright'srequest.post({ data }). Marshaling through an intermediate map can reorder fields, which breaks backend validation and snapshot comparisons.
Template:
import { expect, test } from '../../core/fixtures/base.fixture'
import { createFeatureData } from './feature.data'
const createdItems: string[] = []
test.describe('Feature Name', () => {
test.beforeEach(async ({ featurePage }) => {
await featurePage.goto()
})
test.afterEach(async ({ featurePage }) => {
await featurePage.closeSheet()
if (createdItems.length > 0) {
await featurePage.cleanupFeatures([...createdItems])
createdItems.length = 0
}
})
test.describe('Creation', () => {
test('should display create button', async ({ featurePage }) => {
await expect(featurePage.createBtn).toBeVisible()
})
test('should create a basic item', async ({ featurePage }) => {
const data = createFeatureData({ name: `Basic Test ${Date.now()}` })
createdItems.push(data.name)
await featurePage.createFeature(data)
const exists = await featurePage.featureExists(data.name)
expect(exists).toBe(true)
})
})
test.describe('Deletion', () => {
test('should delete item', async ({ featurePage }) => {
const data = createFeatureData({ name: `Delete Test ${Date.now()}` })
await featurePage.createFeature(data)
let exists = await featurePage.featureExists(data.name)
expect(exists).toBe(true)
await featurePage.deleteFeature(data.name)
// No need to track for cleanup since we just deleted it
exists = await featurePage.featureExists(data.name)
expect(exists).toBe(false)
})
})
})3d. Register the Page Object in Fixtures
If creating a brand new feature, add it to core/fixtures/base.fixture.ts:
- Import the page class
- Add to
BifrostFixturestype - Add fixture definition
// In base.fixture.ts
import { FeaturePage } from '../../features/<feature>/pages/<feature>.page'
type BifrostFixtures = {
// ... existing
featurePage: FeaturePage
}
export const test = base.extend<BifrostFixtures>({
// ... existing
featurePage: async ({ page }, use) => {
await use(new FeaturePage(page))
},
})3e. Add npm Script (optional)
In tests/e2e/package.json, add a feature-specific test script:
{
"scripts": {
"test:<feature>": "playwright test features/<feature>"
}
}Step 4: Run Tests
# From tests/e2e/ directory
cd tests/e2e
# Run all tests
npx playwright test
# Run specific feature
npx playwright test features/<feature>
# Run in headed mode (see the browser)
npx playwright test features/<feature> --headed
# Run with Playwright UI (interactive)
npx playwright test --ui
# Run with debug inspector
npx playwright test features/<feature> --debug
# Run a single test by title
npx playwright test -g "should create a basic item"
# From project root via Makefile
make run-e2e FLOW=<feature>
make run-e2e-headed FLOW=<feature>Environment variables:
BASE_URL- Override app URL (default: http://localhost:3000)BIFROST_BASE_URL- Override Bifrost API URL (default: http://localhost:8080)SKIP_WEB_SERVER=1- Skip auto-starting Vite dev serverCI=1- Enable CI mode (retries, serial execution)
Step 5: Debug Failing Tests
Common Issues and Fixes
1. Element not found / timeout:
- Check if the
data-testidattribute exists in the UI component - Verify the page has loaded: add
await waitForNetworkIdle(page)after navigation - Check for loading spinners:
await page.locator('[data-testid="loading-spinner"]').waitFor({ state: 'hidden' })
2. Toast interfering with clicks:
- Dismiss toasts before interactions:
await page.dismissToasts()orawait page.forceCloseToasts()
3. Sheet/dialog animation not complete:
- Wait for animation:
await page.waitForSheetAnimation() - Wait for sheet visibility:
await expect(sheet).toBeVisible()
4. Stale element after table refresh:
- Re-query the locator after data changes (don't reuse old locator references)
- Use polling patterns like
waitForVirtualKeyGone()for eventual consistency
5. Tests pass individually but fail together:
- Check cleanup: ensure
afterEachdeletes all created resources - Use unique names with
Date.now()timestamps - Check for state pollution between test files
6. Flaky Radix/Shadcn Select:
- Use the
fillSelect()helper fromcore/utils/test-helpers.ts - Wait for
[role="listbox"]to appear before clicking options - Wait for
[role="listbox"]to disappear after selection
Debugging Tools
# View the HTML report of the last run
npx playwright show-report
# Generate test code by recording browser actions
npx playwright codegen http://localhost:3000
# Run with trace viewer (records every action)
npx playwright test --trace onTrace and Screenshots
- Screenshots: Taken automatically on failure, saved to
test-results/ - Traces: Captured on first retry, viewable via
npx playwright show-trace <trace.zip> - Videos: Retained on failure, saved to
test-results/
Mandatory Rules
These rules MUST be followed at all times:
Selectors
- ALWAYS use
data-testidattributes as the primary selector strategy - ALWAYS use
page.getByTestId()orpage.getByRole()- never raw CSS selectors for interactive elements - NEVER use chained parent locators (
.locator('..')) - NEVER use
{ force: true }on clicks - fix the underlying visibility issue instead - If a needed
data-testiddoesn't exist in the UI, add it to the UI component first
Waits
- ALWAYS use semantic waits (
waitFor(),expect().toBeVisible(),waitForLoadState()) - NEVER use
page.waitForTimeout()except as last resort in cleanup/polling (and document why) - ALWAYS wait for page load after navigation:
await waitForNetworkIdle(page) - ALWAYS wait for sheet animations before interacting with sheet contents
Test Data
- ALWAYS use
Date.now()orTestDataFactory.uniqueId()for unique test names - NEVER use static/hardcoded test data names (causes collisions in parallel runs)
- ALWAYS create test data factory functions in
<feature>.data.ts
Cleanup
- ALWAYS track created resources in arrays and delete them in
afterEach - ALWAYS close open sheets before cleanup:
await page.closeSheet() - ALWAYS dismiss toasts before interactive operations
- Cleanup failures should
console.errorand continue, never throw
Assertions
- ALWAYS write deterministic assertions that can actually fail
- NEVER write
expect(count >= 0).toBe(true)- this always passes - Use count-based branching for state-dependent assertions:
if (count === 0) { await expect(emptyState).toBeVisible() } else { expect(count).toBeGreaterThan(0) }
Imports
- ALWAYS import
testandexpectfrom../../core/fixtures/base.fixture - NEVER import directly from
@playwright/testin spec files (use the custom fixture)
Adding data-testid to UI
When a UI component is missing a required data-testid, add it directly. Convention:
data-testid="<entity>-<element>-<qualifier>"
Examples:
data-testid="vk-row-{name}" # Virtual key table row
data-testid="vk-edit-btn-{name}" # Edit button for specific VK
data-testid="vk-delete-btn-{name}" # Delete button for specific VK
data-testid="create-vk-btn" # Create button
data-testid="vk-sheet" # Virtual key form sheet
data-testid="vk-name-input" # Name input in VK form
data-testid="vk-save-btn" # Save button in VK formAvailable BasePage Methods
Every page object inherits these from BasePage (core/pages/base.page.ts):
| Method | Description |
waitForPageLoad() | Wait for networkidle load state |
waitForChartsToLoad() | Wait for charts/data and skeletons to disappear |
getToast(type?) | Get toast locator (success/error/loading/default) |
waitForSuccessToast(message?) | Wait for success toast, optionally match message |
waitForErrorToast(message?) | Wait for error toast, optionally match message |
waitForToastsToDisappear(timeout?) | Wait for all toasts to be gone |
dismissToasts() | Wait for toasts to auto-dismiss |
forceCloseToasts() | Click away + wait to force-dismiss toasts |
waitForSheetAnimation() | Wait for sheet/dialog open animation to complete |
waitForStateChange(locator, attr, val) | Wait for element attribute to match |
fillByLabel(label, value) | Fill input by its label |
fillByPlaceholder(placeholder, value) | Fill input by its placeholder |
fillByTestId(testId, value) | Fill input by data-testid |
clickButton(text) | Click button by visible text |
clickByTestId(testId) | Click element by data-testid |
closeDevProfiler() | Dismiss the Dev Profiler overlay if visible |
Available Test Helpers (core/utils/test-helpers.ts)
| Helper | Description |
waitForNetworkIdle(page, timeout?) | Wait for network idle state |
wait(ms) | Sleep for ms (use sparingly) |
retry(fn, { retries, delay }) | Retry async function with backoff |
randomString(length?) | Generate random alphanumeric string |
uniqueTestName(prefix) | Generate unique name with timestamp + random suffix |
assertToast(page, text, type) | Assert toast appears with text |
assertUrl(page, pattern) | Assert page URL matches pattern |
fillSelect(page, triggerSelector, optionText) | Fill Radix/Shadcn Select component |
fillMultiSelect(page, inputSelector, values) | Fill multi-select with array of values |
clearAndFill(page, selector, value) | Atomically clear and fill input |
getTableRowCount(page, tableSelector) | Get count of table body rows |
tableContainsRow(page, tableSelector, text) | Check if table has row with text |
waitForTableLoad(page, tableSelector) | Wait for table visible + spinner gone |
screenshotOnError(page, testName, fn) | Auto-screenshot wrapper for debugging |
Available API Helpers (core/actions/api.ts)
For programmatic setup/cleanup via API (bypassing UI):
| API | Methods |
providersApi | getAll, get, create, update, delete |
virtualKeysApi | getAll, get, create, update, delete |
teamsApi | getAll, create, delete |
customersApi | getAll, create, delete |
cleanupTestData(request, { virtualKeyIds, teamIds, customerIds, providerNames }) | Bulk cleanup |
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.

