Skip to content

Commit 63bddca

Browse files
feat: admin and roles (#270)
# Admin System with Role-Based Access Control ## Summary This PR introduces a complete user admin system with role-based access control (RBAC), user management capabilities, and enhanced MCP server sharing (featured) features. The implementation provides organizations with control over users and user permissions while maintaining a clean interface for all user roles. It is designed to keep functionality the same for users who are not interested in the admin features but adds the ability to manage users, and restrict access and functionality for users who are not admins. Before this PR, everyone would be an "editor" in this system. That is still the default role. The FIRST user who registers becomes an admin for a new installation. For existing installations, users will need to update the user record to role to "admin" in the database to use the admin features. It seemed like too much of a security risk to do this in an automated way, but I would be open to a more automated solution if we find a way to do it safely. ## Key Features ### 1. 🏢 Full Admin System #### User Management Dashboard <img width="1280" height="1061" alt="01-admin-users-list" src="https://github.com/user-attachments/assets/1258120e-c005-4d72-8d65-8f7311db788c" /> _Comprehensive user listing with search, sorting, and pagination_ - **Advanced User Table**: Displays user information with sortable columns for name, email, role, status, and creation date - **Search & Filter**: Real-time search functionality with state preservation across navigation - **Pagination**: Efficient handling of large user bases with configurable items per page - **Quick Navigation**: Click any user row to view detailed information #### Search Functionality Can search by user name or email with case-insensitive, fuzzy matching. <img width="1280" height="720" alt="80-admin-users-search-14" src="https://github.com/user-attachments/assets/441cadf1-681e-4544-b70f-1879dc6d2c79" /> _Real-time search: typing "14" instantly finds "Test User 14"_ #### Sorting Can sort by role, date joined or user name. <img width="1280" height="1063" alt="03-admin-users-sorted" src="https://github.com/user-attachments/assets/4410e5ce-621a-4a3d-a5da-bb96a2023be2" /> _Sort users by role, date joined or user name_ ### 2. 👤 User Detail Management <img width="1280" height="720" alt="61-admin-user-detail-edit-form" src="https://github.com/user-attachments/assets/44b0017d-1c65-490c-bd64-3fab31aa961f" /> _Admin user detail page showing full management interface with real usage statistics (1,558 tokens across 5 models)_ - **Profile Editing**: Admins can modify user name, email, and reset passwords - **Status Management**: Ban/unban users with reason tracking (visible in users list with "Banned" badge) - **Role Assignment**: Edit roles through dedicated interface (Admin, Editor, User) - **Security Controls**: Password reset, account status management - **Danger Zone**: Delete user with confirmation (requires typing user name) - **Activity Tracking**: View join date, last updated, and usage statistics ### 3. 📊 AI Usage Analytics <img width="1280" height="720" alt="62-admin-user-statistics" src="https://github.com/user-attachments/assets/143891ab-4a6f-49a9-9f22-693ecb11a735" /> The user detail page includes comprehensive statistics when available. Users who haven't used AI assistants yet will see "No AI Activity Yet" message. - **Usage Statistics**: Track token consumption, model usage, and message counts - **Top Models**: Visualize which AI models users prefer (gpt-4o, claude-3.5-sonnet, gemini-2.0-flash) - **Activity Timeline**: See user engagement patterns over the last 30 days - **Graceful Degradation**: Stats fail gracefully for providers without telemetry ### 4. 🔐 Three-Tier Role System This is a starter system that could be expanded to include more roles and permissions in the future, most likely with dynamic roles and permissions controlled in the admin dashboard. #### Admin Role - Can do everything an Editor (the current default role) can do, plus: - Full user management capabilities - Create and feature MCP servers for organization-wide use - Access to all administrative functions - View detailed usage statistics across all users #### Editor Role (Default) <img width="1280" height="720" alt="13-agents-page-editor" src="https://github.com/user-attachments/assets/26182a33-8ce7-4afd-9536-8da0bc6d5ac0" /> _Editors can create, use, and share agents, workflows. This image is an example of the agents view._ - Create and manage agents, workflows, and MCP connections - Share resources with other users - Full app functionality except admin features - Self-service profile management #### User Role <img width="1280" height="720" alt="16-agents-page-user" src="https://github.com/user-attachments/assets/2779ce01-b585-4054-aa78-0f9b43eaea09" /> _Users can use shared agents and workflows. This image is an example of the agent view. Users can still "bookmark" agents to show them in their own sidebar._ - Use shared agents and workflows - Access featured MCP servers - Bookmark favorite resources - Cannot create new resources (simplified experience) ### 5. 🔌 MCP Server Management When introducing roles, MCP servers were global and there the only way to get MCP servers up for all users was via file based MCP servers configs, which was prolematic and bug prone. While MCP server "featuring" and user specific MCPs were not originally part of the scope of this PR, it made sense to include it since roles were being introduced and implmented for features. Using the same "private" and "public" visibility options as agents and workflows and the same sharing component, mcps can be featured by admins. Public = Featured, the logic is the same but the term "featured" made more sense. Admins are the only ones who can feature MCP servers, since sharing MCP servers would be less common than sharing agents and workflows and too many MCP servers can significantly impact performance. #### Admin MCP Dashboard <img width="1280" height="720" alt="68-admin-mcp-all-servers" src="https://github.com/user-attachments/assets/96e7ba07-8696-48ed-8a76-565791d34cd6" /> _Admins can create and feature MCP servers_ #### Role-Based MCP Views - **Admins**: Can create, use and feature MCP servers - **Editors**: Can create and use personal MCP connections and use featured ones - **Users**: Can only use featured MCP servers **Editors** Editors can create and manage their own MCP servers and use featured ones <img width="1280" height="720" alt="69-editor-mcp-servers" src="https://github.com/user-attachments/assets/0a5f8e1b-8900-4e13-ab8a-560be1accb1a" /> **Users** Users see and use featured MCP servers <img width="1280" height="720" alt="71-user-mcp-featured-only" src="https://github.com/user-attachments/assets/7ed424c0-c5dc-44b0-ae38-d9d553d52d13" /> ### 6. 🛠️ Workflow Management Wofkflows have not been changed except that the "user" role cannot create workflows, they can only use shared ones. #### Admin Workflow Dashboard Admins can create, use and share workflows. <img width="1280" height="720" alt="71-admin-workflows" src="https://github.com/user-attachments/assets/6749378f-4e0c-4b29-acd8-a73c76567ae2" /> _Admins can create, use and share workflows_ #### Editor Workflow Access Editors can create, use and share workflows. <img width="1280" height="720" alt="72-editor-workflows" src="https://github.com/user-attachments/assets/5bbea6a3-0d13-471a-a358-1aa77046a645" /> _Editors can create, use and share workflows_ #### User Workflow Access Users can use shared workflows. <img width="1280" height="720" alt="73-user-workflows" src="https://github.com/user-attachments/assets/57ec3c77-7e85-402f-ae3e-86e860dda332" /> _Users can use shared workflows_ ### 7. 👥 Self-Service Features Users can access and edit their own profile information with the same interface that admins see, but with restricted permissions: - Users can edit their own profile (name, email, password) - Password updates are only available for users with password authentication - OAuth-only users cannot set passwords - Simple user settings interface - Users can view their "stats" for the last 30 days ### 8. 🌍 Internationalization - All fields are translatable, the current language for new fields is English ## Technical Implementation ### Architecture Highlights - **Repository Pattern**: Clean separation of data access logic - **Server Components**: Leveraging Next.js 15 server components and React 19 Form Actions for optimal performance - **Role-Based Middleware**: Secure API routes with automatic permission checks - **Optimistic Updates User Updates**: User updates are immediately reflected in the UI with optimistic updates ### Security Features - **Role-based access control** at API and UI levels - **Self-modification restrictions**: Users cannot change their own roles - **Secure password updates**: Verification required for own password changes, admins can set passwords for other users - **Ban system**: Prevents access while maintaining audit trail - **Permission boundaries**: Clear separation between roles ## Testing Coverage ### Comprehensive E2E Test Suite This PR includes **3,500+ lines of new E2E tests** across 14 test files, ensuring coverage of all new features: #### Test Files Added/Modified: - **Admin System Tests** (21 tests) - `admin-permissions.spec.ts` - Admin access control - `admin-user-detail.spec.ts` - User management operations - `admin-users-list.spec.ts` - User listing and search - **Permission System Tests** (30 tests) - `mcp-permissions.spec.ts` - MCP server role-based access - `resource-permissions.spec.ts` - Agent/workflow permissions - **User Experience Tests** - `user-settings-popup.spec.ts` - Self-service features - `user-name-sync.spec.ts` - Profile updates - Authentication flow updates ### E2E Test Coverage Areas ✅ User listing, search, and pagination ✅ User detail viewing and editing ✅ Role assignment and restrictions ✅ Ban/unban functionality ✅ Delete user with confirmation ✅ MCP server visibility rules ✅ Featured vs private servers ✅ Agent/workflow permissions ✅ Self-service profile editing ✅ Statistics display and empty states ✅ Navigation state preservation ✅ First user admin assignment ✅ Role-based UI variations ### Test Infrastructure Improvements - Multi-user auth states for parallel testing - Seeded test data for consistent scenarios - State preservation validation - Permission boundary testing ## Database Migration Notes 12_kind_multiple_man.sql was updated to migrate model and usage data to the new metadata format. This will only affect users who have not run that migration yet, since the migration will have dropped those columns. It doesn't break anything but did lose any usage or model stats for existing chats. This migration update will maintain that existing data. Added 13_graceful_leo.sql migrates for the admin system, roles and fixes some cascade issues noticed in automated cleanup scripts. ### Environment Variables No new environment variables required. The system uses the existing auth configuration. ## Breaking Changes - None. All existing functionality remains intact. MCP servers are all migrated to the 1st user in the database (which may be updated to an admin by updating that row in the database) - New users default to the 'editor' role, maintaining the current behavior - Existing MCP configurations continue working the same. ## Performance Considerations - **Lazy Loading**: Statistics load asynchronously to prevent blocking - **Pagination**: Efficient handling of large user bases - **Search Debouncing**: Prevents excessive API calls - **Optimistic Updates**: Immediate UI feedback for better UX - **Suspense Boundaries**: Graceful loading states throughout ## Future Enhancements The architecture supports these planned features: - User groups for team collaboration - Model access control per user/group - Spending limits and usage quotas - Audit logs for compliance Future UX improvements: - Better UX for "featured" MCP servers, the existing interface was used, and we might want to show more information about what they do. - Better UX for "featured" agents. I've found my users having a hard time finding shared agents, an essential feature for our company, since they are the ones who will be using them. ## Review Checklist - [ ] Database migrations tested - [ ] Role permissions verified - [ ] UI responsive on all screen sizes - [ ] Error messages helpful - [ ] Loading states smooth - [ ] Search functionality fast - [ ] Statistics display correctly - [ ] Ban functionality works - [ ] Self-service features accessible --------- Co-authored-by: choi sung keun <[email protected]> Co-authored-by: cgoing <[email protected]>
1 parent 5eb4701 commit 63bddca

File tree

188 files changed

+16176
-2038
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+16176
-2038
lines changed

.github/workflows/e2e-tests.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
# LLM Provider (OpenRouter with free models)
2626
OPENROUTER_API_KEY: ${{ secrets.E2E_OPENROUTER_API_KEY || 'test-key' }}
27-
E2E_DEFAULT_MODEL: openRouter/moonshotai/kimi-k2:free
27+
E2E_DEFAULT_MODEL: openRouter/gemini-2.0-flash-exp:free
2828

2929
# Feature flags
3030
DISABLE_SIGN_UP: 0
@@ -83,7 +83,10 @@ jobs:
8383
touch .env
8484
8585
- name: Run database migrations
86-
run: pnpm db:push
86+
run: pnpm db:migrate
87+
88+
- name: Seed test users once before all tests
89+
run: pnpm test:e2e:seed
8790

8891
- name: Build application
8992
run: pnpm build:local
@@ -92,8 +95,8 @@ jobs:
9295
run: pnpm test:e2e
9396

9497
- uses: actions/upload-artifact@v4
95-
if: ${{ !cancelled() }}
98+
if: always()
9699
with:
97-
name: test-results
98-
path: test-results/
100+
name: playwright-report
101+
path: playwright-report/
99102
retention-days: 30

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ local-data
5858
*.ignore
5959
.mcp-config.json
6060
openai-compatible.config.ts
61-
certificates
61+
certificates

CONTRIBUTING.md

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,34 +67,23 @@ If you are fixing a bug, please add tests to prevent the same bug from happening
6767

6868
6. **Run e2e tests**:
6969

70-
Before opening a PR run e2e tests to ensure your changes work as expected.
71-
72-
```bash
73-
74-
# install playwright browsers - you only need to do this once
75-
pnpm playwright:install # install playwright browsers
76-
77-
# this is typically the command you will use to run all e2e tests
78-
pnpm test:e2e # run all e2e tests
79-
```
80-
81-
To help you debug, you can run the tests individually or in headed mode to see the browser UI.
82-
83-
```bash
70+
```bash
71+
pnpm playwright:install # install playwright browsers
72+
pnpm test:e2e # run all e2e tests (48 tests covering core functionality)
8473

85-
# Optional: run specific test suites in a folder
86-
pnpm test:e2e -- tests/agents/
87-
pnpm test:e2e -- tests/models/
74+
# Optional: run specific test suites
75+
pnpm test:e2e -- tests/agents/
76+
pnpm test:e2e -- tests/models/
8877

89-
# Debug specific test file in headed mode to see the browser UI
90-
pnpm test:e2e -- tests/agents/agent-visibility.spec.ts --headed
91-
```
78+
# Debug specific test
79+
pnpm test:e2e -- tests/agents/agent-visibility.spec.ts --headed
80+
```
9281

93-
**E2E Test Requirements:**
82+
**E2E Test Requirements:**
9483

95-
- PostgreSQL database (use `pnpm docker:pg` for quick setup)
96-
- At least one LLM provider API key (OpenAI, Anthropic, or Google)
97-
- `BETTER_AUTH_SECRET` environment variable set
84+
- PostgreSQL database (use `pnpm docker:pg` for quick setup)
85+
- At least one LLM provider API key (OpenAI, Anthropic, or Google)
86+
- `BETTER_AUTH_SECRET` environment variable set
9887

9988
---
10089

README.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<img width="1184" height="576" alt="thumbnail" loading="lazy" src="https://github.com/user-attachments/assets/d6ba80ff-a62a-4920-b266-85c4a89d6076" />
22

3-
43
[![MCP Supported](https://img.shields.io/badge/MCP-Supported-00c853)](https://modelcontextprotocol.io/introduction)
54
[![Local First](https://img.shields.io/badge/Local-First-blue)](https://localfirstweb.dev/)
65
[![Discord](https://img.shields.io/discord/1374047276074537103?label=Discord&logo=discord&color=5865F2)](https://discord.gg/gCRu69Upnp)
@@ -17,11 +16,10 @@
1716
**Collaboration** - Share agents, workflows, and MCP configurations with your team
1817
**Voice Assistant** - Realtime voice chat with full MCP tool integration
1918
**Intuitive UX** - Instantly invoke any feature with `@mention`
20-
**Quick Start** - Deploy free with Vercel Deploy button
19+
**Quick Start** - Deploy free with Vercel Deploy button
2120

2221
Built with Vercel AI SDK and Next.js, combining the best features of leading AI services into one platform.
2322

24-
2523
### Quick Start 🚀
2624

2725
```bash
@@ -80,15 +78,15 @@ Open [http://localhost:3000](http://localhost:3000) in your browser to get start
8078
- [Quick Start (Local Version) 🚀](#quick-start-local-version-)
8179
- [Environment Variables](#environment-variables)
8280
- [📘 Guides](#-guides)
83-
- [🔌 MCP Server Setup \& Tool Testing](#-mcp-server-setup--tool-testing)
84-
- [🐳 Docker Hosting Guide](#-docker-hosting-guide)
85-
- [▲ Vercel Hosting Guide](#-vercel-hosting-guide)
86-
- [🎯 System Prompts \& Chat Customization](#-system-prompts--chat-customization)
87-
- [🔐 OAuth Sign-In Setup](#-oauth-sign-in-setup)
88-
- [🕵🏿 Adding openAI like providers](#-adding-openai-like-providers)
89-
- [🧪 E2E Testing Guide](#-e2e-testing-guide)
81+
- [🔌 MCP Server Setup \& Tool Testing](#-mcp-server-setup--tool-testing)
82+
- [🐳 Docker Hosting Guide](#-docker-hosting-guide)
83+
- [▲ Vercel Hosting Guide](#-vercel-hosting-guide)
84+
- [🎯 System Prompts \& Chat Customization](#-system-prompts--chat-customization)
85+
- [🔐 OAuth Sign-In Setup](#-oauth-sign-in-setup)
86+
- [🕵🏿 Adding openAI like providers](#-adding-openai-like-providers)
87+
- [🧪 E2E Testing Guide](#-e2e-testing-guide)
9088
- [💡 Tips](#-tips)
91-
- [💬 Temporary Chat Windows](#-temporary-chat-windows)
89+
- [💬 Temporary Chat Windows](#-temporary-chat-windows)
9290
- [🗺️ Roadmap](#️-roadmap)
9391
- [🙌 Contributing](#-contributing)
9492
- [💬 Join Our Discord](#-join-our-discord)
@@ -103,7 +101,6 @@ Get a feel for the UX — here's a quick look at what's possible.
103101

104102
![preview](https://github.com/user-attachments/assets/e4febb04-26d5-45da-a7bb-f7d452d333c2)
105103

106-
107104
**Example:** Control a web browser using Microsoft's [playwright-mcp](https://github.com/microsoft/playwright-mcp) tool.
108105

109106
- The LLM autonomously decides how to use tools from the MCP server, calling them multiple times to complete a multi-step task and return a final message.
@@ -144,10 +141,11 @@ Sample prompt:
144141
**Example:** Create specialized AI agents with custom instructions and tool access.
145142

146143
- Define custom agents with specific system prompts and available tools
147-
- Easily invoke agents in chat using `@agent_name`
144+
- Easily invoke agents in chat using `@agent_name`
148145
- Build task-specific assistants like a GitHub Manager agent with issue/PR tools and project context
149146

150147
For instance, create a GitHub Manager agent by:
148+
151149
- Providing GitHub tools (issue/PR creation, comments, queries)
152150
- Adding project details to the system prompt
153151
- Calling it with `@github_manager` to manage your repository
@@ -277,9 +275,22 @@ pnpm build:local && pnpm start
277275
# pnpm dev
278276
```
279277

280-
Open [http://localhost:3000](http://localhost:3000) in your browser to get started.
278+
Alternative: Use Docker Compose for DB only (run app via pnpm)
281279

282-
<br/>
280+
```bash
281+
# Start Postgres only via compose
282+
# Ensure your .env includes: POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB matching POSTGRES_URL
283+
docker compose -f docker/compose.yml up -d postgres
284+
285+
# Apply migrations
286+
pnpm db:migrate
287+
288+
289+
# Run app locally
290+
pnpm dev # or: pnpm build && pnpm start
291+
```
292+
293+
Open [http://localhost:3000](http://localhost:3000) in your browser to get started.
283294

284295
### Environment Variables
285296

docs/tips-guides/e2e-testing-guide.md

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pnpm test:e2e:ui
2121
pnpm test:e2e -- tests/agents/agent-creation.spec.ts
2222

2323
# Run tests in debug mode
24-
pnpm test:e2e -- --debug
24+
pnpm test:e2e:debug
2525
```
2626

2727
## 🏗️ Test Architecture
@@ -83,28 +83,17 @@ We recommend using the [Playwright](https://marketplace.visualstudio.com/items?i
8383

8484
### Test Database
8585

86-
For safety, always use a **separate test, local database**. If you run this against a production database, it can **severely impact your data**.
87-
88-
The easiest database to use the local postgres database setup through the included docker compose file.
89-
9086
```bash
91-
# Use Docker (recommended)
9287
pnpm docker:pg
9388
```
9489

95-
Set the `POSTGRES_URL` environment variable in your .env to the test database URL.
96-
97-
```text
98-
POSTGRES_URL="postgres://user:password@localhost:5432/better_chatbot"
99-
```
100-
10190
## 🎯 Authentication Strategy
10291

10392
### Authentication Setup
10493

105-
Tests authenticate 2 users by default on setup. - This is to test multi-user functionality like agent or workspace sharing.
94+
Tests authenticate 4 users 1 admin, 1 editor, 1 editor2, and 1 regular by default on setup. - This is to test multi-user functionality like agent or workspace sharing. These users are defined in `tests/constants/test-users.ts`.
10695

107-
To test as an authenticated user (nearly all tests), you can use the `test.use({ storageState: 'tests/.auth/user1.json' });` in the test file. Without this, the test will run as an unauthenticated user. This can go in the describe block or the test block.
96+
To test as an authenticated user (nearly all tests), you can use the `test.use({ storageState: TEST_USERS.editor.authFile });` or `test.use({ storageState: TEST_USERS.editor2.authFile });` or `test.use({ storageState: TEST_USERS.regular.authFile });` or `test.use({ storageState: TEST_USERS.admin.authFile });` in the test file. Without this, the test will run as an unauthenticated user. This can go in the describe block or the test block.
10897

10998
### Multi-User Testing
11099

@@ -116,8 +105,9 @@ Playwright is designed to run tests in parallel. This means that each test will
116105

117106
```typescript
118107
// Most tests use single user authentication
108+
import { TEST_USERS } from '../constants/test-users';
119109
test.describe('Agent Creation', () => {
120-
test.use({ storageState: 'tests/.auth/user1.json' });
110+
test.use({ storageState: TEST_USERS.editor.authFile });
121111

122112
test('should create agent', async ({ page }) => {
123113
// Test logic here
@@ -128,8 +118,9 @@ test.describe('Agent Creation', () => {
128118
#### User 2 Only
129119

130120
```typescript
121+
import { TEST_USERS } from '../constants/test-users';
131122
test.describe('Agent Creation', () => {
132-
test.use({ storageState: 'tests/.auth/user2.json' });
123+
test.use({ storageState: TEST_USERS.editor2.authFile });
133124

134125
test('should create agent', async ({ page }) => {
135126
// Test logic here
@@ -142,17 +133,18 @@ test.describe('Agent Creation', () => {
142133
This is the most common use case for multi-user testing.
143134

144135
```typescript
136+
import { TEST_USERS } from '../constants/test-users';
145137
test.describe('Agent Sharing', () => {
146138
test('user sharing workflow', async ({ browser }) => {
147139
// User1 creates agent
148140
const user1Context = await browser.newContext({
149-
storageState: 'tests/.auth/user1.json',
141+
storageState: TEST_USERS.editor.authFile,
150142
});
151143
const user1Page = await user1Context.newPage();
152144

153145
// User2 interacts with shared agent
154146
const user2Context = await browser.newContext({
155-
storageState: 'tests/.auth/user2.json',
147+
storageState: TEST_USERS.editor2.authFile,
156148
});
157149
const user2Page = await user2Context.newPage();
158150
});
@@ -213,30 +205,20 @@ const agentName = `Test Agent ${testSuffix}`;
213205

214206
### Debug Commands
215207

216-
See [https://playwright.dev/docs/test-cli](https://playwright.dev/docs/test-cli) for more information.
217-
218-
Some useful commands to help you debug your tests:
219-
220208
```bash
221209
# Run specific test with browser visible
222210
pnpm test:e2e -- tests/agents/agent-creation.spec.ts --headed
223211

224212
# Debug mode with breakpoints
225-
pnpm test:e2e:debug -- --debug
213+
pnpm test:e2e:debug
226214

227215
# Run single test
228-
pnpm test:e2e -- -g "should create agent"
216+
npx playwright test -g "should create agent"
229217

230218
# Generate test report
231-
pnpm test:e2e -- show-report
219+
npx playwright show-report
232220
```
233221

234-
### VSCode/Cursor Debugging
235-
236-
You can use the VSCode extension to debug and help write your tests, it's a great way to get started:
237-
238-
See [https://playwright.dev/docs/getting-started-vscode](https://playwright.dev/docs/getting-started-vscode) for more information.
239-
240222
### Debug Helpers
241223

242224
Add debug information to tests:
@@ -286,9 +268,9 @@ Tests run automatically on GitHub Actions with:
286268

287269
```typescript
288270
import { test, expect } from '@playwright/test';
289-
271+
import { TEST_USERS } from '../constants/test-users';
290272
test.describe('Your Feature', () => {
291-
test.use({ storageState: 'tests/.auth/user1.json' });
273+
test.use({ storageState: TEST_USERS.editor.authFile });
292274

293275
test('should perform action', async ({ page }) => {
294276
// Navigate to page
@@ -310,12 +292,13 @@ test.describe('Your Feature', () => {
310292
### Multi-User Test Template
311293

312294
```typescript
295+
import { TEST_USERS } from '../constants/test-users';
313296
test('multi-user workflow', async ({ browser }) => {
314297
const testId = Date.now().toString(36);
315298

316299
// User1 setup
317300
const user1Context = await browser.newContext({
318-
storageState: 'tests/.auth/user1.json',
301+
storageState: TEST_USERS.editor.authFile,
319302
});
320303
const user1Page = await user1Context.newPage();
321304

0 commit comments

Comments
 (0)