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 { const selectedDay = await this.page.getAttribute(this.selectors.selectedDay, 'data-day'); return selectedDay ? parseInt(selectedDay) : 0; } async getLunarDate(): Promise { return await this.getText(this.selectors.lunarDate); } async getSolarTerm(): Promise { return await this.getText(this.selectors.solarTerm); } async getZodiac(): Promise { return await this.getText(this.selectors.zodiac); } async isLunarInfoCardVisible(): Promise { return await this.isVisible(this.selectors.lunarInfoCard); } async getCalendarTitle(): Promise { return await this.getText(this.selectors.calendarHeader); } }