/** * 系统设置 E2E 测试 (根据真实截图修正) * 三个 Tab: * - 部门与员工管理 * - 角色与权限控制 (RBAC) * - 企业账号配置 */ import { test, expect } from '@playwright/test'; test.describe('系统设置', () => { test.beforeEach(async ({ page }) => { await page.goto('/settings'); await page.waitForLoadState('networkidle'); }); test('设置页面正确加载', async ({ page }) => { // 三个 Tab 标题 await expect(page.getByText('部门与员工管理')).toBeVisible({ timeout: 5000 }); await expect(page.getByText('角色与权限控制')).toBeVisible(); await expect(page.getByText('企业账号配置')).toBeVisible(); }); test('部门与员工管理 tab 内容', async ({ page }) => { const deptTab = page.getByText('部门与员工管理').first(); await deptTab.click(); await page.waitForTimeout(1000); // 应显示部门树或员工列表 await expect(page.locator('body')).toContainText(/部门|员工/, { timeout: 3000 }); }); test('角色与权限控制 tab', async ({ page }) => { await page.getByText('角色与权限控制').first().click(); await page.waitForTimeout(1500); // 左侧应有角色列表区域 await expect(page.getByText('平台运营角色')).toBeVisible({ timeout: 5000 }); await expect(page.getByText('新增角色')).toBeVisible(); }); test('新增角色按钮', async ({ page }) => { await page.getByText('角色与权限控制').first().click(); await page.waitForTimeout(1000); await expect(page.getByText('新增角色')).toBeVisible({ timeout: 3000 }); }); test('企业账号配置 tab', async ({ page }) => { await page.getByText('企业账号配置').first().click(); await page.waitForTimeout(1000); await expect(page.locator('body')).toContainText(/企业|账号/, { timeout: 3000 }); }); });