test(e2e): provision RBAC role users + per-role sessions; un-quarantine rbac-403 - #66
Merged
Merged
Conversation
…ne rbac-403
Enabler B of the remaining-work plan.
globalSetup now provisions the four RBAC fixture users (rbac-owner / -editor /
-viewer / -outsider, with the credentials the specs already expected) and their
groups through the OCS provisioning API, then mints ONE stored session per role
under tests/e2e/.auth/{id}.json.
Doing it here rather than in the specs is the whole point: the permission suites
used to form-log-in per test, and consecutive logins from a single IP trip
Nextcloud's brute-force throttle — once it fires, every later spec falls back to
/login and the run goes false-red. Each role logs in exactly once, sequentially,
with 1.5s of spacing.
Two things measured rather than assumed while building it:
- OCS v2 answers `statuscode: 200` on user creation; the v1 shape answers 100
(created) / 102 (exists). The check accepts all three, so a re-run is
idempotent instead of noisy.
- waiting on `#header` after submit is unreliable — the landing page differs
per user and the selector races the theming bundle. It waits on the URL
leaving /login instead, with a 60s budget because a throttled login stalls
well past any shorter one.
Provisioning failures are logged, never thrown: a missing RBAC user must not
take down the suites that do not need one.
rbac-403 — un-quarantined, 2/2 green. Both of its documented blockers are gone:
- it attaches the stored outsider session instead of logging in per test;
- its deny assertions targeted `[data-app-slug="…"]` and
`[data-testid="builder-host-hello-world"]`, neither of which is emitted
anywhere in src/ (BuilderHost.vue stamps `data-testid="openbuild-builder-host"`,
with no slug). Both counts were 0 for an admin who CAN see the app, so the
assertions proved nothing. They now assert what an outsider actually gets,
measured against the instance: an application list with no cards and no
mention of the slug, and an "App not found" screen with no builder host
mounted.
Verified: rbac-403 2/2 green, twice.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Enabler B of the remaining-work plan.
What it adds
globalSetupnow provisions the four RBAC fixture users (rbac-owner/-editor/-viewer/-outsider, with the credentials the specs already expected) and their groups through the OCS provisioning API, then mints one stored session per role undertests/e2e/.auth/{id}.json.Doing it there rather than in the specs is the whole point: the permission suites used to form-log-in per test, and consecutive logins from a single IP trip Nextcloud's brute-force throttle. Once it fires, every later spec falls back to
/loginand the run goes false-red. Each role now logs in exactly once, sequentially, with spacing.Two things measured rather than assumed while building it:
statuscode: 200on user creation; the v1 shape answers 100 (created) / 102 (exists). The check accepts all three, so a re-run is idempotent instead of noisy.#headerafter submit is unreliable — the landing page differs per user and the selector races the theming bundle. It waits on the URL leaving/logininstead, with a 60s budget, because a throttled login stalls well past anything shorter.Provisioning failures are logged, never thrown: a missing RBAC user must not take down suites that don't need one.
rbac-403 — 2/2 green
Both documented blockers are gone:
[data-app-slug="…"]and[data-testid="builder-host-hello-world"]. Neither is emitted anywhere insrc/—BuilderHost.vuestampsdata-testid="openbuild-builder-host", with no slug — so both counts were 0 even for an admin who can see the app, and the assertions proved nothing.They now assert what an outsider actually gets, measured against the instance: an application list with no cards and no mention of the slug, and an "App not found" screen with no builder host mounted.
Verification
rbac-4032/2 green, twice. All four role sessions mint cleanly from a cold.auth/. ESLint clean apart from the repo-wide pre-existingn/no-unpublished-import.Unblocked but not yet claimed in this PR:
versionRouting9.2 (viewer) andschema-access-scopes-rbac(needs role grants on a fixture app on top of the sessions).