08ea5fbe98
添加用户管理视图、API和状态管理文件
69 lines
1.9 KiB
TypeScript
69 lines
1.9 KiB
TypeScript
import { BasePage } from './base-page';
|
|
|
|
export class CalendarPage extends BasePage {
|
|
private readonly selectors = {
|
|
calendarHeader: '.calendar-header',
|
|
prevMonthButton: '[data-testid="prev-month"]',
|
|
nextMonthButton: '[data-testid="next-month"]',
|
|
todayButton: '[data-testid="today"]',
|
|
calendarGrid: '.calendar-grid',
|
|
dayCell: '.day-cell',
|
|
selectedDay: '.day-cell.selected',
|
|
lunarInfoCard: '.lunar-info-card',
|
|
lunarDate: '.lunar-date',
|
|
solarTerm: '.solar-term',
|
|
zodiac: '.zodiac',
|
|
};
|
|
|
|
async navigate() {
|
|
await this.page.goto(`${this.baseURL}/pages/calendar/index`);
|
|
await this.waitForLoad();
|
|
}
|
|
|
|
async clickPrevMonth() {
|
|
await this.clickElement(this.selectors.prevMonthButton);
|
|
await this.waitForLoad();
|
|
}
|
|
|
|
async clickNextMonth() {
|
|
await this.clickElement(this.selectors.nextMonthButton);
|
|
await this.waitForLoad();
|
|
}
|
|
|
|
async clickToday() {
|
|
await this.clickElement(this.selectors.todayButton);
|
|
await this.waitForLoad();
|
|
}
|
|
|
|
async clickDay(day: number) {
|
|
const daySelector = `${this.selectors.dayCell}[data-day="${day}"]`;
|
|
await this.clickElement(daySelector);
|
|
await this.waitForElementVisible(this.selectors.selectedDay);
|
|
}
|
|
|
|
async getSelectedDay(): Promise<number> {
|
|
const selectedDay = await this.page.getAttribute(this.selectors.selectedDay, 'data-day');
|
|
return selectedDay ? parseInt(selectedDay) : 0;
|
|
}
|
|
|
|
async getLunarDate(): Promise<string> {
|
|
return await this.getText(this.selectors.lunarDate);
|
|
}
|
|
|
|
async getSolarTerm(): Promise<string> {
|
|
return await this.getText(this.selectors.solarTerm);
|
|
}
|
|
|
|
async getZodiac(): Promise<string> {
|
|
return await this.getText(this.selectors.zodiac);
|
|
}
|
|
|
|
async isLunarInfoCardVisible(): Promise<boolean> {
|
|
return await this.isVisible(this.selectors.lunarInfoCard);
|
|
}
|
|
|
|
async getCalendarTitle(): Promise<string> {
|
|
return await this.getText(this.selectors.calendarHeader);
|
|
}
|
|
}
|