08ea5fbe98
添加用户管理视图、API和状态管理文件
98 lines
3.4 KiB
TypeScript
98 lines
3.4 KiB
TypeScript
import { describe, it, expect } from '@wdio/globals';
|
|
import { MobileCalendarPage } from '../pages/CalendarPage';
|
|
|
|
describe('iOS Calendar Tests', () => {
|
|
let calendarPage: MobileCalendarPage;
|
|
|
|
before(async () => {
|
|
calendarPage = new MobileCalendarPage(browser);
|
|
await calendarPage.navigate();
|
|
});
|
|
|
|
it('should display current date', async () => {
|
|
const currentDate = await calendarPage.getCurrentDate();
|
|
expect(currentDate).toBeTruthy();
|
|
});
|
|
|
|
it('should allow date selection', async () => {
|
|
await calendarPage.selectDate('2026-02-11');
|
|
const selectedDate = await calendarPage.getSelectedDate();
|
|
expect(selectedDate).toContain('2026-02-11');
|
|
});
|
|
|
|
it('should navigate to next month', async () => {
|
|
const currentMonthBefore = await calendarPage.getCurrentMonth();
|
|
await calendarPage.navigateToNextMonth();
|
|
const currentMonthAfter = await calendarPage.getCurrentMonth();
|
|
expect(currentMonthBefore).not.toBe(currentMonthAfter);
|
|
});
|
|
|
|
it('should navigate to previous month', async () => {
|
|
const currentMonthBefore = await calendarPage.getCurrentMonth();
|
|
await calendarPage.navigateToPreviousMonth();
|
|
const currentMonthAfter = await calendarPage.getCurrentMonth();
|
|
expect(currentMonthBefore).not.toBe(currentMonthAfter);
|
|
});
|
|
|
|
it('should display today indicator', async () => {
|
|
const today = new Date();
|
|
const todayDate = today.toISOString().split('T')[0];
|
|
const isToday = await calendarPage.isToday(todayDate);
|
|
expect(isToday).toBe(true);
|
|
});
|
|
|
|
it('should display weekend indicators', async () => {
|
|
const weekendDate = '2026-02-15';
|
|
const isWeekend = await calendarPage.isWeekend(weekendDate);
|
|
expect(isWeekend).toBe(true);
|
|
});
|
|
|
|
it('should allow tap on date', async () => {
|
|
const date = '2026-02-11';
|
|
await calendarPage.tapDate(date);
|
|
const selectedDate = await calendarPage.getSelectedDate();
|
|
expect(selectedDate).toContain(date);
|
|
});
|
|
|
|
it('should allow long press on date', async () => {
|
|
const date = '2026-02-11';
|
|
await calendarPage.longPressDate(date);
|
|
await browser.pause(1000);
|
|
const selectedDate = await calendarPage.getSelectedDate();
|
|
expect(selectedDate).toContain(date);
|
|
});
|
|
|
|
it('should allow swipe left to next month', async () => {
|
|
const currentMonthBefore = await calendarPage.getCurrentMonth();
|
|
await calendarPage.swipeLeft();
|
|
await browser.pause(500);
|
|
const currentMonthAfter = await calendarPage.getCurrentMonth();
|
|
expect(currentMonthBefore).not.toBe(currentMonthAfter);
|
|
});
|
|
|
|
it('should allow swipe right to previous month', async () => {
|
|
const currentMonthBefore = await calendarPage.getCurrentMonth();
|
|
await calendarPage.swipeRight();
|
|
await browser.pause(500);
|
|
const currentMonthAfter = await calendarPage.getCurrentMonth();
|
|
expect(currentMonthBefore).not.toBe(currentMonthAfter);
|
|
});
|
|
|
|
it('should display calendar events', async () => {
|
|
const events = await calendarPage.getCalendarEvents();
|
|
expect(Array.isArray(events)).toBe(true);
|
|
});
|
|
|
|
it('should display event indicators for dates with events', async () => {
|
|
const dateWithEvent = '2026-02-11';
|
|
const hasEvent = await calendarPage.hasEvent(dateWithEvent);
|
|
expect(hasEvent).toBe(true);
|
|
});
|
|
|
|
it('should display all dates in current month', async () => {
|
|
const date = '2026-02-15';
|
|
const isVisible = await calendarPage.isDateVisible(date);
|
|
expect(isVisible).toBe(true);
|
|
});
|
|
});
|