Files
everything-is-suitable/everything-is-suitable-uniapp/e2e/mobile/android/almanac.spec.ts
T
张翔 08ea5fbe98 feat(admin): 添加用户管理相关文件
添加用户管理视图、API和状态管理文件
2026-03-28 14:37:29 +08:00

136 lines
4.3 KiB
TypeScript

import { describe, it, expect } from '@wdio/globals';
import { MobileAlmanacPage } from '../pages/AlmanacPage';
describe('Android Almanac Tests', () => {
let almanacPage: MobileAlmanacPage;
before(async () => {
almanacPage = new MobileAlmanacPage(browser);
await almanacPage.navigate();
});
it('should display current date', async () => {
const currentDate = await almanacPage.getCurrentDate();
expect(currentDate).toBeTruthy();
});
it('should display lunar date', async () => {
const lunarDate = await almanacPage.getLunarDate();
expect(lunarDate).toBeTruthy();
});
it('should display gan zhi', async () => {
const ganzhi = await almanacPage.getGanZhi();
expect(ganzhi).toBeTruthy();
});
it('should display zodiac', async () => {
const zodiac = await almanacPage.getZodiac();
expect(zodiac).toBeTruthy();
});
it('should display solar term', async () => {
const solarTerm = await almanacPage.getSolarTerm();
expect(solarTerm).toBeTruthy();
});
it('should display suitable activities', async () => {
const suitable = await almanacPage.getSuitable();
expect(suitable).toBeTruthy();
});
it('should display unsuitable activities', async () => {
const unsuitable = await almanacPage.getUnsuitable();
expect(unsuitable).toBeTruthy();
});
it('should display day info', async () => {
const dayInfo = await almanacPage.getDayInfo();
expect(dayInfo).toBeTruthy();
});
it('should allow date search', async () => {
const date = '2026-02-11';
await almanacPage.searchDate(date);
const currentDate = await almanacPage.getCurrentDate();
expect(currentDate).toContain(date);
});
it('should navigate to next day', async () => {
const currentDateBefore = await almanacPage.getCurrentDate();
await almanacPage.navigateToNextDay();
const currentDateAfter = await almanacPage.getCurrentDate();
expect(currentDateBefore).not.toBe(currentDateAfter);
});
it('should navigate to previous day', async () => {
const currentDateBefore = await almanacPage.getCurrentDate();
await almanacPage.navigateToPreviousDay();
const currentDateAfter = await almanacPage.getCurrentDate();
expect(currentDateBefore).not.toBe(currentDateAfter);
});
it('should display today indicator', async () => {
const isToday = await almanacPage.isToday();
expect(isToday).toBe(true);
});
it('should display almanac details', async () => {
const details = await almanacPage.getAlmanacDetails();
expect(details).toBeTruthy();
});
it('should allow tap on date', async () => {
const date = '2026-02-11';
await almanacPage.tapDate(date);
const currentDate = await almanacPage.getCurrentDate();
expect(currentDate).toContain(date);
});
it('should allow long press on date', async () => {
const date = '2026-02-11';
await almanacPage.longPressDate(date);
await browser.pause(1000);
const currentDate = await almanacPage.getCurrentDate();
expect(currentDate).toContain(date);
});
it('should allow swipe left to next day', async () => {
const currentDateBefore = await almanacPage.getCurrentDate();
await almanacPage.swipeLeft();
await browser.pause(500);
const currentDateAfter = await almanacPage.getCurrentDate();
expect(currentDateBefore).not.toBe(currentDateAfter);
});
it('should allow swipe right to previous day', async () => {
const currentDateBefore = await almanacPage.getCurrentDate();
await almanacPage.swipeRight();
await browser.pause(500);
const currentDateAfter = await almanacPage.getCurrentDate();
expect(currentDateBefore).not.toBe(currentDateAfter);
});
it('should allow share almanac', async () => {
await almanacPage.shareAlmanac();
await browser.pause(1000);
const shareDialog = await browser.$('.share-dialog');
const isVisible = await shareDialog.isDisplayed();
expect(isVisible).toBe(true);
});
it('should allow bookmark date', async () => {
await almanacPage.bookmarkDate();
await browser.pause(500);
const isBookmarked = await almanacPage.isBookmarked();
expect(isBookmarked).toBe(true);
});
it('should allow unbookmark date', async () => {
await almanacPage.bookmarkDate();
await browser.pause(500);
const isBookmarked = await almanacPage.isBookmarked();
expect(isBookmarked).toBe(false);
});
});