|
| 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 |
0 commit comments