Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/app/src/features/auth/account-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ export function AccountBar() {
</div> : <Link to="/auth/login" className="rounded-lg px-3 py-2 text-sm font-semibold">Account</Link>}
</div>
</nav>
{authenticated && (pathname === "/" || pathname === "/projects") && <nav aria-label="Dashboard navigation" className="border-t border-stone-200 dark:border-slate-800">
<div className="mx-auto flex w-full max-w-6xl gap-1 overflow-x-auto px-4 sm:px-6 lg:px-8">
<Link to="/projects" className={`inline-flex min-h-12 shrink-0 items-center border-b-2 px-3 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-factorize-500 ${pathname === "/projects" ? "border-factorize-500 text-factorize-700 dark:text-factorize-500" : "border-transparent text-slate-600 hover:border-stone-300 hover:text-slate-950 dark:text-slate-300 dark:hover:border-slate-600 dark:hover:text-white"}`} aria-current={pathname === "/projects" ? "page" : undefined}>Projects</Link>
</div>
</nav>}
{logout.isError && <p role="alert">{logout.error.message}</p>}
</header>;
}
31 changes: 31 additions & 0 deletions packages/app/test/jobs.browser.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,37 @@ test("project tabs stay on projects while job detail gets Runs and Settings navi
assert.equal(await page.getByRole("navigation", { name: "Job navigation" }).getByRole("link", { name: "Settings", exact: true }).getAttribute("aria-current"), "page");
await context.close();
});
test("dashboard Projects subnav completes keyboard navigation into project Jobs", async () => {
const { page, context } = await contextFor({ viewport: { width: 390, height: 844 } });
await page.route("**/api/v1/projects", route => route.fulfill({ json: [{ id: projectId, name: "Release project", description: "Project jobs", jobCount: 1 }] }));
await page.route("**/api/v1/job-summaries?**", route => route.fulfill({ json: { items: [{ ...summary }], nextCursor: null } }));

await page.goto(origin + "/projects");
const dashboardNav = page.getByRole("navigation", { name: "Dashboard navigation" });
const projectsTab = dashboardNav.getByRole("link", { name: "Projects", exact: true });
await projectsTab.waitFor();
assert.equal(await projectsTab.getAttribute("aria-current"), "page");
assert.equal(await projectsTab.evaluate(element => getComputedStyle(element.parentElement).overflowX), "auto");

const dashboard = page.getByRole("link", { name: "Factorize dashboard" });
await dashboard.focus();
await page.keyboard.press("Enter");
await page.getByRole("heading", { name: "Recent work" }).waitFor();
assert.equal(await dashboardNav.getByRole("link", { name: "Projects", exact: true }).getAttribute("aria-current"), null);

const dashboardProjects = dashboardNav.getByRole("link", { name: "Projects", exact: true });
await dashboardProjects.focus();
await page.keyboard.press("Enter");
await page.getByRole("heading", { name: "Projects", exact: true }).waitFor();
assert.equal(await dashboardNav.getByRole("link", { name: "Projects", exact: true }).getAttribute("aria-current"), "page");

const project = page.getByRole("link", { name: /Release project/ });
await project.focus();
await page.keyboard.press("Enter");
await page.getByRole("heading", { name: "Release project jobs", exact: true }).waitFor();
assert.equal(await page.getByRole("navigation", { name: "Project navigation" }).getByRole("link", { name: "Jobs", exact: true }).getAttribute("aria-current"), "page");
await context.close();
});
test("main navigation shows the current project switcher inside a project and its jobs", async () => {
const { page, context } = await contextFor({ viewport: { width: 1280, height: 844 } });
await page.route("**/api/v1/projects", route => route.fulfill({ json: [{ id: projectId, name: "Release project", description: "Project jobs", jobCount: 1 }] }));
Expand Down
Loading