08ea5fbe98
添加用户管理视图、API和状态管理文件
52 lines
1.7 KiB
TypeScript
52 lines
1.7 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { CalendarPage } from './pages/calendar-page';
|
|
import { BottomNavigation } from './pages/bottom-navigation';
|
|
|
|
test.describe('状态更新测试', () => {
|
|
let calendarPage: CalendarPage;
|
|
let bottomNavigation: BottomNavigation;
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
calendarPage = new CalendarPage(page);
|
|
bottomNavigation = new BottomNavigation(page);
|
|
await calendarPage.navigate();
|
|
});
|
|
|
|
test('TC-014: 选中日期状态更新测试', async ({ page }) => {
|
|
const today = new Date();
|
|
const firstDay = 1;
|
|
const secondDay = 15;
|
|
|
|
await calendarPage.clickDay(firstDay);
|
|
let selectedDay = await calendarPage.getSelectedDay();
|
|
expect(selectedDay).toBe(firstDay);
|
|
|
|
const isLunarInfoVisible = await calendarPage.isLunarInfoCardVisible();
|
|
expect(isLunarInfoVisible).toBe(true);
|
|
|
|
await calendarPage.clickDay(secondDay);
|
|
selectedDay = await calendarPage.getSelectedDay();
|
|
expect(selectedDay).toBe(secondDay);
|
|
|
|
const isStillLunarInfoVisible = await calendarPage.isLunarInfoCardVisible();
|
|
expect(isStillLunarInfoVisible).toBe(true);
|
|
});
|
|
|
|
test('TC-015: 导航栏状态更新测试', async ({ page }) => {
|
|
let isActive = await bottomNavigation.isTabActive('calendar');
|
|
expect(isActive).toBe(true);
|
|
|
|
await bottomNavigation.clickTab('almanac');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
isActive = await bottomNavigation.isTabActive('almanac');
|
|
expect(isActive).toBe(true);
|
|
|
|
await bottomNavigation.clickTab('user');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
isActive = await bottomNavigation.isTabActive('user');
|
|
expect(isActive).toBe(true);
|
|
});
|
|
});
|