fix: update mobile menu tests to use mobile viewport

This commit is contained in:
张翔
2026-02-27 11:10:00 +08:00
parent b787c769ec
commit 0c7a7f5b05
4 changed files with 13 additions and 4 deletions
@@ -59,6 +59,7 @@ test.describe('首页回归测试 @regression', () => {
});
test('应该能够打开和关闭移动端菜单', async ({ homePage }) => {
await homePage.page.setViewportSize({ width: 375, height: 667 });
await homePage.openMobileMenu();
await expect(homePage.mobileMenu).toBeVisible();
@@ -67,6 +68,7 @@ test.describe('首页回归测试 @regression', () => {
});
test('移动端菜单应该包含所有导航项', async ({ homePage }) => {
await homePage.page.setViewportSize({ width: 375, height: 667 });
await homePage.openMobileMenu();
const desktopNavItems = await homePage.getAllNavigationLabels();
const mobileNavItems = homePage.mobileMenu.locator('a');
@@ -76,6 +78,7 @@ test.describe('首页回归测试 @regression', () => {
});
test('应该能够通过移动端菜单导航', async ({ homePage }) => {
await homePage.page.setViewportSize({ width: 375, height: 667 });
await homePage.openMobileMenu();
const firstLink = homePage.mobileMenu.locator('a').first();
await firstLink.click();