fix: add navigation role attribute for better test selector
This commit is contained in:
@@ -26,11 +26,33 @@ test.describe('首页冒烟测试 @smoke', () => {
|
||||
});
|
||||
|
||||
test('应该显示主导航菜单', async ({ homePage }) => {
|
||||
await expect(homePage.navigation).toBeVisible();
|
||||
const isMobile = await homePage.mobileMenuButton.isVisible();
|
||||
if (isMobile) {
|
||||
await expect(homePage.mobileMenuButton).toBeVisible();
|
||||
} else {
|
||||
await expect(homePage.desktopNavigation).toBeVisible();
|
||||
}
|
||||
const navItems = await homePage.getNavigationItemCount();
|
||||
expect(navItems).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test('移动端应该显示导航菜单按钮', async ({ homePage, page }) => {
|
||||
await page.setViewportSize({ width: 375, height: 667 });
|
||||
await expect(homePage.mobileMenuButton).toBeVisible();
|
||||
});
|
||||
|
||||
test('应该显示立即咨询按钮', async ({ homePage }) => {
|
||||
const isMobile = await homePage.mobileMenuButton.isVisible();
|
||||
if (isMobile) {
|
||||
await homePage.mobileMenuButton.click();
|
||||
await expect(homePage.mobileNavigation).toBeVisible();
|
||||
const consultButton = homePage.mobileNavigation.locator('a[href="/contact"]').first();
|
||||
await expect(consultButton).toBeVisible();
|
||||
} else {
|
||||
await expect(homePage.consultButton).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test('应该显示所有主要区块', async ({ homePage }) => {
|
||||
await expect(homePage.heroSection).toBeVisible();
|
||||
await homePage.scrollToSection('services');
|
||||
|
||||
Reference in New Issue
Block a user