62 lines
1.8 KiB
TypeScript
62 lines
1.8 KiB
TypeScript
/**
|
|
* 工作空间管理 E2E 测试
|
|
*/
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('Workspace Management', () => {
|
|
test.beforeEach(async ({ page }) => {
|
|
// 登录
|
|
await page.goto('/login');
|
|
await page.fill('input[placeholder="邮箱"]', 'test@example.com');
|
|
await page.fill('input[placeholder="密码"]', 'Password123!');
|
|
await page.click('button:has-text("登录")');
|
|
await page.waitForURL('/workspaces');
|
|
});
|
|
|
|
test('should create workspace', async ({ page }) => {
|
|
// 点击创建按钮
|
|
await page.click('button:has-text("创建工作空间")');
|
|
|
|
// 填写表单
|
|
await page.fill('input[placeholder="工作空间名称"]', 'Test Workspace');
|
|
|
|
// 提交
|
|
await page.click('button:has-text("创建")');
|
|
|
|
// 验证创建成功
|
|
await expect(page.locator('text=Test Workspace')).toBeVisible();
|
|
});
|
|
|
|
test('should view workspace details', async ({ page }) => {
|
|
// 点击第一个工作空间
|
|
await page.click('.ant-card >> nth=0');
|
|
|
|
// 验证详情页面
|
|
await expect(page.locator('h1')).toBeVisible();
|
|
await expect(page.locator('.ant-tabs')).toBeVisible();
|
|
});
|
|
|
|
test('should invite member', async ({ page }) => {
|
|
// 进入工作空间详情
|
|
await page.click('.ant-card >> nth=0');
|
|
|
|
// 切换到成员标签
|
|
await page.click('text=成员管理');
|
|
|
|
// 点击邀请按钮
|
|
await page.click('button:has-text("邀请成员")');
|
|
|
|
// 填写邮箱
|
|
await page.fill('input[placeholder="member@example.com"]', 'newmember@example.com');
|
|
|
|
// 选择角色
|
|
await page.selectOption('select', 'member');
|
|
|
|
// 发送邀请
|
|
await page.click('button:has-text("发送邀请")');
|
|
|
|
// 验证成功
|
|
await expect(page.locator('.ant-message-success')).toBeVisible();
|
|
});
|
|
});
|