import { test, expect } from '@playwright/test';
|
|
test.describe('CSideMenu 组件', () => {
|
test.beforeEach(async ({ page }) => {
|
await page.goto('http://localhost:5173/#/preview/pages/side-menu/SideMenuPage.tsx');
|
});
|
|
test('页面加载正常', async ({ page }) => {
|
// 等待页面加载
|
await page.waitForSelector('text=CSideMenu 组件示例', { timeout: 10000 });
|
// 验证标题
|
await expect(page.locator('text=CSideMenu 组件示例')).toBeVisible();
|
});
|
|
test('左侧菜单显示正常', async ({ page }) => {
|
// 验证菜单标题
|
await expect(page.locator('text=管理后台')).toBeVisible();
|
// 验证菜单项
|
await expect(page.locator('text=导航1')).toBeVisible();
|
});
|
|
test('菜单点击功能正常', async ({ page }) => {
|
// 点击子菜单
|
await page.click('text=子菜单1-1');
|
// 验证页面1-1-1 显示
|
await expect(page.locator('text=页面1-1-1')).toBeVisible();
|
});
|
});
|