08ea5fbe98
添加用户管理视图、API和状态管理文件
61 lines
2.0 KiB
TypeScript
61 lines
2.0 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { CalendarPage } from './pages/calendar-page';
|
|
import { AlmanacPage } from './pages/almanac-page';
|
|
import { UserPage } from './pages/user-page';
|
|
import { BottomNavigation } from './pages/bottom-navigation';
|
|
|
|
test.describe('页面导航测试', () => {
|
|
let calendarPage: CalendarPage;
|
|
let almanacPage: AlmanacPage;
|
|
let userPage: UserPage;
|
|
let bottomNavigation: BottomNavigation;
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
calendarPage = new CalendarPage(page);
|
|
almanacPage = new AlmanacPage(page);
|
|
userPage = new UserPage(page);
|
|
bottomNavigation = new BottomNavigation(page);
|
|
});
|
|
|
|
test('TC-001: 底部导航栏切换测试', async ({ page }) => {
|
|
await calendarPage.navigate();
|
|
|
|
const title = await calendarPage.getTitle();
|
|
expect(title).toContain('万年历');
|
|
|
|
await bottomNavigation.clickTab('almanac');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const almanacTitle = await almanacPage.getAlmanacTitle();
|
|
expect(almanacTitle).toBeTruthy();
|
|
|
|
await bottomNavigation.clickTab('user');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const userTitle = await userPage.getPageTitle();
|
|
expect(userTitle).toContain('我的');
|
|
|
|
await bottomNavigation.clickTab('calendar');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
const calendarTitle = await calendarPage.getTitle();
|
|
expect(calendarTitle).toContain('万年历');
|
|
});
|
|
|
|
test('TC-002: 页面标题显示测试', async ({ page }) => {
|
|
await calendarPage.navigate();
|
|
let title = await calendarPage.getTitle();
|
|
expect(title).toContain('万年历');
|
|
|
|
await bottomNavigation.clickTab('almanac');
|
|
await page.waitForLoadState('networkidle');
|
|
title = await page.title();
|
|
expect(title).toContain('黄历');
|
|
|
|
await bottomNavigation.clickTab('user');
|
|
await page.waitForLoadState('networkidle');
|
|
title = await page.title();
|
|
expect(title).toContain('我的');
|
|
});
|
|
});
|