08ea5fbe98
添加用户管理视图、API和状态管理文件
84 lines
2.5 KiB
TypeScript
84 lines
2.5 KiB
TypeScript
/**
|
|
* UniApp 运势分析页面E2E测试
|
|
*
|
|
* 测试运势分析页面的所有功能和交互
|
|
*
|
|
* @tags @fortune @uniapp @e2e @page
|
|
*/
|
|
|
|
import { test, expect } from '@playwright/test';
|
|
import { TestLogger } from '../../core/test-logger.js';
|
|
|
|
test.describe('E2E: UniApp 运势分析页面', () => {
|
|
let logger: TestLogger;
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
logger = new TestLogger();
|
|
await page.goto('http://localhost:8081/pages/aigc/index');
|
|
|
|
await page.waitForLoadState('networkidle');
|
|
await page.waitForTimeout(3000);
|
|
|
|
await page.waitForSelector('#app', { state: 'attached', timeout: 10000 });
|
|
await page.waitForTimeout(2000);
|
|
});
|
|
|
|
test('应该显示运势分析页面内容 @smoke', async ({ page }) => {
|
|
const pageContent = await page.content();
|
|
logger.info('页面内容长度:', pageContent.length);
|
|
|
|
const appElement = page.locator('#app');
|
|
await expect(appElement).toBeVisible({ timeout: 10000 });
|
|
});
|
|
|
|
test('应该显示功能标签 @smoke', async ({ page }) => {
|
|
await page.waitForTimeout(5000);
|
|
|
|
const featureTabs = page.locator('.feature-tabs');
|
|
const isVisible = await featureTabs.isVisible().catch(() => false);
|
|
|
|
if (isVisible) {
|
|
await expect(featureTabs).toBeVisible();
|
|
} else {
|
|
logger.info('功能标签可能尚未加载');
|
|
}
|
|
});
|
|
|
|
test('应该显示日期选择器 @smoke', async ({ page }) => {
|
|
await page.waitForTimeout(5000);
|
|
|
|
const datePicker = page.locator('.date-picker-section');
|
|
const isVisible = await datePicker.isVisible().catch(() => false);
|
|
|
|
if (isVisible) {
|
|
await expect(datePicker).toBeVisible();
|
|
} else {
|
|
logger.info('日期选择器可能尚未加载');
|
|
}
|
|
});
|
|
|
|
test('应该显示分析按钮 @smoke', async ({ page }) => {
|
|
await page.waitForTimeout(5000);
|
|
|
|
const analyzeBtn = page.locator('.analyze-btn, button');
|
|
const isVisible = await analyzeBtn.isVisible().catch(() => false);
|
|
|
|
if (isVisible) {
|
|
await expect(analyzeBtn.first()).toBeVisible();
|
|
} else {
|
|
logger.info('分析按钮可能尚未加载');
|
|
}
|
|
});
|
|
|
|
test('应该在不同视口下正常显示 @responsive', async ({ page }) => {
|
|
await page.setViewportSize({ width: 375, height: 667 });
|
|
await page.goto('http://localhost:8081/pages/aigc/index');
|
|
|
|
await page.waitForLoadState('networkidle');
|
|
await page.waitForTimeout(5000);
|
|
|
|
const appElement = page.locator('#app');
|
|
await expect(appElement).toBeVisible({ timeout: 10000 });
|
|
});
|
|
});
|