Skip to content

Commit 9948da4

Browse files
committed
test(e2e): add tree details e2e tests and refactor test utilities
- Add tree-details.spec.ts covering filter drawer, tab switching, status filters, search, commit graph navigation, and breadcrumb flows - Extract selectors into dedicated modules (common, tree-listing, tree-details) and shared utils (navigation, filters) for reuse - Instrument components with data-test-id attributes (Breadcrumb, BaseCard, Drawer, LineChart, StatusCharts, TableCellWithLink) to support stable e2e selectors - Refactor tree-listing.spec.ts to consume the new shared helpers Closes #1664
1 parent 53e3a3d commit 9948da4

23 files changed

Lines changed: 658 additions & 60 deletions

dashboard/e2e/e2e-selectors.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,77 @@ 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-trees-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: 'aside',
45+
filterButton: '[data-test-id="filter-button"]',
46+
cancelButton: '[data-test-id="filter-cancel-button"]',
47+
clearAllFilters: 'text="Clear all"',
48+
},
49+
50+
buildHistoryGraph: 'img',
51+
52+
statusCard: {
53+
title: '.flex-col:has(div:has-text("Build status"))',
54+
titleFirst: '.flex-col:has(div:has-text("Build status"))',
55+
statusButton: (status: string) => `[data-test-id="${status}"]`,
56+
},
57+
58+
summaryCards: {
59+
arch: 'text="Summary"',
60+
},
61+
62+
issuesCard: {
63+
title: 'text="Issues"',
64+
button: 'button[aria-label="Issues"]',
65+
},
66+
67+
buildTable: {
68+
table: 'table',
69+
statusFilters: {
70+
all: 'button:has-text("All:")',
71+
success: 'button:has-text("Success:")',
72+
failed: 'button:has-text("Failed:")',
73+
inconclusive: 'button:has-text("Inconclusive:")',
74+
},
75+
searchInput: 'input[placeholder*="Search"]',
76+
detailsButton: '[data-test-id="details-button"]',
77+
},
78+
79+
bootsTable: {
80+
statusFilters: {
81+
all: 'button:has-text("All:")',
82+
success: 'button:has-text("Success:")',
83+
failed: 'button:has-text("Failed:")',
84+
inconclusive: 'button:has-text("Inconclusive:")',
85+
},
86+
detailsButton: '[data-test-id="details-button"]',
87+
},
88+
89+
testsTable: {
90+
statusFilters: {
91+
all: 'button:has-text("All:")',
92+
success: 'button:has-text("Success:")',
93+
failed: 'button:has-text("Failed:")',
94+
inconclusive: 'button:has-text("Inconclusive:")',
95+
},
96+
testItem: 'tr',
97+
detailsButton: '[data-test-id="details-button"]',
98+
},
99+
100+
configTable: {
101+
link: (config: string) => `a:has-text("${config}")`,
102+
},
103+
} as const;

dashboard/e2e/selectors/common.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export const COMMON_SELECTORS = {
2+
tableRow: 'tr',
3+
tableHeader: 'th',
4+
5+
originDropdown: '[data-test-id="origin-dropdown"]',
6+
originOption: (origin: string) => `[data-test-id="origin-option-${origin}"]`,
7+
} as const;

dashboard/e2e/selectors/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from './common';
2+
export * from './tree-listing';
3+
export * from './tree-details';
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
export const TREE_DETAILS_SELECTORS = {
2+
breadcrumbTreesLink: '[data-test-id="breadcrumb-trees-link"]',
3+
4+
treeHeaderTable: 'table',
5+
6+
tabs: {
7+
builds: 'button:has-text("Builds")',
8+
boots: 'button:has-text("Boots")',
9+
tests: 'button:has-text("Tests")',
10+
},
11+
12+
filters: {
13+
button: 'button:has-text("Filters")',
14+
drawer: 'aside',
15+
drawerContent: '[role="dialog"]',
16+
filterButton: '[data-test-id="filter-button"]',
17+
cancelButton: '[data-test-id="filter-cancel-button"]',
18+
clearAllFilters: 'text="Clear all"',
19+
},
20+
21+
buildHistoryGraph: 'img',
22+
23+
statusCard: {
24+
title: '.flex-col:has(div:has-text("Build status"))',
25+
titleFirst: '.flex-col:has(div:has-text("Build status"))',
26+
statusButton: (status: string) => `[data-test-id="${status}"]`,
27+
},
28+
29+
summaryCards: {
30+
arch: 'text="Summary"',
31+
},
32+
33+
issuesCard: {
34+
title: 'text="Issues"',
35+
button: 'button[aria-label="Issues"]',
36+
},
37+
38+
buildTable: {
39+
table: 'table',
40+
statusFilters: {
41+
all: 'button:has-text("All:")',
42+
success: 'button:has-text("Success:")',
43+
failed: 'button:has-text("Failed:")',
44+
inconclusive: 'button:has-text("Inconclusive:")',
45+
},
46+
searchInput: 'input[placeholder*="Search"]',
47+
detailsButton: '[data-test-id="details-button"]',
48+
},
49+
50+
bootsTable: {
51+
statusFilters: {
52+
all: 'button:has-text("All:")',
53+
success: 'button:has-text("Success:")',
54+
failed: 'button:has-text("Failed:")',
55+
inconclusive: 'button:has-text("Inconclusive:")',
56+
},
57+
detailsButton: '[data-test-id="details-button"]',
58+
},
59+
60+
testsTable: {
61+
statusFilters: {
62+
all: 'button:has-text("All:")',
63+
success: 'button:has-text("Success:")',
64+
failed: 'button:has-text("Failed:")',
65+
inconclusive: 'button:has-text("Inconclusive:")',
66+
},
67+
testItem: 'tr',
68+
expandedRows: 'tr:has(td[colspan])',
69+
detailsButton: '[data-test-id="details-button"]',
70+
},
71+
72+
configTable: {
73+
link: (config: string) => `a:has-text("${config}")`,
74+
},
75+
76+
commitGraph: {
77+
container: '[data-test-id="commit-navigation-graph"]',
78+
svg: '[data-test-id="commit-navigation-graph"] svg',
79+
marks: '[data-test-id="commit-navigation-graph"] [class*="MuiMarkElement"]',
80+
},
81+
} as const;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export const TREE_LISTING_SELECTORS = {
2+
table: 'table',
3+
treeColumnHeader: 'th button:has-text("Tree")',
4+
branchColumnHeader: 'th button:has-text("Branch")',
5+
6+
intervalInput: 'input[type="number"][min="1"]',
7+
8+
itemsPerPageDropdown: '[role="listbox"]',
9+
itemsPerPageOption: (value: string) => `[role="option"]:has-text("${value}")`,
10+
11+
searchInput: 'input[type="text"]',
12+
13+
nextPageButton: '[role="button"]:has-text(">")',
14+
previousPageButton: '[role="button"]:has-text("<")',
15+
16+
treeNameCell: (treeName: string) => `td a:has-text("${treeName}")`,
17+
firstTreeCell: 'td a',
18+
19+
breadcrumbTreesLink: '[data-test-id="breadcrumb-link"]:has-text("Trees")',
20+
} as const;

0 commit comments

Comments
 (0)