新增性能基准测试、安全验证、国际化完整性验证等专项测试; 修复 E2E 测试选择器与当前 UI 不匹配问题; 补充多语言 locale 缺失的 key; 更新 Playwright 配置支持跨浏览器测试; 同步更新测试报告与 README 进度章节。 单元测试 408/408 通过,E2E 测试 39/39 通过(4 种浏览器), 专项测试 47/47 通过,整体覆盖率 77.5%。
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('关键词搜索功能E2E测试', () => {
|
|
test.describe('TC-KEYWORD-001: 搜索页面', () => {
|
|
test('应该能够通过关键词参数访问搜索页面', async ({ page }) => {
|
|
await page.goto('/#/pages/almanac-search/index?keyword=%E9%BB%84%E5%8E%86');
|
|
await page.waitForLoadState('networkidle');
|
|
await page.waitForTimeout(2000);
|
|
|
|
// 验证页面标题
|
|
const pageTitle = page.locator('.page-title')
|
|
await expect(pageTitle).toBeVisible()
|
|
})
|
|
})
|
|
|
|
test.describe('TC-KEYWORD-002: 搜索流程', () => {
|
|
test('搜索页面应该包含搜索条件面板', async ({ page }) => {
|
|
await page.goto('/#/pages/almanac-search/index');
|
|
await page.waitForLoadState('networkidle');
|
|
await page.waitForTimeout(1000);
|
|
|
|
// 验证搜索面板组件存在
|
|
const searchPanel = page.locator('.page-content')
|
|
await expect(searchPanel).toBeVisible()
|
|
})
|
|
})
|
|
|
|
test.describe('TC-KEYWORD-003: 响应式设计', () => {
|
|
test('移动端应该正常显示', async ({ page }) => {
|
|
await page.setViewportSize({ width: 375, height: 667 });
|
|
await page.goto('/#/pages/almanac-search/index');
|
|
await page.waitForLoadState('networkidle');
|
|
await page.waitForTimeout(1000);
|
|
|
|
const pageContent = page.locator('.page-content')
|
|
await expect(pageContent).toBeVisible()
|
|
})
|
|
})
|
|
}) |