Skip to content

test: set up unit, integration and e2e tests #484

Open

Description

@uniqueg

Context

Since #478, CI runs no tests at all. The test scripts were removed from all packages without test files, because Web Test Runner (WTR) 0.19 exits with "Could not find any test files", which failed the turbo test task, and with it the Test job of every PR. Turbo now skips every package, so the Test (Node 22/24) jobs install Playwright, build and then test nothing.

Current state of the test setup:

  • Tooling in place: @web/test-runner 0.19, @open-wc/testing, @web/test-runner-playwright (Chromium, Firefox, WebKit), @web/dev-server-esbuild, sinon, playwright 1.56. There is a shared root config (web-test.runner-config.mjs, with per-file groups) and an older, mostly commented-out web-test-runner.config.mjs in each package.
  • Tests: none on dev. tes has two test files, but both are empty, and tes and ro-crate are private with only depricated-* scripts. Open PR feat: add surface, font and dark mode controls #446 adds the first real tests: ecc-utils-design/src/global.test.ts (15 theming tests) and ecc-client-ga4gh-wes/src/theming.test.ts (4 tests), runs them through the shared config, and fixes that config so Lit's decorators compile. They pass in Chromium, Firefox and WebKit, and they caught a Firefox-only bug, which shows the value of real multi-browser testing.
  • Build: Lit (2.x in most packages) web components built with tsup/esbuild (scripts/build.js), Tailwind, and React wrappers via @lit/react. Data access goes through provider interfaces (e.g. WesProvider, with RestWesProvider doing the fetch calls), which gives a natural seam for mocking.
  • Docs app: Next.js 14 + Nextra (apps/documentation), with live previews of the cloud-registry, design, service-registry, trs, trs-filer and wes components.
  • No coverage reporting, see also feat(ci): calculate and report test coverage #245. The broader goals in feat: testing #119 (fast tests, UI tests for ecc-utils-design, test strategies for the service packages) are still open, as is tests: Add tests for new, untested features #366.

Goals

  1. Unit tests per package: components rendered in a real browser with mocked providers; providers and helpers tested on their own.
  2. Integration tests: components together with the real Rest*Provider against a mocked GA4GH API (e.g. MSW, or a mock server generated from the OpenAPI specs), covering requests, errors, pagination and events.
  3. End-to-end tests in a browser, through the docs app or a test page per package, against a mock (or containerized real) GA4GH service.
  4. Coverage reporting to Codecov (as used elsewhere in the org), with a threshold that ratchets up as packages get tests.
  5. One CI job per level (e.g. test, integration, e2e), all feeding the CI passed gate, so the ruleset doesn't change.

Recommendation: keep WTR + @open-wc/testing, add Playwright Test for e2e

  • Unit and integration: keep WTR with @open-wc/testing (Mocha + Chai + fixture) and the Playwright launchers, all from the shared root config.
    • This is what Open WC recommends for Lit libraries, and the dependencies, the configs and feat: add surface, font and dark mode controls #446's tests already use it, so nothing has to be migrated.
    • It tests in real Chromium, Firefox and WebKit, which matters for web components (shadow DOM, :host-context(), adopted stylesheets); feat: add surface, font and dark mode controls #446's Firefox bug would not show up in jsdom or Chromium alone.
    • Integration tests can run MSW's browser worker (or sinon fetch stubs) inside the same runner, so the separate job is just a different file pattern (e.g. *.integration.test.ts) or WTR group.
    • Coverage: wtr --coverage (V8, Chromium only) writes lcov, which Codecov takes per package as flags.
  • End-to-end: @playwright/test (already a dependency through playwright) against the built docs app (next build && next start) or plain per-package test pages, with a mock GA4GH API.
    • This is the same e2e tool as in cloud-registry-ui, so the org uses one e2e stack.

Downsides: WTR is less actively maintained than Vitest, and its coverage covers Chromium only. If it stalls, the migration later is mostly mechanical (see the Vitest option below).

Alternatives

Option                       Unit/integ.     Browsers      Migration   Org fit          Notes
---------------------------  --------------  ------------  ----------  ---------------  ------------------------------
A. WTR + @open-wc/testing    real browser    Cr, Fx, WK    none        Open WC default  recommended; slower ecosystem
   + Playwright Test (e2e)                                                              pace, coverage Chromium only
B. Vitest browser mode       real browser    Cr, Fx, WK    small       = CR-UI          fast, watch mode, V8/istanbul
   (Playwright provider)                     (provider)    (#446)      (Vitest 4)       coverage, mocking built in;
   + Playwright Test (e2e)                                                              Lit decorator config needed
C. Vitest + jsdom/happy-dom  simulated DOM   none          small       = CR-UI          fastest, but misses shadow DOM
                                                                                        and CSS bugs (e.g. #446's)
D. Storybook + test runner   real browser    via PW        large       none             also gives a component gallery,
   / interaction tests                                                                  overlaps with the docs app
E. Playwright component      real browser    Cr, Fx, WK    medium      partial          experimental, aimed at React/
   testing (@playwright/ct)                                                             Vue/Svelte, no Lit adapter
  • B. Vitest browser mode is the strongest alternative: one runner for unit, integration and coverage, the same as cloud-registry-ui (Vitest 4 + V8 coverage + Playwright for e2e), better DX, and active maintenance. Costs: moving feat: add surface, font and dark mode controls #446's tests (Chai's expect and @open-wc/testing-helpers' fixture work in Vitest, so this is mostly config), configuring esbuild for Lit's decorators, and replacing the WTR groups and ports.
  • C is fast but can't see the browser-specific behavior these components depend on; at most as an extra for pure logic (providers, helpers).
  • D and E add a large new tool (D) or depend on an experimental feature without Lit support (E) for little gain over A or B.

Migration path

  1. Land feat: add surface, font and dark mode controls #446 (or its test-runner commits): it fixes the shared config and adds the design and WES tests, with test scripts that use the shared config on fixed ports.
  2. Unify the config: all packages use web-test.runner-config.mjs (or the Vitest config for B); remove the per-package web-test-runner.config.mjs files; give each package a fixed port or let the runner choose free ports.
  3. Re-add test scripts per package together with its first tests (as test: drop test scripts of packages without tests #478 intends), so turbo never runs a package without tests. One sub-issue per package: design, wes, trs, trs-filer, drs, drs-filer, service-registry, cloud-registry.
  4. tes and ro-crate: they are private with depricated-* scripts, and the tes test files are empty. Delete the empty files, and decide whether these packages get tests now or once they are revived.
  5. Integration layer: add MSW (or a mock server from the GA4GH OpenAPI specs) with shared fixtures per API, and a CI job integration.
  6. E2E layer: Playwright Test against the docs app or test pages, as job e2e, uploading the report as an artifact.
  7. Coverage: upload lcov per package to Codecov (flags per package), start with a threshold for the packages that have tests, and raise it as packages are covered; this closes feat(ci): calculate and report test coverage #245.
  8. Close feat: testing #119 and tests: Add tests for new, untested features #366 once the setup is in place, or fold them into the sub-issues.

Open questions for Anurag

  1. Runner: stay with WTR + @open-wc/testing (A), or switch to Vitest browser mode (B) to match cloud-registry-ui?
  2. E2E target: the docs app (one target, tests what users see, but couples tests to Next.js/Nextra), or minimal test pages per package (faster, isolated)?
  3. Mock API: MSW handlers written by hand, a mock server generated from the GA4GH OpenAPI specs (e.g. Prism), or real services in containers for e2e (e.g. cloud-registry, as cloud-registry-ui does)?
  4. Browsers in CI: all three engines on every PR, or Chromium on PRs and all three on dev (and both Node versions, or one)?
  5. Coverage target: which threshold, and per package or overall?
  6. tes and ro-crate: test them now or leave them until they are maintained again?

@anuragxxd, could you make the call on the approach? Once you've decided, we'll split this into sub-issues per package/level.

Activity

  1. added
    priority: high
    status flag: discuss
    type: testing
    workload: weeks
    on Oct 27, 2026
  2. added
    priority: low
    flag: nice to have
    and removed
    priority: high
    on Nov 8, 2026
  3. moved this to Backlog in ELIXIR On-Cloudon Nov 8, 2026
  4. added
    status: triage
    and removed on Nov 8, 2026
  5. moved this from Backlog to Nice to have in ELIXIR On-Cloudon Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    flag: nice to havepriority: lowstatus flag: discussstatus: triagetype: testingworkload: weeks

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions