Skip to content

fix(e2e): repair filestorage + permissions tests#212

Merged
antosubash merged 2 commits into
mainfrom
fix/storage-and-permissions-e2e
May 23, 2026
Merged

fix(e2e): repair filestorage + permissions tests#212
antosubash merged 2 commits into
mainfrom
fix/storage-and-permissions-e2e

Conversation

@antosubash
Copy link
Copy Markdown
Owner

Summary

Fixes 4 pre-existing failing e2e tests across 2 spec files.

  • FileStorage permissions (2 tests): POST /api/files and DELETE /api/files/{id} unauthenticated were expected to return 302 but actually return 401. The SmartAuth policy scheme forwards challenge to the Identity cookie scheme for browser navigation, but API APIRequestContext calls (no Accept: text/html, no cookies) get 401 — which is the correct and intended behavior for machine clients. Updated assertions from toBe(302)toBe(401).

  • Settings page test: Test navigated to /settings which is a 404 (no route matches that bare path). The correct user-facing settings route is /settings/me (renders UserSettings component with heading "My Settings", which matches /settings/i). Fixed navigation target.

  • Admin unauthenticated test: Test hit GET /api/admin/users which does not exist — falls through to the anonymous catch-all returning 404. The real route that triggers Identity cookie redirect is GET /admin/users (the Inertia view endpoint). Fixed request URL.

  • playwright.config.ts: Added PLAYWRIGHT_BASE_URL env var support so parallel CI agents can each run their host on a dedicated port without patching the config file.

Test plan

  • All 19 tests in filestorage-crud.spec.ts and permissions.spec.ts pass locally
  • Biome check passes on all modified .ts files
  • No production code was changed — only test assertions and test URLs corrected to match actual server behavior

…ehavior

- FileStorage upload/delete unauthenticated: API endpoints return 401 (not
  302) since the SmartAuth policy scheme does not redirect API clients; update
  the two permission tests to expect 401.
- Settings page test: /settings is a 404; correct route is /settings/me (User
  Settings view); update the navigation target.
- Admin unauthenticated test: /api/admin/users does not exist (404 fallthrough);
  the real route that triggers an Identity cookie redirect is GET /admin/users;
  fix the request path.
- playwright.config.ts: honour PLAYWRIGHT_BASE_URL env var so parallel CI
  agents can each run their host on a different port.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 23, 2026

Deploying simplemodule-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 933dd04
Status: ✅  Deploy successful!
Preview URL: https://bbc021f2.simplemodule-website.pages.dev
Branch Preview URL: https://fix-storage-and-permissions.simplemodule-website.pages.dev

View logs

@antosubash antosubash enabled auto-merge (squash) May 23, 2026 22:32
@antosubash antosubash merged commit 7d2a7ee into main May 23, 2026
6 checks passed
@antosubash antosubash deleted the fix/storage-and-permissions-e2e branch May 23, 2026 22:36
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