RBAC bugs usually come from drift between backend authorization rules and frontend visibility rules. This guide shows a repeatable Playwright pattern to test both.Documentation Index
Fetch the complete documentation index at: https://docs.stably.ai/llms.txt
Use this file to discover all available pages before exploring further.
What to Cover
- Positive access: user can see and perform allowed actions.
- Negative access: user cannot view page, button, or API-backed action.
- Escalation attempts: direct URL navigation and API-triggering UI actions are blocked.
Model Roles as Playwright Projects
Use one project per role so each role has explicitstorageState.
playwright.config.ts
Write a Permission Matrix
Encode expected permissions once, then reuse in tests.tests/rbac/permissions.ts
Assert Both UI and Server Outcomes
tests/rbac/billing.spec.ts
High-Value RBAC Cases
- User downgraded from admin to viewer mid-session.
- Invite flow grants wrong default role.
- Protected API action succeeds from hidden-but-triggerable UI path.
- Cached permissions allow stale access after logout/login.
Stably Features to Use for RBAC Coverage
- Put role credentials in Stably Environments and run RBAC suites with
--envper target environment. - Run role projects in parallel on Stably Cloud:
- Add Scheduled Test Runs for continuous authorization regression checks.
- Configure Alerts & Notifications so permission regressions page the right team immediately.