-
Notifications
You must be signed in to change notification settings - Fork 13
feat(compare): replace index card walls with GPU pair selection matrices #600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Oseltamivir
wants to merge
6
commits into
master
Choose a base branch
from
feat/compare-index-matrix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6424aa6
feat(compare): replace index card walls with GPU pair selection matrices
Oseltamivir d24e7d6
fix(compare): port index matrices to /zh and preserve focus highlight
Oseltamivir 5b24bd5
fix(compare): label matrix cells in canonical pair order
Oseltamivir 1acdfd8
fix(compare): pin matrix vendor block order instead of deriving it
Oseltamivir 822b135
fix(compare): stretch index matrices to full card width on desktop
Oseltamivir 2c49d6b
feat(compare): flip index matrices to lower triangle and mark linked …
Oseltamivir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| describe('Compare index matrix', () => { | ||
| beforeEach(() => { | ||
| cy.window().then((win) => { | ||
| win.localStorage.setItem('inferencex-star-modal-dismissed', String(Date.now())); | ||
| }); | ||
| }); | ||
|
|
||
| it('renders one matrix per model section with linked + ghost cells on /compare', () => { | ||
| cy.visit('/compare'); | ||
| cy.get('[data-testid="compare-pair-matrix"]').should('have.length.greaterThan', 0); | ||
|
|
||
| // Every model section renders exactly one matrix. | ||
| cy.get('section[id]').then(($sections) => { | ||
| const withMatrix = $sections.filter( | ||
| (_, s) => s.querySelector('[data-testid="compare-pair-matrix"]') !== null, | ||
| ); | ||
| cy.get('[data-testid="compare-pair-matrix"]').should('have.length', withMatrix.length); | ||
| }); | ||
|
|
||
| // Available pairs are real links under /compare/<model>-<a>-vs-<b>. | ||
| cy.get('a[data-testid="compare-matrix-cell"]') | ||
| .should('have.length.greaterThan', 0) | ||
| .first() | ||
| .should('have.attr', 'href') | ||
| .and('match', /^\/compare\/[a-z0-9-]+-[a-z0-9]+-vs-[a-z0-9]+$/u); | ||
|
|
||
| // Pairs without benchmark data render as non-link ghost cells (the | ||
| // fixtures' availability is sparse, so ghosts always exist). | ||
| cy.get('[data-testid="compare-matrix-empty-cell"]').should('have.length.greaterThan', 0); | ||
|
|
||
| // Anchor text (sr-only) carries the pair name for crawlers. | ||
| cy.get('a[data-testid="compare-matrix-cell"]').first().invoke('text').should('match', /vs/u); | ||
| }); | ||
|
|
||
| it('navigates to the pair page when a cell is clicked', () => { | ||
| cy.visit('/compare'); | ||
| cy.get('a[data-testid="compare-matrix-cell"]') | ||
| .first() | ||
| .then(($a) => { | ||
| const href = $a.attr('href')!; | ||
| cy.wrap($a).click(); | ||
| cy.location('pathname').should('eq', href); | ||
| }); | ||
| }); | ||
|
|
||
| it('shows the focused pair in the readout line (same path as hover)', () => { | ||
| cy.visit('/compare'); | ||
| // React's onMouseEnter is delegated and unreachable via cy.trigger — the | ||
| // keyboard focus handler updates the same readout state, so exercise that. | ||
| cy.get('a[data-testid="compare-matrix-cell"]').first().focus(); | ||
| cy.get('a[data-testid="compare-matrix-cell"]') | ||
| .first() | ||
| .invoke('attr', 'title') | ||
| .then((label) => { | ||
| cy.get('[data-testid="compare-matrix-readout"]').first().should('contain.text', label); | ||
| }); | ||
| }); | ||
|
|
||
| it('renders per-dollar matrices with /compare-per-dollar cell hrefs', () => { | ||
| cy.visit('/compare-per-dollar'); | ||
| cy.get('[data-testid="compare-pair-matrix"]').should('have.length.greaterThan', 0); | ||
| cy.get('a[data-testid="compare-matrix-cell"]') | ||
| .first() | ||
| .should('have.attr', 'href') | ||
| .and('match', /^\/compare-per-dollar\//u); | ||
| }); | ||
|
|
||
| it('renders the zh matrices with /zh hrefs and Chinese legend strings', () => { | ||
| cy.visit('/zh/compare'); | ||
| cy.get('[data-testid="compare-pair-matrix"]').should('have.length.greaterThan', 0); | ||
| cy.get('a[data-testid="compare-matrix-cell"]') | ||
| .first() | ||
| .should('have.attr', 'href') | ||
| .and('match', /^\/zh\/compare\//u); | ||
| cy.contains('暂无基准测试数据').should('exist'); | ||
| cy.contains('点击单元格查看对比').should('exist'); | ||
| }); | ||
|
|
||
| it('renders the zh per-dollar matrices with /zh/compare-per-dollar hrefs', () => { | ||
| cy.visit('/zh/compare-per-dollar'); | ||
| cy.get('a[data-testid="compare-matrix-cell"]') | ||
| .first() | ||
| .should('have.attr', 'href') | ||
| .and('match', /^\/zh\/compare-per-dollar\//u); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.