Skip to content

Commit 768e7c7

Browse files
committed
WIP: Add e2e tests for tree details page (issue #1664)
- Create tree-details.spec.ts with 10 test cases covering: - Navigation to tree details from tree listing - Tab switching (Builds/Boots/Tests) - Filter interactions - Breadcrumb navigation - Status filter functionality - Search input functionality - Detail button clicks (builds/boots/tests) - Issue details navigation - Add TREE_DETAILS_SELECTORS to e2e-selectors.ts - WIP: 6/10 tests passing, 4 tests failing due to selector issues - Failing: commit graph, filter card, build table details, tests table details - Need to investigate DOM structure and fix selectors - Note: Plan to add data-test-id attributes to React components for more reliable test selection - Created WIP_tree-details-e2e.md documenting current state
1 parent b8e4e57 commit 768e7c7

4 files changed

Lines changed: 463 additions & 0 deletions

File tree

WIP_tree-details-e2e.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# Tree Details E2E Tests - Work in Progress
2+
3+
## Summary
4+
5+
Implemented e2e tests for the tree details page (Issue #1664) using Playwright.
6+
7+
## What Was Done
8+
9+
### 1. Created Test Files
10+
- `/home/wilsonneto/www/kernelci/dashboard/e2e/tree-details.spec.ts` - Main test file with 10 test cases
11+
- Updated `/home/wilsonneto/www/kernelci/dashboard/e2e/e2e-selectors.ts` - Added tree details selectors
12+
13+
### 2. Test Cases Implemented
14+
15+
All 10 tests cover the requirements from issue #1664:
16+
17+
1. **Enter on treeListing and select a tree** ✅ PASSING
18+
- Navigate to `/tree`
19+
- Click first tree link
20+
- Verify URL matches `/tree/{treeName}/{branch}/{hash}` pattern
21+
22+
2. **Goes back one commit on commit graph** ❌ FAILING
23+
- Verify breadcrumb is visible
24+
- Verify build history graph is visible
25+
- URL should match `/tree/{tree}/{branch}/{hash}`
26+
27+
3. **Adds a filter with the card and clear all filters** ❌ FAILING
28+
- Click Filters button
29+
- Select Build Status filter
30+
- Verify filter selection
31+
32+
4. **Clicks on details button on build table and goes back via breadcrumb** ❌ FAILING
33+
- Navigate to tree details
34+
- Click details button in build table
35+
- Verify navigation to `/build/`
36+
- Click breadcrumb "Trees"
37+
- Verify navigation back to `/tree`
38+
39+
5. **Clicks on an issue details button on issue card and goes back via breadcrumb** ✅ PASSING
40+
- Navigate to tree details
41+
- Find issue card (conditional if issues exist)
42+
- Click issue details button
43+
- Verify navigation to `/issues/`
44+
- Click breadcrumb "Trees"
45+
- Verify navigation back to `/tree`
46+
47+
6. **Selects other tabs** ✅ PASSING
48+
- Click Boots tab - verify it's active
49+
- Click Tests tab - verify it's active
50+
- Click Builds tab - verify it's active
51+
52+
7. **Clicks on a test item and clicks on detail button for the test item** ❌ FAILING
53+
- Navigate to tree details
54+
- Click Tests tab
55+
- Click on a test item
56+
- Click details button
57+
- Verify navigation to `/test/`
58+
- Click breadcrumb "Trees"
59+
- Verify navigation back to `/tree`
60+
61+
8. **Full workflow: navigate to tree details and back via breadcrumb** ✅ PASSING
62+
- Navigate to `/tree`
63+
- Select a tree
64+
- Click breadcrumb "Trees"
65+
- Verify navigation back to `/tree`
66+
67+
9. **Build table status filters work correctly** ✅ PASSING
68+
- Verify All, Success, Failed, Inconclusive filters are visible
69+
- Click Success filter
70+
- Click All filter
71+
72+
10. **Search input is visible and functional** ✅ PASSING
73+
- Verify search input is visible
74+
- Type "defconfig"
75+
- Verify input has value
76+
77+
### Current Test Results
78+
79+
- **Passing: 6/10 tests**
80+
- **Failing: 4/10 tests**
81+
82+
### Failing Tests Analysis
83+
84+
#### Test 2: "goes back one commit on commit graph"
85+
- **Issue**: Selector `img[alt="Builds History"]` not finding element
86+
- **Root Cause**: The `alt` attribute on the graph image might be different or the image has no alt text
87+
- **Solution Needed**: Investigate actual DOM structure or use a different selector
88+
89+
#### Test 3: "adds a filter with card and clear all filters"
90+
- **Issue**: Selector `.border-dark-gray:has-text("Build status")` matches multiple elements (strict mode violation)
91+
- **Root Cause**: There are 4 "Build status" elements on the page (2 in status cards, 2 in table filters)
92+
- **Solution Needed**: Need more specific selector or use `.first()` / `.nth()`
93+
94+
#### Test 4: "clicks on details button on build table and goes back via breadcrumb"
95+
- **Issue**: Selector `a[href^="/build/"]` timing out / not finding element
96+
- **Root Cause**: Build table might still be loading or element structure different than expected
97+
- **Solution Needed**: Increase wait time or check actual table structure
98+
99+
#### Test 7: "clicks on a test item and clicks on detail button for the test item"
100+
- **Issue**: Same as Test 4 - selector timeout
101+
- **Root Cause**: Tests table loading or element structure different
102+
- **Solution Needed**: Same as Test 4
103+
104+
### Environment Used
105+
106+
Tests configured to run against staging environment:
107+
- **Base URL**: `https://staging.dashboard.kernelci.org:9000`
108+
- **No Authentication Required**: Staging environment is open
109+
- **Playwright Version**: 1.57.0
110+
- **Timeout**: 30 seconds per test
111+
112+
### Next Steps
113+
114+
1. **Fix Selector Issues**: Investigate and update failing selectors based on actual DOM structure
115+
2. **Add data-test-id Attributes**: Plan in place to add `data-test-id` attributes to React components for more reliable selectors
116+
3. **Set Up Local Backend with Test Data**:
117+
- Backend has `seed_test_data.py` command to create realistic test data
118+
- Known test IDs available: `test123`, `issue123`, `build123`, `checkout123`, etc.
119+
- Plan to run backend in tmux session "zai" pane with test database
120+
4. **Update Tests**: After selectors are fixed with `data-test-id`, update e2e tests to use them
121+
5. **Run Against Local Backend**: Verify tests pass with local test data before running against staging
122+
123+
### Files Modified/Created
124+
125+
```
126+
dashboard/e2e/tree-details.spec.ts # Created - 10 test cases
127+
dashboard/e2e/e2e-selectors.ts # Modified - Added TREE_DETAILS_SELECTORS
128+
```
129+
130+
### Test Execution Commands
131+
132+
```bash
133+
# Run all tree-details tests
134+
PLAYWRIGHT_TEST_BASE_URL=https://staging.dashboard.kernelci.org:9000 \
135+
pnpm exec playwright test tree-details --workers=1 --timeout=30000 --reporter=list
136+
137+
# Run a single test
138+
PLAYWRIGHT_TEST_BASE_URL=https://staging.dashboard.kernelci.org:9000 \
139+
pnpm exec playwright test tree-details -g "enter on treeListing" --workers=1
140+
141+
# Run tests with headed mode (for debugging)
142+
PLAYWRIGHT_TEST_BASE_URL=https://staging.dashboard.kernelci.org:9000 \
143+
pnpm exec playwright test tree-details --workers=1 --headed
144+
```
145+
146+
### References
147+
148+
- Issue #1664: https://github.com/kernelci/dashboard/issues/1664
149+
- Backend README: `/backend/README.md` - Database setup and test data seeding
150+
- Seed test data command: `poetry run python3 manage.py seed_test_data`
151+
- Test fixtures: `/backend/kernelCI_app/tests/unitTests/helpers/fixtures/`
152+
153+
---
154+
155+
**Status**: 6/10 tests passing, 4 tests failing due to selector issues
156+
157+
**Next Review**: Friday - Continue fixing failing selectors and setting up local backend

dashboard/e2e/e2e-selectors.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,76 @@ export const COMMON_SELECTORS = {
2727
originDropdown: '[data-test-id="origin-dropdown"]',
2828
originOption: (origin: string) => `[data-test-id="origin-option-${origin}"]`,
2929
} as const;
30+
31+
export const TREE_DETAILS_SELECTORS = {
32+
breadcrumbTreesLink: '[data-test-id="breadcrumb-link"]',
33+
34+
treeHeaderTable: 'table',
35+
36+
tabs: {
37+
builds: 'button:has-text("Builds")',
38+
boots: 'button:has-text("Boots")',
39+
tests: 'button:has-text("Tests")',
40+
},
41+
42+
filters: {
43+
button: 'button:has-text("Filters")',
44+
drawer: 'div[role="dialog"]',
45+
filterButton: 'button:has-text("Filter")',
46+
cancelButton: 'button:has-text("Cancel")',
47+
clearAllFilters: 'text="Clear all"',
48+
},
49+
50+
buildHistoryGraph: 'img[alt="Builds History"]',
51+
52+
statusCard: {
53+
title: '.border-dark-gray:has-text("Build status")',
54+
statusButton: (status: string) => `.border-dark-gray button:has-text("${status}")`,
55+
},
56+
57+
summaryCards: {
58+
arch: 'text="Summary"',
59+
},
60+
61+
issuesCard: {
62+
title: 'text="Issues"',
63+
button: 'button[aria-label="Issues"]',
64+
},
65+
66+
buildTable: {
67+
table: 'table',
68+
statusFilters: {
69+
all: 'button:has-text("All:")',
70+
success: 'button:has-text("Success:")',
71+
failed: 'button:has-text("Failed:")',
72+
inconclusive: 'button:has-text("Inconclusive:")',
73+
},
74+
searchInput: 'input[placeholder*="Search"]',
75+
detailsButton: 'a[href^="/build/"]',
76+
},
77+
78+
bootsTable: {
79+
statusFilters: {
80+
all: 'button:has-text("All:")',
81+
success: 'button:has-text("Success:")',
82+
failed: 'button:has-text("Failed:")',
83+
inconclusive: 'button:has-text("Inconclusive:")',
84+
},
85+
detailsButton: 'a[href^="/test/"]',
86+
},
87+
88+
testsTable: {
89+
statusFilters: {
90+
all: 'button:has-text("All:")',
91+
success: 'button:has-text("Success:")',
92+
failed: 'button:has-text("Failed:")',
93+
inconclusive: 'button:has-text("Inconclusive:")',
94+
},
95+
testItem: 'tr',
96+
detailsButton: 'a[href^="/test/"]',
97+
},
98+
99+
configTable: {
100+
link: (config: string) => `a:has-text("${config}")`,
101+
},
102+
} as const;

0 commit comments

Comments
 (0)