Skip to content

fix(test-details): show tree breadcrumbs without navigation context - #2222

Open
nuclearcat wants to merge 1 commit into
kernelci:mainfrom
nuclearcat:fix/2001/test-breadcrumb-fallback
Open

nuclearcat wants to merge 1 commit into
kernelci:mainfrom
nuclearcat:fix/2001/test-breadcrumb-fallback

Conversation

@nuclearcat

Copy link
Copy Markdown
Member

Opening a copied test URL currently removes the breadcrumb row because the page depends on browser history state. This change shows Trees > Trees Details > Test Details using the test's checkout metadata when that context is missing.

Existing Hardware and Trees navigation keeps its breadcrumbs. Fallback links use the checkout origin rather than stale listing state or the test origin. If the commit hash is missing, Trees Details stays visible as text without a broken link.

Issue #2001 has remained unaddressed for some time, so I am taking over the fix.

Closes #2001.

Validation

  • Production build and TypeScript checks passed.
  • ESLint passed for the changed files.
  • All 168 Vitest tests passed.
  • Five Playwright tests passed with mocked API responses, covering direct links, reload, breadcrumb navigation, incomplete checkout metadata, existing context, and copied URLs in a new tab.
  • Screenshots are attached in a PR comment. They show the local frontend with deterministic API data. Production browser verification was blocked by Anubis.

Reproduce

From dashboard/, install dependencies with pnpm install --frozen-lockfile and install Chromium with pnpm exec playwright install chromium if needed.

  1. Start the frontend with VITE_API_BASE_URL=http://127.0.0.1:5173 pnpm dev --host 127.0.0.1 --port 5173.
  2. In another terminal, run PLAYWRIGHT_TEST_BASE_URL=http://127.0.0.1:5173 pnpm e2e test-breadcrumb.spec.ts. These tests provide their own API responses, so no backend is needed.
  3. With a working API, open a test through Hardware and confirm its Hardware breadcrumbs. Copy the final test URL into a fresh tab and confirm the Trees fallback appears. Follow Trees Details and check that it opens the test's commit under the checkout origin.

Use the test's checkout metadata for fallback breadcrumb links and preserve
existing Hardware and Trees navigation. Keep the details label unlinked
when the commit hash is missing.

Issue kernelci#2001 has remained unaddressed for some time, so I am taking over
the fix.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
@nuclearcat

Copy link
Copy Markdown
Member Author

Local browser verification with deterministic API responses. The first screenshot shows a directly opened test with the Trees fallback; the second shows preserved Hardware navigation context. All five breadcrumb browser tests passed.

Direct test URL with Trees fallback

Hardware navigation context preserved

@felipebergamin felipebergamin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a small nit. No blockers.

Comment on lines +595 to +614
{breadcrumb ??
(data && (
<MemoizedTreeBreadcrumb
locationMessage="test.details"
tree={{
treeName: data.tree_name,
branch: data.git_repository_branch,
id: data.git_commit_hash,
}}
searchParams={{
origin: data.origin,
treeInfo: {
treeName: data.tree_name,
gitBranch: data.git_repository_branch,
gitUrl: data.git_repository_url,
headCommitHash: data.git_commit_hash,
},
}}
/>
))}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the component is memoized but tree and searchParams are recreated on every render. This practically negates memoization

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent design on tests

3 participants