feat(e2e): semver-based version gates for tests#444
Conversation
a4350a4 to
bb8091d
Compare
There was a problem hiding this comment.
Pull request overview
Introduces a per-test SemVer-based version-gating mechanism for e2e tests so specs can declare which OpenCloud server / web-UI versions they apply to instead of relying on indefinite test.skip. Worker-scoped Playwright fixtures lazily probe the running stack via an authenticated login that scrapes web's announceVersions() console output, with WEB_VERSION / OC_VERSION env vars as a fast-path override. The unzip e2e is migrated from test.skip to skipIfWeb('<=7.0.0', ...) so it auto-enables once a sufficient web version is bundled.
Changes:
- New
support/fixtures/versions.tswithwebVersion,ocVersion,skipIfWeb,skipIfOcworker fixtures and a one-shot boot-log scrape. - New
support/test.tscomposition point exporting amergeTests-combinedtestand re-exportedexpect. extractZip.spec.tsswitched to the newtest, dropstest.skip, gates on web<=7.0.0, and asserts the preserved nested folder structure;semver+@types/semveradded as devDependencies.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| support/test.ts | Single fixture composition point using mergeTests to compose the versions fixture module. |
| support/fixtures/versions.ts | Worker-scoped fixtures that resolve web/oc versions via env vars or boot-log scrape and provide skipIfWeb / skipIfOc skip helpers. |
| packages/web-app-unzip/tests/e2e/extractZip.spec.ts | Replaces test.skip with skipIfWeb('<=7.0.0', ...) and adds nested-folder-structure assertions for the unzip subfolder fix. |
| package.json | Adds semver ^7.8.0 and @types/semver ^7.7.1 devDependencies used by the new fixture. |
| pnpm-lock.yaml | Lockfile entries for the new semver / @types/semver devDependencies. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds infrastructure for per-test web/oc version gates so individual e2e
tests can declare which versions they apply to instead of being
test.skip'd indefinitely whenever the bundled OpenCloud image lags
behind required web fixes.
- support/helpers/versionGates.ts: pure versionMatches() wrapping
semver.satisfies(). Full semver range grammar supported (<, <=, >=, >,
^, ~, space-AND, ||-OR). 9999.0.0 is the sentinel for main /
bleeding-edge; satisfies any >=X / >X range, never satisfies <X / <=X.
- support/fixtures/versions.ts: Playwright worker-scoped fixture that
exposes webVersion, ocVersion, skipIfWeb, skipIfOc. WEB_VERSION /
OC_VERSION env vars take precedence; otherwise both versions are
scraped from the boot-time announceVersions() console log after an
authenticated probe (announceVersions only fires once an auth context
becomes ready, so an unauthenticated probe wouldn't see it).
- support/test.ts: re-exports playwright's test with the fixture merged
in.
- support is now a workspace package so its vitest unit tests are
picked up by the recursive `pnpm -r test:unit`.
- packages/web-app-unzip/tests/e2e/extractZip.spec.ts switches from
test.skip to skipIfWeb('<=7.0.0', '...'). Once the bundled web ships
with the prerequisite fixes (web#2506 + web#2513) the test starts
running automatically; no manual unskip required.
CI matrix work that exercises multiple (OC, web) variants comes in a
follow-up PR.
bb8091d to
4978ae0
Compare
Description
Adds infrastructure for per-test web/oc version gates so individual e2e tests can declare which (OpenCloud server, web) versions they apply to, instead of being indefinitely
test.skip'd whenever the bundled OpenCloud image lags behind required web fixes.This addresses the third "skipped pending image bump" gotcha we've hit on this repo (most recently the unzip extension's #293 fix, blocked on web#2506 + web#2513). Once the bundled web catches up, the gated test starts running automatically — no manual unskip needed.
New API
Full semver range grammar supported (
<,<=,>=,>,^,~, space-AND,||-OR) —skipIfWebis a thin wrapper aroundsemver.satisfies. Examples:skipIfWeb('<=7.0.0', 'reason')— skip on 7.0.0 and earlier.skipIfWeb('>=7 <8', 'broken on 7.x')— skip any 7.x.skipIfWeb('<7.1.0 || =9.0.0', 'two bad windows')— OR-combined ranges.skipIfOcworks the same against the OpenCloud server version.Layout
support/fixtures/versions.ts— fixture module that extends@playwright/test's base with version-discovery fixtures.support/test.ts— single composition point. UsesmergeTestsso additional fixture modules can be added with one extra import + argument.{ test, expect }fromsupport/test, no matter how many fixtures land later.Version discovery
Worker-scoped Playwright fixtures populate
webVersionandocVersion:WEB_VERSION/OC_VERSIONenv vars take precedence when set. The fixture validates they are valid SemVer and throws clearly otherwise._discoveredVersions) does a one-time authenticated probe using the admin user (ADMIN_USERNAME/ADMIN_PASSWORD, defaulting toadmin/admin) and scrapes both versions from web's boot-timeannounceVersions()console log. The log only fires once an auth context becomes ready, so an unauthenticated probe would never see it.skipIfWeb/skipIfOc. Tests that don't gate on versions pay zero cost.Measured cost of the auth probe locally: ~560ms once per worker (only when scraping is needed). Set
WEB_VERSION/OC_VERSIONto skip it entirely.Migrated
packages/web-app-unzip/tests/e2e/extractZip.spec.ts— drops itstest.skipand gates onskipIfWeb('<=7.0.0', 'needs web#2506 + web#2513'). Once a bundled OpenCloud image ships with both prerequisite web PRs, the test starts running automatically.packages/web-app-pastebin/tests/e2e/pastebin.spec.ts— drops thetest.skip('scrollTo works on public link', ...)whose prerequisite (fix: preserve query params on public link redirect web#2199) shipped in web v6.1.0; every web version we test against today is newer, so no gate is needed.Related Issue
Surfaced while landing #443 — the unzip subfolder fix is correct but its e2e cannot pass against the bundled web until web#2506 + web#2513 are in. This PR provides the mechanism to gate that test on the actual running web version.
Types of changes