Skip to content

chore(tables): replace hardcoded test data with deterministic fixtures#506

Merged
kelsos merged 1 commit into
rotki:mainfrom
kelsos:chore/tables-deterministic-fixtures
Apr 21, 2026
Merged

chore(tables): replace hardcoded test data with deterministic fixtures#506
kelsos merged 1 commit into
rotki:mainfrom
kelsos:chore/tables-deterministic-fixtures

Conversation

@kelsos
Copy link
Copy Markdown
Member

@kelsos kelsos commented Apr 21, 2026

Summary

Cherry-picks the fixture / story-data portions out of #492 so they can land independently of the broader DataTable decomposition.

  • `apps/example/src/data/table-configs.ts` — replaces the hand-written `fixedRows` array (and the unused `sampleData` export) with a small generator driven by fixed name/city/street/website lists. Produces deterministic rows whose values are predictable from the index.
  • `packages/ui-library/src/components/tables/RuiDataTable.stories.ts` — same treatment for the story `data` array, plus eight new stories that exercise existing props: `WithSearch`, `RoundedSmall`, `RoundedLarge`, `DisabledRows`, `MultiPageSelect`, `CustomItemClass`, `HiddenHeaderAndFooter`, `GroupedWithExpandButtonEnd`.
  • `apps/example/e2e/data-table.spec.ts` — swaps `'Chelsey'`/`'chelsey'`/`'CHELSEY'` search queries for `'Alice'` to match the new fixtures.

Bug fix

The story `render` function's template bound `v-model:expanded`, `v-model:group`, `v-model:collapsed` to `args.*` directly while the `setup` block exposed matching `computed` refs that wrapped them. Changes coming back from the table didn't flow through the computed wrappers, so Storybook didn't re-render. Fixed by binding to the computed refs. (Same bug-fix as #492.)

Test plan

  • `pnpm lint`
  • `pnpm typecheck`
  • `pnpm test:run` — 1029 tests pass
  • `pnpm build:prod`
  • `pnpm test:e2e` — 266 e2e tests pass

Extracts the ad-hoc row arrays used by RuiDataTable stories and the
example-app e2e suite into small generator functions driven by a fixed
list of names/titles/roles, producing deterministic rows. Uses the same
fixture set across stories and e2e so a test searching for "Alice"
finds the same rows whether Storybook or Playwright is driving.

Also fixes a stale-binding bug in the stories' `render`: `v-model:expanded`,
`v-model:group` and `v-model:collapsed` bound to `args.*` directly
instead of the `computed` refs returned from `setup`, so changes from
the table wouldn't re-render. Now bound to the local computed refs.

Adds eight stories that already work against the existing DataTable
props: `WithSearch`, `RoundedSmall`, `RoundedLarge`, `DisabledRows`,
`MultiPageSelect`, `CustomItemClass`, `HiddenHeaderAndFooter`,
`GroupedWithExpandButtonEnd`. Useful for Storybook visual review and
future interaction tests.

Cherry-picked from rotki#492 — only the fixture / story-data portions; the
broader DataTable decomposition stays in review.
@kelsos kelsos requested a review from a team as a code owner April 21, 2026 15:35
@kelsos kelsos merged commit 63836d5 into rotki:main Apr 21, 2026
5 of 7 checks passed
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.

1 participant