78 lines
3.1 KiB
TypeScript
78 lines
3.1 KiB
TypeScript
|
|
import { test, expect } from '@playwright/test';
|
||
|
|
|
||
|
|
// 前端导航测试
|
||
|
|
test.describe('Swarm Command Center - 前端导航测试', () => {
|
||
|
|
const baseUrl = 'http://localhost:3000';
|
||
|
|
|
||
|
|
test.beforeEach(async ({ page }) => {
|
||
|
|
await page.goto(baseUrl);
|
||
|
|
});
|
||
|
|
|
||
|
|
test('页面标题正确显示', async ({ page }) => {
|
||
|
|
await expect(page).toHaveTitle(/Swarm/);
|
||
|
|
});
|
||
|
|
|
||
|
|
test('侧边栏导航显示正确', async ({ page }) => {
|
||
|
|
// 检查 Logo 和标题
|
||
|
|
await expect(page.locator('text=Swarm Center')).toBeVisible();
|
||
|
|
await expect(page.locator('text=多智能体协作系统')).toBeVisible();
|
||
|
|
|
||
|
|
// 检查导航链接
|
||
|
|
await expect(page.locator('text=仪表盘')).toBeVisible();
|
||
|
|
await expect(page.locator('text=Agent 管理')).toBeVisible();
|
||
|
|
await expect(page.locator('text=会议管理')).toBeVisible();
|
||
|
|
await expect(page.locator('text=资源监控')).toBeVisible();
|
||
|
|
await expect(page.locator('text=工作流')).toBeVisible();
|
||
|
|
await expect(page.locator('text=配置')).toBeVisible();
|
||
|
|
});
|
||
|
|
|
||
|
|
test('仪表盘页面加载', async ({ page }) => {
|
||
|
|
await expect(page.locator('h1:has-text("仪表盘")')).toBeVisible();
|
||
|
|
await expect(page.locator('text=系统概览与实时监控')).toBeVisible();
|
||
|
|
|
||
|
|
// 检查统计卡片
|
||
|
|
await expect(page.locator('text=Agent 总数')).toBeVisible();
|
||
|
|
await expect(page.locator('text=今日会议')).toBeVisible();
|
||
|
|
await expect(page.locator('text=文件锁')).toBeVisible();
|
||
|
|
await expect(page.locator('text=在线 Agent')).toBeVisible();
|
||
|
|
});
|
||
|
|
|
||
|
|
test('Agent 管理页面导航', async ({ page }) => {
|
||
|
|
await page.click('text=Agent 管理');
|
||
|
|
await expect(page).toHaveURL(/\/agents/);
|
||
|
|
await expect(page.locator('h1:has-text("Agent 管理")')).toBeVisible();
|
||
|
|
await expect(page.locator('button:has-text("注册 Agent")')).toBeVisible();
|
||
|
|
});
|
||
|
|
|
||
|
|
test('会议管理页面导航', async ({ page }) => {
|
||
|
|
await page.click('text=会议管理');
|
||
|
|
await expect(page).toHaveURL(/\/meetings/);
|
||
|
|
await expect(page.locator('h1:has-text("会议管理")')).toBeVisible();
|
||
|
|
await expect(page.locator('button:has-text("创建会议")')).toBeVisible();
|
||
|
|
});
|
||
|
|
|
||
|
|
test('资源监控页面导航', async ({ page }) => {
|
||
|
|
await page.click('text=资源监控');
|
||
|
|
await expect(page).toHaveURL(/\/resources/);
|
||
|
|
await expect(page.locator('h1:has-text("资源监控")')).toBeVisible();
|
||
|
|
|
||
|
|
// 检查标签页
|
||
|
|
await expect(page.locator('button:has-text("文件锁")')).toBeVisible();
|
||
|
|
await expect(page.locator('button:has-text("心跳状态")')).toBeVisible();
|
||
|
|
await expect(page.locator('button:has-text("Agent 状态")')).toBeVisible();
|
||
|
|
});
|
||
|
|
|
||
|
|
test('工作流页面导航', async ({ page }) => {
|
||
|
|
await page.click('text=工作流');
|
||
|
|
await expect(page).toHaveURL(/\/workflow/);
|
||
|
|
await expect(page.locator('h1:has-text("工作流")')).toBeVisible();
|
||
|
|
});
|
||
|
|
|
||
|
|
test('配置页面导航', async ({ page }) => {
|
||
|
|
await page.click('text=配置');
|
||
|
|
await expect(page).toHaveURL(/\/settings/);
|
||
|
|
await expect(page.locator('h1:has-text("系统配置")')).toBeVisible();
|
||
|
|
await expect(page.locator('text=API 基础地址')).toBeVisible();
|
||
|
|
});
|
||
|
|
});
|