Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
3134068
Add segment page
kyle-ssg Aug 5, 2025
5d97da7
Add segment page
kyle-ssg Aug 5, 2025
ea9eef4
add my to breadcrumb
kyle-ssg Aug 5, 2025
df8de68
Migrate feature override row to component
kyle-ssg Aug 12, 2025
c953bec
Update frontend/web/components/Breadcrumb.tsx
kyle-ssg Aug 26, 2025
c77bb77
safe handle url push
kyle-ssg Aug 26, 2025
da52a0d
Merge remote-tracking branch 'origin/feat/segment-page' into feat/seg…
kyle-ssg Aug 26, 2025
a9d3d33
Offset 2
kyle-ssg Aug 26, 2025
ab16a33
Merge branch 'refs/heads/main' into feat/segment-page
matthewelwell Aug 29, 2025
00c331f
Merge branch 'main' into feat/segment-page
kyle-ssg Sep 16, 2025
a438251
Merge remote-tracking branch 'origin/feat/segment-page' into feat/seg…
kyle-ssg Sep 16, 2025
f4fdcf6
Merge branch 'main' into chore/componentise-feature-override-row
kyle-ssg Sep 16, 2025
5fa2c8f
fix feature override import
kyle-ssg Sep 16, 2025
b526540
Fix tests
kyle-ssg Sep 16, 2025
36d5c78
Merge branch 'feat/segment-page' into chore/componentise-feature-over…
kyle-ssg Sep 16, 2025
3b246bd
Fix segment tab classes
kyle-ssg Sep 23, 2025
53f967a
Fix segment tab classes
kyle-ssg Sep 23, 2025
73d31a1
Add toast
kyle-ssg Sep 23, 2025
6e19718
Add manageSegmentsPermission to create segment
kyle-ssg Sep 23, 2025
3c90c18
Refactor remove segment
kyle-ssg Sep 23, 2025
b7826e9
Merge branch 'feat/segment-page' into chore/componentise-feature-over…
kyle-ssg Sep 23, 2025
5bf0aac
Merge branch 'main' into chore/componentise-feature-override-row
kyle-ssg Sep 23, 2025
3d51e9c
Merge branch 'main' into chore/componentise-feature-override-row
kyle-ssg Sep 23, 2025
0633e23
fix identity override
kyle-ssg Sep 23, 2025
b8f706a
Componentise overrides
kyle-ssg Sep 23, 2025
c7fd718
Componentise overrides
kyle-ssg Sep 23, 2025
c5d433a
Refactor
kyle-ssg Sep 30, 2025
ec576fb
Improve feature override row refactoring
kyle-ssg Sep 30, 2025
149fc8c
CTA Feature override
kyle-ssg Sep 30, 2025
596f736
re-add tests
kyle-ssg Sep 30, 2025
022c27d
Refactor
kyle-ssg Sep 30, 2025
480a0a8
Chore/componentise feature override row improved (#6118)
kyle-ssg Sep 30, 2025
9d6f43a
Refactor
kyle-ssg Sep 30, 2025
f91a243
Merge branch 'chore/componentise-feature-override-row-improved' into …
kyle-ssg Sep 30, 2025
661872f
Permission fix
kyle-ssg Sep 30, 2025
162fceb
fix identifier
kyle-ssg Sep 30, 2025
e52f9f9
Fix identityName param
kyle-ssg Sep 30, 2025
0ba5c15
Fix edit permission check
kyle-ssg Sep 30, 2025
80811d5
Componentise feature filters
kyle-ssg Sep 30, 2025
a5dc772
Fix segment override logic
kyle-ssg Sep 30, 2025
4d340e3
Fix identity override logic
kyle-ssg Sep 30, 2025
3ee508e
Fix identity override logic
kyle-ssg Sep 30, 2025
7971ac7
Merge branch 'chore/componentise-feature-override-row' into chore/com…
kyle-ssg Sep 30, 2025
657fd59
QA
kyle-ssg Oct 7, 2025
ce67965
Merge branch 'chore/componentise-feature-override-row' into chore/com…
kyle-ssg Oct 7, 2025
12eee3a
Make filtering consistent across user and features page
kyle-ssg Oct 7, 2025
f061a48
simplify filters
kyle-ssg Oct 7, 2025
2939e21
Merge branch 'main' into chore/componentise-feature-override-row
kyle-ssg Oct 7, 2025
e441e03
Merge branch 'chore/componentise-feature-override-row' into chore/com…
kyle-ssg Oct 7, 2025
10719cb
re-add loading logic
kyle-ssg Oct 7, 2025
b790d58
Simplify loading logic
kyle-ssg Oct 7, 2025
17ea4ba
Don't assume code references exist
kyle-ssg Oct 7, 2025
772e147
Don't assume code references exist
kyle-ssg Oct 7, 2025
f3ba094
fix text wrapping
kyle-ssg Oct 7, 2025
7b18f28
Fix tag filter in url
kyle-ssg Oct 7, 2025
b4724ca
Merge branch 'chore/componentise-feature-filters' into feat/segment-f…
kyle-ssg Oct 7, 2025
eb0be4b
Update frontend/web/components/feature-page/FeatureFilters.tsx
kyle-ssg Oct 14, 2025
6174bd5
Remove releasePipelines
kyle-ssg Oct 14, 2025
9b562f6
Merge remote-tracking branch 'origin/chore/componentise-feature-filte…
kyle-ssg Oct 14, 2025
dbb085a
remove sortToHeader
kyle-ssg Oct 14, 2025
f7e3cff
Merge branch 'main' into chore/componentise-feature-override-row
kyle-ssg Oct 14, 2025
ba3b42e
Claude context
kyle-ssg Oct 14, 2025
9746d13
Claude context
kyle-ssg Oct 14, 2025
5955f25
Claude context
kyle-ssg Oct 14, 2025
efedbdc
Add api-sync / optmimise contexts
kyle-ssg Oct 21, 2025
cae73d7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 21, 2025
23a6495
Add api-sync / optimise contexts
kyle-ssg Oct 21, 2025
af5bfda
Merge remote-tracking branch 'origin/chore/claude-context' into chore…
kyle-ssg Oct 21, 2025
acd5420
Merge branch 'main' into chore/componentise-feature-override-row
kyle-ssg Oct 21, 2025
29bae85
Merge branch 'chore/componentise-feature-override-row' into chore/com…
kyle-ssg Oct 21, 2025
162daef
Fix table value filter
kyle-ssg Oct 21, 2025
8b6d03d
Merge branch 'chore/componentise-feature-filters' into feat/segment-f…
kyle-ssg Oct 21, 2025
2058123
Fixes
kyle-ssg Oct 21, 2025
a1c5d83
Use unified endpoint for segment feature states
kyle-ssg Oct 21, 2025
143f02e
namespace segment tab
kyle-ssg Oct 21, 2025
dcb6632
Merge branch 'feat/segment-feature-state-view' into feat/segment-feat…
kyle-ssg Oct 21, 2025
6934c5f
Tests
kyle-ssg Oct 21, 2025
72e8214
Clean up types
kyle-ssg Oct 21, 2025
21697fe
chore: componentise feature filters (#6119)
kyle-ssg Oct 28, 2025
ee90b70
Merge branch 'chore/componentise-feature-override-row' into feat/segm…
kyle-ssg Oct 28, 2025
ac641db
Update contexts
kyle-ssg Nov 4, 2025
0c03b8f
Update contexts
kyle-ssg Nov 4, 2025
fb2df65
Update contexts
kyle-ssg Nov 4, 2025
b064e81
Update contexts
kyle-ssg Nov 4, 2025
27019de
Update contexts
kyle-ssg Nov 4, 2025
96c81d6
Update contexts
kyle-ssg Nov 4, 2025
4a3bafa
Update contexts
kyle-ssg Nov 4, 2025
4b846d9
Update contexts
kyle-ssg Nov 4, 2025
6cbde85
Merge branch 'main' into chore/claude-context
kyle-ssg Nov 4, 2025
dd7b743
Update contexts
kyle-ssg Nov 10, 2025
6a8f202
Update frontend/web/components/feature-page/FeatureFilters.tsx
kyle-ssg Nov 11, 2025
ad8a35d
Update frontend/web/components/feature-page/FeatureFilters.tsx
kyle-ssg Nov 11, 2025
659abf1
return early if key fields are null
kyle-ssg Nov 11, 2025
a00269e
Merge branch 'main' into chore/componentise-feature-override-row
kyle-ssg Nov 11, 2025
ae76a46
Merge branch 'chore/componentise-feature-override-row' into feat/segm…
kyle-ssg Nov 11, 2025
1b90569
Remove !
kyle-ssg Nov 11, 2025
43e32ad
Remove !
kyle-ssg Nov 11, 2025
7dcb60c
Merge branch 'chore/componentise-feature-override-row' into feat/segm…
kyle-ssg Nov 11, 2025
0ed455b
Unused import
kyle-ssg Nov 11, 2025
1381fb0
Fix sort order types
kyle-ssg Nov 11, 2025
0ac5ded
Re-add remove segment button
kyle-ssg Nov 11, 2025
df85873
Update claude contexts
kyle-ssg Nov 11, 2025
a26b39a
Update claude contexts
kyle-ssg Nov 11, 2025
9ef5383
Fix sortorder functionality
kyle-ssg Nov 11, 2025
2ed1777
QA feedback
kyle-ssg Nov 11, 2025
e800bcc
QA feedback
kyle-ssg Nov 11, 2025
24572d7
Adjust environment select
kyle-ssg Nov 11, 2025
212de78
Adjust fetching and loading logic
kyle-ssg Nov 11, 2025
f55b8ef
Adjust fetching and loading logic
kyle-ssg Nov 11, 2025
4974a76
Prevent toggle feature from segment page
kyle-ssg Nov 16, 2025
68c09cb
Merge branch 'main' into chore/componentise-feature-override-row
kyle-ssg Nov 18, 2025
1a6b706
Merge branch 'chore/componentise-feature-override-row' into feat/segm…
kyle-ssg Nov 18, 2025
62262c1
clean up confirm toggle function
kyle-ssg Nov 18, 2025
5b9588a
fix vertical alignment for feature row
kyle-ssg Nov 18, 2025
189b701
Merge branch 'feat/segment-feature-state-view' into chore/create-flag…
kyle-ssg Nov 18, 2025
102d47a
Create flag migration
kyle-ssg Dec 2, 2025
f443064
Highlight segment when opening a feature
kyle-ssg Dec 2, 2025
aae4428
Merge branch 'main' into chore/componentise-feature-override-row
kyle-ssg Dec 2, 2025
454d9b7
Highlight segment when opening a feature
kyle-ssg Dec 2, 2025
a734a6c
Merge branch 'chore/componentise-feature-override-row' into feat/segm…
kyle-ssg Dec 2, 2025
d4d2f0b
Merge branch 'main' into chore/create-flag-migration
kyle-ssg Dec 2, 2025
01393b4
Merge branch 'refs/heads/feat/segment-feature-state-view' into chore/…
kyle-ssg Dec 2, 2025
142c32e
Migrate tabs
kyle-ssg Dec 2, 2025
752ce06
Add settings and value tabs
kyle-ssg Dec 2, 2025
a4c4c55
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 2, 2025
aec8e29
Revert claude changes
kyle-ssg Dec 2, 2025
8c40502
Merge remote-tracking branch 'origin/chore/create-flag-migration' int…
kyle-ssg Dec 2, 2025
fd08db6
Migrate components
kyle-ssg Dec 2, 2025
2732306
Revert changes
kyle-ssg Dec 2, 2025
1c117d7
feat: segment feature state view (#6137)
kyle-ssg Dec 2, 2025
c3ad50e
Fixes
kyle-ssg Dec 3, 2025
b9f4933
Merge branch 'main' into chore/componentise-feature-override-row
kyle-ssg Dec 3, 2025
cf3119b
Fixes
kyle-ssg Dec 3, 2025
14f7c5b
Merge branch 'chore/componentise-feature-override-row' into chore/cre…
kyle-ssg Dec 3, 2025
b2b275b
Fixes
kyle-ssg Dec 3, 2025
984e6e3
Fix merge hell
kyle-ssg Dec 3, 2025
51860b9
Merge branch 'chore/componentise-feature-override-row' into chore/cre…
kyle-ssg Dec 3, 2025
52a2dc7
Fix merge hell
kyle-ssg Dec 3, 2025
2a4a8a5
Fix segment override permission check and project flag cache keys
kyle-ssg Dec 3, 2025
83c5a9f
Merge branch 'chore/componentise-feature-override-row' into chore/cre…
kyle-ssg Dec 3, 2025
13b67d0
Fix has changed check for overrides
kyle-ssg Dec 3, 2025
99a69bb
Fix has changed check for overrides
kyle-ssg Dec 3, 2025
76251b2
Revert unecessary import changes
kyle-ssg Dec 3, 2025
c39b418
chore: Rename CreateFlag (#6388)
kyle-ssg Dec 9, 2025
fa183df
Merge branch 'main' into chore/create-flag-migration
kyle-ssg Dec 9, 2025
9cb2da0
Merge remote-tracking branch 'origin/chore/create-flag-migration' int…
kyle-ssg Dec 9, 2025
932be79
Merge branch 'main' into chore/create-flag-migration
kyle-ssg Dec 16, 2025
a81aad6
Fix merge import
kyle-ssg Dec 16, 2025
42704e8
Merge main into chore/create-flag-migration
kyle-ssg Jan 6, 2026
a6e4bf5
Fix import
kyle-ssg Jan 6, 2026
f23186d
Fix conflict
kyle-ssg Jan 6, 2026
6bbf06a
Merge branch 'main' into chore/create-flag-migration
kyle-ssg Jan 13, 2026
4011328
Typo
kyle-ssg Jan 13, 2026
4e3f18e
Fix alert infinite callback
kyle-ssg Jan 13, 2026
08b2d34
feat: edit versioned change request (#6368)
kyle-ssg Jan 16, 2026
a9d9be3
Merge branch 'main' into chore/create-flag-migration
kyle-ssg Jan 16, 2026
a0960f3
Fix conflict
kyle-ssg Jan 16, 2026
272cce3
Pass identity override to variation options
kyle-ssg Jan 20, 2026
2a5ce5c
Adjust feature state prop
kyle-ssg Jan 20, 2026
474689b
Merge branch 'main' into chore/create-flag-migration
kyle-ssg Jan 20, 2026
74b83fa
Simplify create feature for identity/environment
kyle-ssg Jan 20, 2026
56d52ed
Playwright
kyle-ssg Jan 20, 2026
c9f792e
Playwright
kyle-ssg Jan 20, 2026
a50bb05
Remove unused tests
kyle-ssg Jan 20, 2026
155a2c6
Merge branch 'main' into chore/playwright
kyle-ssg Jan 20, 2026
184194e
Merge package lock
kyle-ssg Jan 20, 2026
6448d43
Use playwright's firefox in dockerfile
kyle-ssg Jan 20, 2026
00ef9f7
Add frontend makefile logging, remove apt-get line
kyle-ssg Jan 20, 2026
0606454
re-add "tags" to tests
kyle-ssg Jan 20, 2026
5ccaa96
Add health check prior to teardown
kyle-ssg Jan 20, 2026
145056b
Add health check prior to teardown
kyle-ssg Jan 20, 2026
bab12a1
Add health check prior to teardown
kyle-ssg Jan 20, 2026
97adfcb
Improve logging, add sticky comment, add artifcats
kyle-ssg Jan 20, 2026
9bcb51d
Fix duplicate artifacts / race conditions
kyle-ssg Jan 20, 2026
3058590
improve artifacts
kyle-ssg Jan 21, 2026
8bfd940
improve artifacts
kyle-ssg Jan 21, 2026
ae098f8
improve tests
kyle-ssg Jan 21, 2026
36e733e
fix duplicate artifact names, only upload artifacts on failure
kyle-ssg Jan 21, 2026
72e262e
Remove testcafe stuff
kyle-ssg Jan 21, 2026
c28be83
Fix piping
kyle-ssg Jan 21, 2026
7397500
Cut down noise
kyle-ssg Jan 21, 2026
72a9a42
Revert teardown token logic
kyle-ssg Jan 21, 2026
a7ad899
Cut down noise, add success comment
kyle-ssg Jan 21, 2026
42c03de
Cut down noise / stability
kyle-ssg Jan 21, 2026
484ee15
Merge branch 'main' into chore/playwright
kyle-ssg Jan 21, 2026
8d9290f
Better retrying / add quiet mode and skip bundle
kyle-ssg Jan 21, 2026
ea337d6
Better retrying / add quiet mode and skip bundle
kyle-ssg Jan 21, 2026
4b6c08a
Fix piping
kyle-ssg Jan 21, 2026
74f3c4d
Fix piping
kyle-ssg Jan 21, 2026
b751344
Fix piping
kyle-ssg Jan 21, 2026
365e8cb
Replace index based lookups with text
kyle-ssg Jan 21, 2026
848435d
refactor(e2e): Replace index-based feature lookups with name-based lo…
kyle-ssg Jan 22, 2026
da2535a
Replace index based lookups with text
kyle-ssg Jan 22, 2026
4b498cb
add ee tests
kyle-ssg Jan 22, 2026
20381b5
Improve commands
kyle-ssg Jan 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .claude/commands/e2e-all.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# E2E Test Runner - All Tests (OSS + Enterprise)

**IMMEDIATELY run all E2E tests (both OSS and enterprise), analyze failures, fix them, and re-run failed tests until all pass or unfixable issues are identified.**

## Prerequisites
Read `.claude/context/e2e.md` for full E2E configuration details and setup requirements.

## Workflow

**IMPORTANT: Always start by changing to the frontend directory** - the `.env` file and dependencies are located there.

1. **RUN TESTS NOW** from the frontend directory:
```bash
cd frontend
E2E_RETRIES=0 SKIP_BUNDLE=1 E2E_CONCURRENCY=20 npm run test -- --quiet
```

**Note:** Using `E2E_RETRIES=0` to fail fast on first failure for immediate analysis and fixing.

2. **If ANY tests fail:**

For EACH failed test, **ALWAYS READ TRACES FIRST:**

a. **Read error-context.md** in the failed test directory:
- Check `frontend/e2e/test-results/<test-directory>/error-context.md`
- Shows exact DOM state when test failed
- YAML tree with all elements, their states, and data-test attributes
- Check if expected elements exist and their actual values
- Verify selector is correct by searching for the data-test attribute

b. **If error-context.md doesn't show the issue**, unzip and check trace files:
```bash
cd frontend/e2e/test-results/<failed-test-directory>
unzip -q trace.zip
grep -i "error\|failed" 0-trace.network # Check for network errors
```

c. **Only after analysing traces**, read the test file and fix:
- Wrong selector → Update to match actual DOM from error-context.md
- Missing `data-test` attribute → Add it to the component
- Element hidden → Filter for visible elements or wait for visibility
- Missing wait → Add appropriate `waitFor*` calls
- Race condition → Add network waits, increase timeouts, or use more specific waits
- Flaky element interaction → Add `scrollIntoView` or `waitForVisible` before clicking

d. **After making fixes**, re-run ONLY the failed tests:
```bash
cd frontend
E2E_RETRIES=0 SKIP_BUNDLE=1 E2E_CONCURRENCY=1 npm run test -- tests/flag-tests.pw.ts tests/invite-test.pw.ts
```
- Use `E2E_RETRIES=0` to fail fast and see if the fix worked
- Use concurrency=1 to avoid race conditions
- Only run the specific test files that failed

e. **Repeat the fix/re-run cycle:**
- If tests still fail after fixes but the error changed, analyse the new error and fix again
- Re-run failed tests after each fix attempt
- Continue until all tests pass or you've identified unfixable issues
- Maximum 3 fix/re-run cycles per test before reporting as unfixable

3. **Report final results:**
- Break down results by category:
- OSS tests: X passed / Y failed
- Enterprise tests: X passed / Y failed
- Total: X passed / Y failed
- List which tests passed/failed
- Document any fixes that were applied
- For unfixable issues, explain why and suggest manual investigation
- Show the error message and line number for any failures

## Important Notes

- **DO NOT** just report that retries passed - if tests failed initially, investigate and fix the root cause
- **DO** modify test files to fix timing issues, missing waits, or broken selectors
- **DO** add `data-test` attributes to components if they're missing
- **DON'T** modify test assertions or business logic unless the test is clearly wrong
- If the failure is in application code (not test code), report it as a bug but don't try to fix it
- Always explain what fixes you're attempting and why
- Test files are in TypeScript and use the `helpers.playwright.ts` helper functions
- The built-in retry mechanism is a safety net, not a substitute for fixing flaky tests
85 changes: 85 additions & 0 deletions .claude/commands/e2e-create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# E2E Test Creator

Create a new E2E test following the existing patterns in the codebase.

## Prerequisites
Read `.claude/context/e2e.md` for full E2E configuration details, test structure, and debugging guides.

## Workflow

**IMPORTANT: Always start by changing to the frontend directory** - the `.env` file and dependencies are located there.

1. **Ask the user what they want to test:**
- What feature/page/flow to test
- Any specific scenarios or edge cases

2. **Determine if this is OSS or Enterprise:**
- Check if the feature being tested exists in enterprise-only code paths
- Look for clues in existing tests that test similar features
- If unclear, ask the user
- Tag the test with `@oss` or `@enterprise` accordingly

3. **Review existing test patterns:**
- Read 2-3 similar existing test files from `frontend/e2e/tests/`
- Read `frontend/e2e/helpers.playwright.ts` to understand available utilities
- Note common patterns like:
- Login flow
- Navigation
- Element selection using `data-test` attributes
- Waiting for elements/network
- Assertions

4. **Scan the relevant application code:**
- Find the components/pages being tested in `frontend/web/components/` or `frontend/common/`
- Check if elements already have `data-test` attributes
- If missing, add `data-test` attributes to make tests reliable:
- Use descriptive names like `data-test="create-feature-btn"`
- Follow existing naming patterns in the codebase
- Add them to buttons, inputs, and key interactive elements

5. **Create the test file:**
- Follow the naming convention: `*-test.pw.ts` or `*-tests.pw.ts`
- Use the test structure from existing tests
- Use helper functions from `helpers.playwright.ts`
- Include proper test descriptions and tags
- Add comments explaining complex test logic

6. **Run the new test to verify it works:**
- Run the test 2-3 times to ensure it's stable:
```bash
cd frontend
SKIP_BUNDLE=1 E2E_CONCURRENCY=1 npm run test -- tests/new-test.pw.ts --quiet
```
- **If the test fails, ALWAYS READ TRACES FIRST:**
1. **Read error-context.md** in the failed test directory:
- Shows exact DOM state when test failed
- YAML tree with all elements, their states, and data-test attributes
- Check if expected elements exist and their actual values
- Verify selector is correct by searching for the data-test attribute
2. **If error-context.md doesn't show the issue**, unzip and check trace files:
```bash
cd frontend/e2e/test-results/<failed-test-directory>
unzip -q trace.zip
grep -i "error\|failed" 0-trace.network # Check for network errors
```
3. **Only after analyzing traces**, fix the issue:
- Wrong selector → Update to match actual DOM from error-context.md
- Missing `data-test` attribute → Add it to the component
- Element hidden → Filter for visible elements or wait for visibility
- Missing wait → Add appropriate `waitFor*` calls
- Re-run until it passes consistently

7. **Report what was created:**
- Show the test file path
- List any `data-test` attributes that were added
- Report test stability (how many runs passed/failed)
- If there were failures, explain what was fixed

## Important Notes

- Always use `data-test` attributes for selectors, not CSS classes or IDs
- Use existing helper functions instead of raw Playwright APIs
- Follow the login pattern from other tests
- Tests should be independent and not rely on order of execution
- Use descriptive test names that explain what's being tested
- Add appropriate waits for async operations
96 changes: 96 additions & 0 deletions .claude/commands/e2e-ee.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# E2E Enterprise Test Runner with Auto-Fix

**IMMEDIATELY run enterprise E2E tests (tagged with @enterprise), analyze failures, fix them, and re-run failed tests until all pass or unfixable issues are identified.**

## Prerequisites
Read `.claude/context/e2e.md` for full E2E configuration details and setup requirements.

## Workflow

**IMPORTANT: Always start by changing to the frontend directory** - the `.env` file and dependencies are located there.

1. **RUN TESTS NOW** from the frontend directory:
```bash
cd frontend
E2E_RETRIES=0 SKIP_BUNDLE=1 E2E_CONCURRENCY=20 npm run test -- --grep @enterprise --quiet
```

**Note:** Using `E2E_RETRIES=0` to fail fast on first failure for immediate analysis and fixing.

2. **ALWAYS check for flaky tests after test run completes:**

**CRITICAL:** Tests that fail initially but pass on retry are FLAKY and MUST be investigated, even if the final result shows all tests passed.

a. Check the test output for any tests that failed on first run (look for the initial failure messages before "Retrying")

b. For EACH test that failed initially (even if it passed on retry):
- Parse the error from the test output:
* Error type (e.g., `TimeoutError`, `AssertionError`)
* Error message (e.g., `"waiting for locator('#button') to be visible"`)
* File path and line number where it failed
* Stack trace showing the call chain
- Read the test file at the failing line number to understand what was being tested
- **Report these as FLAKY TESTS** - they indicate timing issues, race conditions, or environmental problems
- **Analyze the root cause**:
* Timeout errors → likely missing waits or race conditions
* Assertion errors → check if value is correct or if timing is off
* Element not found → selector may have changed or element loads slowly

c. **If ANY tests are still failing after automatic retries:**

For EACH failed test, **ALWAYS READ TRACES FIRST:**

1. **Read error-context.md** in the failed test directory:
- Shows exact DOM state when test failed
- YAML tree with all elements, their states, and data-test attributes
- Check if expected elements exist and their actual values
- Verify selector is correct by searching for the data-test attribute

2. **If error-context.md doesn't show the issue**, unzip and check trace files:
```bash
cd frontend/e2e/test-results/<failed-test-directory>
unzip -q trace.zip
grep -i "error\|failed" 0-trace.network # Check for network errors
```

3. **Only after analyzing traces**, read the test file and fix:
- Wrong selector → Update to match actual DOM from error-context.md
- Missing `data-test` attribute → Add it to the component
- Element hidden → Filter for visible elements or wait for visibility
- Missing wait → Add appropriate `waitFor*` calls
- Race condition → Add network waits, increase timeouts, or use more specific waits
- Flaky element interaction → Add `scrollIntoView` or `waitForVisible` before clicking

d. **After making fixes**, re-run ONLY the failed tests:
```bash
cd frontend
E2E_RETRIES=0 SKIP_BUNDLE=1 E2E_CONCURRENCY=1 npm run test -- tests/flag-tests.pw.ts tests/invite-test.pw.ts --grep @enterprise
```
- Use `E2E_RETRIES=0` to fail fast and see if the fix worked
- Use concurrency=1 to avoid race conditions
- Only run the specific test files that failed
- Include `--grep @enterprise` to ensure only enterprise tests run

e. **Repeat the fix/re-run cycle:**
- If tests still fail after fixes but the error changed, analyze the new error and fix again
- Re-run failed tests after each fix attempt
- Continue until all tests pass or you've identified unfixable issues
- Maximum 3 fix/re-run cycles per test before reporting as unfixable

3. **Report final results:**
- **ALWAYS report flaky tests first** (tests that failed initially but passed on retry)
- List which tests passed/failed after all retries
- Document any fixes that were applied
- For unfixable issues, explain why and suggest manual investigation
- Show the error message and line number for any failures

## Important Notes

- **DO NOT** just report that retries passed - if tests failed initially, investigate and fix the root cause
- **DO** modify test files to fix timing issues, missing waits, or broken selectors
- **DO** add `data-test` attributes to components if they're missing
- **DON'T** modify test assertions or business logic unless the test is clearly wrong
- If the failure is in application code (not test code), report it as a bug but don't try to fix it
- Always explain what fixes you're attempting and why
- Test files are in TypeScript and use the `helpers.playwright.ts` helper functions
- The built-in retry mechanism is a safety net, not a substitute for fixing flaky tests
95 changes: 95 additions & 0 deletions .claude/commands/e2e.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# E2E Test Runner with Auto-Fix

**IMMEDIATELY run OSS (non-enterprise) E2E tests, analyze failures, fix them, and re-run failed tests until all pass or unfixable issues are identified.**

## Prerequisites
Read `.claude/context/e2e.md` for full E2E configuration details and setup requirements.

## Workflow

**IMPORTANT: Always start by changing to the frontend directory** - the `.env` file and dependencies are located there.

1. **RUN TESTS NOW** from the frontend directory:
```bash
cd frontend
E2E_RETRIES=0 SKIP_BUNDLE=1 E2E_CONCURRENCY=20 npm run test -- --grep-invert @enterprise --quiet
```

**Note:** Using `E2E_RETRIES=0` to fail fast on first failure for immediate analysis and fixing.

2. **ALWAYS check for flaky tests after test run completes:**

**CRITICAL:** Tests that fail initially but pass on retry are FLAKY and MUST be investigated, even if the final result shows all tests passed.

a. Check the test output for any tests that failed on first run (look for the initial failure messages before "Retrying")

b. For EACH test that failed initially (even if it passed on retry):
- Parse the error from the test output:
* Error type (e.g., `TimeoutError`, `AssertionError`)
* Error message (e.g., `"waiting for locator('#button') to be visible"`)
* File path and line number where it failed
* Stack trace showing the call chain
- Read the test file at the failing line number to understand what was being tested
- **Report these as FLAKY TESTS** - they indicate timing issues, race conditions, or environmental problems
- **Analyze the root cause**:
* Timeout errors → likely missing waits or race conditions
* Assertion errors → check if value is correct or if timing is off
* Element not found → selector may have changed or element loads slowly

c. **If ANY tests are still failing after automatic retries:**

For EACH failed test, **ALWAYS READ TRACES FIRST:**

1. **Read error-context.md** in the failed test directory:
- Shows exact DOM state when test failed
- YAML tree with all elements, their states, and data-test attributes
- Check if expected elements exist and their actual values
- Verify selector is correct by searching for the data-test attribute

2. **If error-context.md doesn't show the issue**, unzip and check trace files:
```bash
cd frontend/e2e/test-results/<failed-test-directory>
unzip -q trace.zip
grep -i "error\|failed" 0-trace.network # Check for network errors
```

3. **Only after analyzing traces**, read the test file and fix:
- Wrong selector → Update to match actual DOM from error-context.md
- Missing `data-test` attribute → Add it to the component
- Element hidden → Filter for visible elements or wait for visibility
- Missing wait → Add appropriate `waitFor*` calls
- Race condition → Add network waits, increase timeouts, or use more specific waits
- Flaky element interaction → Add `scrollIntoView` or `waitForVisible` before clicking

d. **After making fixes**, re-run ONLY the failed tests:
```bash
cd frontend
E2E_RETRIES=0 SKIP_BUNDLE=1 E2E_CONCURRENCY=1 npm run test -- tests/flag-tests.pw.ts tests/invite-test.pw.ts
```
- Use `E2E_RETRIES=0` to fail fast and see if the fix worked
- Use concurrency=1 to avoid race conditions
- Only run the specific test files that failed

e. **Repeat the fix/re-run cycle:**
- If tests still fail after fixes but the error changed, analyze the new error and fix again
- Re-run failed tests after each fix attempt
- Continue until all tests pass or you've identified unfixable issues
- Maximum 3 fix/re-run cycles per test before reporting as unfixable

3. **Report final results:**
- **ALWAYS report flaky tests first** (tests that failed initially but passed on retry)
- List which tests passed/failed after all retries
- Document any fixes that were applied
- For unfixable issues, explain why and suggest manual investigation
- Show the error message and line number for any failures

## Important Notes

- **DO NOT** just report that retries passed - if tests failed initially, investigate and fix the root cause
- **DO** modify test files to fix timing issues, missing waits, or broken selectors
- **DO** add `data-test` attributes to components if they're missing
- **DON'T** modify test assertions or business logic unless the test is clearly wrong
- If the failure is in application code (not test code), report it as a bug but don't try to fix it
- Always explain what fixes you're attempting and why
- Test files are in TypeScript and use the `helpers.playwright.ts` helper functions
- The built-in retry mechanism is a safety net, not a substitute for fixing flaky tests
Loading
Loading