08ea5fbe98
添加用户管理视图、API和状态管理文件
81 lines
2.8 KiB
TypeScript
81 lines
2.8 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { CalendarPage } from './pages/calendar-page';
|
|
import { AlmanacPage } from './pages/almanac-page';
|
|
|
|
test.describe('边界条件测试', () => {
|
|
let calendarPage: CalendarPage;
|
|
let almanacPage: AlmanacPage;
|
|
|
|
test('TC-016: 月份边界测试', async ({ page }) => {
|
|
calendarPage = new CalendarPage(page);
|
|
await calendarPage.navigate();
|
|
|
|
await calendarPage.clickNextMonth();
|
|
await calendarPage.clickNextMonth();
|
|
await calendarPage.clickNextMonth();
|
|
await calendarPage.clickNextMonth();
|
|
await calendarPage.clickNextMonth();
|
|
await calendarPage.clickNextMonth();
|
|
await calendarPage.clickNextMonth();
|
|
await calendarPage.clickNextMonth();
|
|
await calendarPage.clickNextMonth();
|
|
await calendarPage.clickNextMonth();
|
|
await calendarPage.clickNextMonth();
|
|
|
|
let calendarTitle = await calendarPage.getCalendarTitle();
|
|
console.log('Calendar title after 12 next month clicks:', calendarTitle);
|
|
|
|
await calendarPage.clickNextMonth();
|
|
calendarTitle = await calendarPage.getCalendarTitle();
|
|
console.log('Calendar title after 13th next month click:', calendarTitle);
|
|
|
|
await calendarPage.clickPrevMonth();
|
|
calendarTitle = await calendarPage.getCalendarTitle();
|
|
console.log('Calendar title after prev month click:', calendarTitle);
|
|
});
|
|
|
|
test('TC-017: 日期边界测试', async ({ page }) => {
|
|
almanacPage = new AlmanacPage(page);
|
|
await almanacPage.navigate();
|
|
|
|
const initialDateDisplay = await almanacPage.getDateDisplay();
|
|
console.log('Initial date display:', initialDateDisplay);
|
|
|
|
for (let i = 0; i < 32; i++) {
|
|
await almanacPage.clickPrevDate();
|
|
}
|
|
|
|
const prevDateDisplay = await almanacPage.getDateDisplay();
|
|
console.log('Date display after 32 prev clicks:', prevDateDisplay);
|
|
expect(prevDateDisplay).not.toBe(initialDateDisplay);
|
|
|
|
for (let i = 0; i < 64; i++) {
|
|
await almanacPage.clickNextDate();
|
|
}
|
|
|
|
const nextDateDisplay = await almanacPage.getDateDisplay();
|
|
console.log('Date display after 64 next clicks:', nextDateDisplay);
|
|
expect(nextDateDisplay).not.toBe(prevDateDisplay);
|
|
});
|
|
|
|
test('TC-018: 表单验证测试', async ({ page }) => {
|
|
calendarPage = new CalendarPage(page);
|
|
await calendarPage.navigate();
|
|
|
|
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);
|
|
|
|
const lunarDate = await calendarPage.getLunarDate();
|
|
expect(lunarDate).toBeTruthy();
|
|
expect(lunarDate).toContain('农历');
|
|
});
|
|
});
|