playwright/tests/e2e/menu.spec.js
2025-03-07 16:53:34 +08:00

37 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 加载环境变量
require('../../config/env');
const {test} = require('@playwright/test');
const TestController = require('../../src/controllers/LongiTestController');
test.describe('IBP系统菜单可访问性测试', () => {
let controller;
test.beforeAll(async () => {
controller = new TestController();
});
test('应能成功获取系统所有可测试的菜单项', async () => {
const menuData = await controller.fetchAndSaveMenuData();
test.expect(menuData).toBeTruthy();
test.expect(menuData.length).toBeGreaterThan(0);
console.log(`✓ 成功收集 ${menuData.length} 个菜单项`);
});
test('应能成功访问所有菜单页面', async () => {
// 执行所有测试并获取进度
const progress = await controller.runAllTests();
// 验证测试结果
test.expect(progress).toBeTruthy();
test.expect(progress.total).toBeGreaterThan(0);
test.expect(progress.completed).toBe(progress.total);
test.expect(progress.remaining).toBe(0);
// 输出测试统计
console.log('\n测试完成');
console.log(`总菜单数: ${progress.total}`);
console.log(`完成数量: ${progress.completed}`);
console.log(`剩余数量: ${progress.remaining}`);
});
});