08ea5fbe98
添加用户管理视图、API和状态管理文件
59 lines
2.0 KiB
TypeScript
59 lines
2.0 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { CalendarPage } from './pages/calendar-page';
|
|
|
|
test.describe('万年历页面测试', () => {
|
|
let calendarPage: CalendarPage;
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
calendarPage = new CalendarPage(page);
|
|
await calendarPage.navigate();
|
|
});
|
|
|
|
test('TC-003: 日历月份切换测试', async ({ page }) => {
|
|
const initialTitle = await calendarPage.getCalendarTitle();
|
|
console.log('Initial calendar title:', initialTitle);
|
|
|
|
await calendarPage.clickPrevMonth();
|
|
const prevMonthTitle = await calendarPage.getCalendarTitle();
|
|
console.log('Previous month title:', prevMonthTitle);
|
|
expect(prevMonthTitle).not.toBe(initialTitle);
|
|
|
|
await calendarPage.clickNextMonth();
|
|
const nextMonthTitle = await calendarPage.getCalendarTitle();
|
|
console.log('Next month title:', nextMonthTitle);
|
|
expect(nextMonthTitle).not.toBe(prevMonthTitle);
|
|
|
|
await calendarPage.clickToday();
|
|
const todayTitle = await calendarPage.getCalendarTitle();
|
|
console.log('Today title:', todayTitle);
|
|
expect(todayTitle).toBeTruthy();
|
|
});
|
|
|
|
test('TC-004: 日期选择测试', async ({ page }) => {
|
|
const today = new Date();
|
|
const selectedDay = today.getDate();
|
|
|
|
await calendarPage.clickDay(selectedDay);
|
|
|
|
const selectedDayElement = await calendarPage.getSelectedDay();
|
|
expect(selectedDayElement).toBe(selectedDay);
|
|
|
|
const isLunarInfoVisible = await calendarPage.isLunarInfoCardVisible();
|
|
expect(isLunarInfoVisible).toBe(true);
|
|
});
|
|
|
|
test('TC-005: 农历信息显示测试', async ({ page }) => {
|
|
const today = new Date();
|
|
const selectedDay = today.getDate();
|
|
|
|
await calendarPage.clickDay(selectedDay);
|
|
|
|
const isLunarInfoVisible = await calendarPage.isLunarInfoCardVisible();
|
|
expect(isLunarInfoVisible).toBe(true);
|
|
|
|
const lunarDate = await calendarPage.getLunarDate();
|
|
expect(lunarDate).toBeTruthy();
|
|
expect(lunarDate).toContain('农历');
|
|
});
|
|
});
|