Skip to content

Commit 06b8a82

Browse files
committed
wip
1 parent b21d535 commit 06b8a82

4 files changed

Lines changed: 87 additions & 3 deletions

File tree

dashboard/e2e/selectors/tree-details.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const TREE_DETAILS_SELECTORS = {
1212
filters: {
1313
button: 'button:has-text("Filters")',
1414
drawer: 'aside',
15+
drawerContent: '[role="dialog"]',
1516
filterButton: '[data-test-id="filter-button"]',
1617
cancelButton: '[data-test-id="filter-cancel-button"]',
1718
clearAllFilters: 'text="Clear all"',
@@ -64,10 +65,17 @@ export const TREE_DETAILS_SELECTORS = {
6465
inconclusive: 'button:has-text("Inconclusive:")',
6566
},
6667
testItem: 'tr',
68+
expandedRows: 'tr:has(td[colspan])',
6769
detailsButton: '[data-test-id="details-button"]',
6870
},
6971

7072
configTable: {
7173
link: (config: string) => `a:has-text("${config}")`,
7274
},
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+
},
7381
} as const;

dashboard/e2e/tree-details.spec.ts

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { TREE_DETAILS_SELECTORS, TREE_LISTING_SELECTORS } from './selectors';
44

55
test.describe('Tree Details Page Tests', () => {
66
const TREE_URL =
7-
'/tree/mainline/master/c072629f05d7bca1148ab17690d7922a31423984';
7+
'tree/android/android-mainline/7c5912a7c78d669e825093b8cbb57e6afaa88d11';
88

99
test.beforeEach(async ({ page }) => {
1010
const timeout = 60000;
@@ -130,7 +130,9 @@ test.describe('Tree Details Page Tests', () => {
130130

131131
await page.waitForTimeout(3000);
132132

133-
const expandedRows = page.locator('tr:has(td[colspan])');
133+
const expandedRows = page.locator(
134+
TREE_DETAILS_SELECTORS.testsTable.expandedRows,
135+
);
134136
const hasExpandedRows = (await expandedRows.count()) > 0;
135137

136138
if (hasExpandedRows) {
@@ -220,4 +222,75 @@ test.describe('Tree Details Page Tests', () => {
220222

221223
await expect(searchInput).toHaveValue('defconfig');
222224
});
225+
226+
test('navigates back one commit via commit graph', async ({ page }) => {
227+
await page.goto(TREE_URL, { timeout: 30000 });
228+
await page.waitForLoadState('domcontentloaded');
229+
230+
const currentUrl = page.url();
231+
232+
// Wait for a visible commit graph (there may be multiple, get the last visible one)
233+
const commitGraphContainer = page
234+
.locator(TREE_DETAILS_SELECTORS.commitGraph.container)
235+
.last();
236+
await expect(commitGraphContainer).toBeVisible({ timeout: 30000 });
237+
238+
// Wait a bit for the graph to fully render
239+
await page.waitForTimeout(2000);
240+
241+
// Look for clickable marks in the visible graph
242+
const marks = commitGraphContainer.locator('[class*="MuiMarkElement"]');
243+
const markCount = await marks.count();
244+
245+
// Ensure we actually have marks to click
246+
expect(markCount).toBeGreaterThan(0);
247+
248+
// Click on the first mark (data point in the commit history)
249+
await marks.first().click({ force: true });
250+
251+
// Wait for navigation to complete
252+
await page.waitForTimeout(2000);
253+
254+
const newUrl = page.url();
255+
256+
// Verify URL changed (navigated to a different commit)
257+
expect(newUrl).not.toBe(currentUrl);
258+
expect(newUrl).toMatch(/\/tree\//);
259+
});
260+
261+
test('clears all filters', async ({ page }) => {
262+
await page.goto(TREE_URL, { timeout: 30000 });
263+
await page.waitForLoadState('domcontentloaded');
264+
265+
// Open the filters drawer
266+
const filterButton = page.locator(TREE_DETAILS_SELECTORS.filters.button);
267+
await filterButton.waitFor({ state: 'visible', timeout: 10000 });
268+
await filterButton.click();
269+
270+
// Wait for the drawer content to be visible (it's in a portal)
271+
const drawerContent = page.locator(
272+
TREE_DETAILS_SELECTORS.filters.drawerContent,
273+
);
274+
await expect(drawerContent).toBeVisible({ timeout: 10000 });
275+
276+
// Check if "Clear all" button exists and click it
277+
const clearAllButton = page.locator(
278+
TREE_DETAILS_SELECTORS.filters.clearAllFilters,
279+
);
280+
const hasClearAllButton = (await clearAllButton.count()) > 0;
281+
282+
if (hasClearAllButton) {
283+
await clearAllButton.click();
284+
285+
await page.waitForTimeout(1000);
286+
}
287+
288+
const cancelButton = page.locator(
289+
TREE_DETAILS_SELECTORS.filters.cancelButton,
290+
);
291+
await expect(cancelButton).toBeVisible();
292+
await cancelButton.click();
293+
294+
await expect(drawerContent).not.toBeVisible();
295+
});
223296
});

dashboard/src/components/CommitNavigationGraph/CommitNavigationGraph.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ const CommitNavigationGraph = ({
242242
title={formatMessage({ id: messagesId.graphName })}
243243
content={
244244
<LineChart
245+
dataTestId="commit-navigation-graph"
245246
xAxis={xAxis}
246247
series={series}
247248
slots={{

dashboard/src/components/LineChart/LineChart.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export type TLineChartProps = {
3434
onMarkClick?: MUILineChartProps['onMarkClick'];
3535
slots?: MUILineChartProps['slots'];
3636
slotProps?: MUILineChartProps['slotProps'];
37+
dataTestId?: string;
3738
};
3839

3940
export const LineChart = ({
@@ -44,9 +45,10 @@ export const LineChart = ({
4445
slotProps,
4546
sx,
4647
onMarkClick,
48+
dataTestId,
4749
}: TLineChartProps): JSX.Element => {
4850
return (
49-
<div className="px-4">
51+
<div className="px-4" data-test-id={dataTestId}>
5052
{labels && (
5153
<div className="mt-3 mb-0 flex justify-end gap-2">{labels}</div>
5254
)}

0 commit comments

Comments
 (0)