feat(admin): 添加用户管理相关文件
添加用户管理视图、API和状态管理文件
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
# 统一测试框架使用指南
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 安装依赖
|
||||
|
||||
```bash
|
||||
cd everything-is-suitable-test
|
||||
npm install
|
||||
```
|
||||
|
||||
### 配置环境
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# 编辑 .env 文件,配置测试环境
|
||||
```
|
||||
|
||||
### 运行测试
|
||||
|
||||
```bash
|
||||
# 运行所有测试
|
||||
npm run test
|
||||
|
||||
# 运行E2E测试
|
||||
npm run test:e2e
|
||||
|
||||
# 运行API测试
|
||||
npm run test:api
|
||||
|
||||
# 运行单元测试
|
||||
npm run test:unit
|
||||
```
|
||||
|
||||
## 编写测试
|
||||
|
||||
### E2E测试示例
|
||||
|
||||
```typescript
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test('示例测试', async ({ page }) => {
|
||||
await page.goto('http://localhost:5174');
|
||||
await expect(page).toHaveTitle('管理系统');
|
||||
});
|
||||
```
|
||||
|
||||
### API测试示例
|
||||
|
||||
```python
|
||||
import pytest
|
||||
from apitest.client.api_client import APIClient
|
||||
|
||||
def test_example():
|
||||
client = APIClient()
|
||||
response = client.get('/api/sys/user')
|
||||
assert response.status_code == 200
|
||||
```
|
||||
|
||||
## 测试辅助工具
|
||||
|
||||
### FormHelper
|
||||
|
||||
表单操作辅助工具。
|
||||
|
||||
```typescript
|
||||
import { FormHelper } from './helpers/form-helper';
|
||||
|
||||
const formHelper = new FormHelper(page);
|
||||
await formHelper.fillField('input[name="username"]', 'testuser');
|
||||
await formHelper.submitForm();
|
||||
```
|
||||
|
||||
### TableHelper
|
||||
|
||||
表格操作辅助工具。
|
||||
|
||||
```typescript
|
||||
import { TableHelper } from './helpers/table-helper';
|
||||
|
||||
const tableHelper = new TableHelper(page);
|
||||
const rowCount = await tableHelper.getRowCount('.user-table');
|
||||
const cellText = await tableHelper.getCellText('.user-table', 1, 2);
|
||||
```
|
||||
|
||||
## 更多信息
|
||||
|
||||
详见 [架构设计](ARCHITECTURE.md) 和 [最佳实践](BEST_PRACTICES.md)
|
||||
Reference in New Issue
Block a user