08ea5fbe98
添加用户管理视图、API和状态管理文件
72 lines
2.4 KiB
TypeScript
72 lines
2.4 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test('API集成测试:黄历页面基本功能', async ({ page }) => {
|
|
await page.goto('http://localhost:8081');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const bottomNav = page.locator('.bottom-navigation');
|
|
await expect(bottomNav).toBeVisible();
|
|
|
|
await bottomNav.locator('.nav-item').filter({ hasText: '黄历' }).click();
|
|
await page.waitForTimeout(3000);
|
|
|
|
const almanacCard = page.locator('.almanac-main-card');
|
|
await expect(almanacCard).toBeVisible();
|
|
|
|
const dateText = page.locator('.date-picker-text');
|
|
await expect(dateText).toBeVisible();
|
|
|
|
const dateTextContent = await dateText.textContent();
|
|
console.log('当前日期:', dateTextContent);
|
|
|
|
const yiText = page.locator('.yi-text');
|
|
const yiTextContent = await yiText.textContent();
|
|
console.log('宜:', yiTextContent);
|
|
|
|
const jiText = page.locator('.ji-text');
|
|
const jiTextContent = await jiText.textContent();
|
|
console.log('忌:', jiTextContent);
|
|
|
|
expect(yiTextContent).toBeTruthy();
|
|
expect(jiTextContent).toBeTruthy();
|
|
});
|
|
|
|
test('API集成测试:日期切换功能', async ({ page }) => {
|
|
await page.goto('http://localhost:8081');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const bottomNav = page.locator('.bottom-navigation');
|
|
await bottomNav.locator('.nav-item').filter({ hasText: '黄历' }).click();
|
|
await page.waitForTimeout(3000);
|
|
|
|
const dateText = page.locator('.date-picker-text');
|
|
const initialDate = await dateText.textContent();
|
|
console.log('初始日期:', initialDate);
|
|
|
|
const nextButton = page.locator('.date-picker-btn').nth(1);
|
|
await nextButton.click();
|
|
await page.waitForTimeout(3000);
|
|
|
|
const newDate = await dateText.textContent();
|
|
console.log('新日期:', newDate);
|
|
|
|
expect(newDate).not.toBe(initialDate);
|
|
});
|
|
|
|
test('API集成测试:万年历页面基本功能', async ({ page }) => {
|
|
await page.goto('http://localhost:8081');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const calendarHeader = page.locator('.page-content .calendar-header');
|
|
await expect(calendarHeader).toBeVisible();
|
|
|
|
const monthTitle = calendarHeader.locator('.month-title');
|
|
await expect(monthTitle).toBeVisible();
|
|
|
|
const titleText = await monthTitle.textContent();
|
|
console.log('万年历标题:', titleText);
|
|
expect(titleText).toMatch(/\d{4}年\d{2}月/);
|
|
|
|
const calendarGrid = page.locator('.calendar-grid');
|
|
await expect(calendarGrid).toBeVisible();
|
|
}); |