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
40 changes: 36 additions & 4 deletions packages/app/cypress/component/header.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,26 @@ describe('Header', () => {
cy.get('[data-testid="nav-link-compare"]').should('have.attr', 'href', '/compare');
});

it('shows Datasets as a top-level nav link and highlights dataset child pages', () => {
cy.get('[data-testid="nav-link-datasets"]')
.should('be.visible')
.and('have.attr', 'href', '/datasets');

mountHeader('/datasets/claude-code-traces');
cy.get('[data-testid="nav-link-datasets"]').should('have.class', 'text-brand');
});

it('keeps Datasets in the Chinese navigation tree', () => {
mountHeader('/zh/datasets');
cy.get('[data-testid="nav-link-datasets"]')
.should('be.visible')
.and('contain.text', '数据集')
.and('have.attr', 'href', '/zh/datasets')
.and('have.class', 'text-brand');
});

it('keeps footer destinations out of the primary nav', () => {
cy.get('[data-testid="nav-link-supporters"]').should('not.exist');
cy.get('[data-testid="nav-link-datasets"]').should('not.exist');
cy.get('[data-testid="nav-link-blog"]').should('not.exist');
});

Expand All @@ -134,8 +151,8 @@ describe('Header', () => {
cy.contains('a', 'Overview').should('be.visible').and('have.attr', 'href', '/overview');
cy.contains('a', 'Dashboard').should('be.visible').and('have.attr', 'href', '/inference');
cy.contains('a', 'Comparisons').should('be.visible').and('have.attr', 'href', '/compare');
cy.contains('a', 'Datasets').should('be.visible').and('have.attr', 'href', '/datasets');
cy.contains('a', 'Supporters').should('not.exist');
cy.contains('a', 'Datasets').should('not.exist');
cy.contains('a', 'Articles').should('not.exist');
});
});
Expand All @@ -150,6 +167,21 @@ describe('Header', () => {
cy.wrap(mockRouter.push).should('have.been.calledTwice');
});

it('keeps every primary link inside the header at the desktop breakpoint', () => {
cy.viewport(1024, 720);
cy.get('[data-testid="header"]').then(($header) => {
const header = $header[0];
const bounds = header.getBoundingClientRect();
expect(header.scrollWidth, 'header scrollWidth').to.be.at.most(header.clientWidth);

cy.get('[data-testid^="nav-link-"]:visible').each(($link) => {
const rect = $link[0].getBoundingClientRect();
expect(rect.left, `${$link.text()} left edge`).to.be.at.least(bounds.left - EPSILON);
expect(rect.right, `${$link.text()} right edge`).to.be.at.most(bounds.right + EPSILON);
});
});
});

describe('at 320x700', () => {
beforeEach(() => {
cy.viewport(320, 700);
Expand Down Expand Up @@ -205,10 +237,10 @@ describe('Header', () => {
cy.get('[data-testid="mobile-menu-toggle"]').click();
cy.get('[data-testid="mobile-menu"]').should('be.visible');
cy.get('[data-testid="mobile-menu"]').within(() => {
['Home', 'Overview', 'Dashboard', 'Comparisons', 'About'].forEach((label) => {
['Home', 'Overview', 'Dashboard', 'Comparisons', 'Datasets', 'About'].forEach((label) => {
cy.contains('a', label).should('be.visible');
});
['Supporters', 'Datasets', 'Articles'].forEach((label) => {
['Supporters', 'Articles'].forEach((label) => {
cy.contains('a', label).should('not.exist');
});
});
Expand Down
5 changes: 5 additions & 0 deletions packages/app/cypress/e2e/navigation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ describe('First-load navigation', () => {
cy.location('pathname').should('eq', '/compare');
});

it('navigates to datasets from the header with one click', () => {
cy.get('[data-testid="nav-link-datasets"]').should('have.attr', 'href', '/datasets').click();
cy.location('pathname').should('eq', '/datasets');
});

it('navigates to overview and the full dashboard from the landing CTAs', () => {
cy.get('[data-testid="landing-overview-link"]')
.should('have.attr', 'href', '/overview')
Expand Down
6 changes: 6 additions & 0 deletions packages/app/cypress/e2e/zh-pages.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ describe('Chinese (/zh) pages', () => {
cy.get('[data-testid="language-toggle"]').should('have.attr', 'href', '/');
});

it('header links to the Chinese datasets page', () => {
cy.get('[data-testid="nav-link-datasets"]')
.should('contain.text', '数据集')
.and('have.attr', 'href', '/zh/datasets');
});

it('footer renders in Chinese with zh-internal links', () => {
cy.get('[data-testid="footer-brand-description"]').should('contain.text', '开源推理基准测试');
cy.get('[data-testid="footer-link-supporters"]')
Expand Down
6 changes: 6 additions & 0 deletions packages/app/src/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ const NAV_LINKS = [
testId: 'nav-link-compare',
event: 'header_compare_clicked',
},
{
href: '/datasets',
label: 'Datasets',
testId: 'nav-link-datasets',
event: 'header_datasets_clicked',
},
{ href: '/about', label: 'About', testId: 'nav-link-about', event: 'header_about_clicked' },
] as const;

Expand Down
1 change: 1 addition & 0 deletions packages/app/src/lib/tab-meta-zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export const NAV_LABELS_ZH: Record<string, string> = {
'/overview': '总览',
'/inference': '仪表板',
'/compare': 'Chip 对比',
'/datasets': '数据集',
'/about': '关于',
};

Expand Down
Loading