refactor: 迁移 UI 组件库从 Ant Design 至 TDesign
- 替换 antd 为 tdesign-react 作为主要 UI 组件库 - 引入 Recharts 替代 @ant-design/charts 实现图表功能 - 移除主题系统相关代码(ThemeContext、themes 目录) - 更新所有组件以适配 TDesign 组件 API - 更新测试用例以匹配新的组件实现 - 新增 TDesign 和 Recharts 集成规范文档
This commit is contained in:
@@ -6,51 +6,26 @@ test.describe('侧边栏导航', () => {
|
||||
});
|
||||
|
||||
test('应显示侧边栏', async ({ page }) => {
|
||||
const sider = page.locator('.ant-layout-sider');
|
||||
await expect(sider).toBeVisible();
|
||||
// TDesign Layout.Aside 渲染为 aside 标签
|
||||
const aside = page.locator('aside');
|
||||
await expect(aside).toBeVisible();
|
||||
});
|
||||
|
||||
test('应显示应用名称', async ({ page }) => {
|
||||
await expect(page.locator('.ant-layout-sider').getByText('AI Gateway')).toBeVisible();
|
||||
await expect(page.locator('aside').getByText('AI Gateway')).toBeVisible();
|
||||
});
|
||||
|
||||
test('应显示导航菜单项', async ({ page }) => {
|
||||
const sider = page.locator('.ant-layout-sider');
|
||||
await expect(sider.getByText('供应商管理')).toBeVisible();
|
||||
await expect(sider.getByText('用量统计')).toBeVisible();
|
||||
});
|
||||
|
||||
test('应能折叠和展开侧边栏', async ({ page }) => {
|
||||
const sider = page.locator('.ant-layout-sider');
|
||||
const trigger = page.locator('.ant-layout-sider-trigger');
|
||||
|
||||
await expect(sider).toBeVisible();
|
||||
|
||||
await trigger.click();
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
await trigger.click();
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
await expect(sider).toBeVisible();
|
||||
});
|
||||
|
||||
test('折叠时应只显示图标', async ({ page }) => {
|
||||
const sider = page.locator('.ant-layout-sider');
|
||||
const trigger = page.locator('.ant-layout-sider-trigger');
|
||||
|
||||
await trigger.click();
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
const collapsedSider = page.locator('.ant-layout-sider-collapsed');
|
||||
await expect(collapsedSider).toBeVisible();
|
||||
const aside = page.locator('aside');
|
||||
await expect(aside.getByText('供应商管理')).toBeVisible();
|
||||
await expect(aside.getByText('用量统计')).toBeVisible();
|
||||
});
|
||||
|
||||
test('默认应显示亮色侧边栏', async ({ page }) => {
|
||||
const sider = page.locator('.ant-layout-sider');
|
||||
await expect(sider).toBeVisible();
|
||||
const aside = page.locator('aside');
|
||||
await expect(aside).toBeVisible();
|
||||
|
||||
const menu = page.locator('.ant-menu-light');
|
||||
const menu = page.locator('.t-menu');
|
||||
await expect(menu).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user