08ea5fbe98
添加用户管理视图、API和状态管理文件
123 lines
3.1 KiB
TypeScript
123 lines
3.1 KiB
TypeScript
import { Page } from 'playwright';
|
|
|
|
export class MiniProgramAlmanacPage {
|
|
constructor(private page: Page) {}
|
|
|
|
async navigate() {
|
|
await this.page.goto('http://localhost:9527/#/pages/almanac/index');
|
|
await this.page.waitForLoadState('networkidle');
|
|
}
|
|
|
|
async getCurrentDate() {
|
|
const currentDate = await this.page.locator('.current-date').textContent();
|
|
return currentDate || '';
|
|
}
|
|
|
|
async getLunarDate() {
|
|
const lunarDate = await this.page.locator('.lunar-date').textContent();
|
|
return lunarDate || '';
|
|
}
|
|
|
|
async getGanZhi() {
|
|
const ganzhi = await this.page.locator('.ganzhi').textContent();
|
|
return ganzhi || '';
|
|
}
|
|
|
|
async getZodiac() {
|
|
const zodiac = await this.page.locator('.zodiac').textContent();
|
|
return zodiac || '';
|
|
}
|
|
|
|
async getSolarTerm() {
|
|
const solarTerm = await this.page.locator('.solar-term').textContent();
|
|
return solarTerm || '';
|
|
}
|
|
|
|
async getSuitable() {
|
|
const suitable = await this.page.locator('.suitable').textContent();
|
|
return suitable || '';
|
|
}
|
|
|
|
async getUnsuitable() {
|
|
const unsuitable = await this.page.locator('.unsuitable').textContent();
|
|
return unsuitable || '';
|
|
}
|
|
|
|
async getDayInfo() {
|
|
const dayInfo = await this.page.locator('.day-info').textContent();
|
|
return dayInfo || '';
|
|
}
|
|
|
|
async searchDate(date: string) {
|
|
await this.page.fill('.date-search input', date);
|
|
await this.page.click('.date-search button');
|
|
await this.page.waitForLoadState('networkidle');
|
|
}
|
|
|
|
async navigateToNextDay() {
|
|
await this.page.click('.next-day');
|
|
}
|
|
|
|
async navigateToPreviousDay() {
|
|
await this.page.click('.previous-day');
|
|
}
|
|
|
|
async isToday() {
|
|
const todayIndicator = this.page.locator('.today-indicator');
|
|
return await todayIndicator.isVisible();
|
|
}
|
|
|
|
async getAlmanacDetails() {
|
|
const details = await this.page.locator('.almanac-details').textContent();
|
|
return details || '';
|
|
}
|
|
|
|
async tapDate(date: string) {
|
|
await this.page.tap(`[data-date="${date}"]`);
|
|
}
|
|
|
|
async longPressDate(date: string) {
|
|
const element = this.page.locator(`[data-date="${date}"]`);
|
|
await element.tap();
|
|
await this.page.waitForTimeout(500);
|
|
}
|
|
|
|
async swipeLeft() {
|
|
await this.page.touchscreen.tap(0, 0);
|
|
await this.page.touchscreen.tap(100, 0);
|
|
}
|
|
|
|
async swipeRight() {
|
|
await this.page.touchscreen.tap(100, 0);
|
|
await this.page.touchscreen.tap(0, 0);
|
|
}
|
|
|
|
async shareAlmanac() {
|
|
await this.page.click('.share-button');
|
|
}
|
|
|
|
async bookmarkDate() {
|
|
await this.page.click('.bookmark-button');
|
|
}
|
|
|
|
async isBookmarked() {
|
|
const bookmarked = this.page.locator('.bookmarked');
|
|
return await bookmarked.isVisible();
|
|
}
|
|
|
|
async getLunarCalendar() {
|
|
const lunarCalendar = await this.page.locator('.lunar-calendar').textContent();
|
|
return lunarCalendar || '';
|
|
}
|
|
|
|
async getFestivals() {
|
|
const festivals = await this.page.locator('.festivals').allTextContents();
|
|
return festivals;
|
|
}
|
|
|
|
async hasFestival() {
|
|
const festivalIndicator = this.page.locator('.festival-indicator');
|
|
return await festivalIndicator.isVisible();
|
|
}
|
|
}
|