test(tuning): assert headers by exact accessible name — #2495
test-web / test (push) Successful in 34s

Third attempt at the same assertion, so I stopped guessing and got vitest
running locally instead: the web lane uses the same ci-go image, so
`docker run ... -w /src/web ci-go:1.26 npx vitest run` works and turns a
5-minute CI round trip into 7 seconds.

/^Skip/ matched the "Skip rate by week" sparkline column as well as
"Skip (last wk)", just as /Plays/ had matched the caption. Exact names
say what the assertion means and cannot drift onto a neighbour.

Verified locally before pushing: svelte-check 0 errors, 110 files /
786 tests pass.
This commit is contained in:
2026-08-06 21:27:22 -04:00
parent 96abb48086
commit 304de88c50
+5 -2
View File
@@ -213,8 +213,11 @@ describe('Admin tuning page', () => {
// //
// Queried as column headers rather than by text: the caption below also // Queried as column headers rather than by text: the caption below also
// mentions "Plays", and matching on the word finds the prose too. // mentions "Plays", and matching on the word finds the prose too.
expect(screen.getByRole('columnheader', { name: /Plays/ })).toHaveTextContent('(window)'); // Exact accessible names: /^Skip/ also matches the "Skip rate by week"
expect(screen.getByRole('columnheader', { name: /^Skip/ })).toHaveTextContent('(last wk)'); // sparkline column, and /Plays/ matched the caption prose before that.
expect(screen.getByRole('columnheader', { name: 'Plays (window)' })).toBeInTheDocument();
expect(screen.getByRole('columnheader', { name: 'Skip (last wk)' })).toBeInTheDocument();
expect(screen.getByRole('columnheader', { name: 'Completion (last wk)' })).toBeInTheDocument();
// The knob turn is listed under the chart AND tooltipped on each // The knob turn is listed under the chart AND tooltipped on each
// sparkline's marker tick, hence getAllBy. // sparkline's marker tick, hence getAllBy.
expect( expect(