fix: update mobile menu tests to use mobile viewport
This commit is contained in:
@@ -35,8 +35,8 @@ export class HomePage extends BasePage {
|
||||
this.contactSection = page.locator('#contact');
|
||||
this.footer = page.locator('footer');
|
||||
|
||||
this.mobileMenuButton = page.locator('button[aria-label="打开菜单"]');
|
||||
this.mobileMenu = page.locator('#mobile-menu-panel');
|
||||
this.mobileMenuButton = page.locator('button[aria-label*="菜单"]');
|
||||
this.mobileMenu = page.locator('#mobile-menu');
|
||||
}
|
||||
|
||||
async goto(): Promise<void> {
|
||||
@@ -69,16 +69,17 @@ export class HomePage extends BasePage {
|
||||
}
|
||||
|
||||
async openMobileMenu(): Promise<void> {
|
||||
await this.mobileMenuButton.waitFor({ state: 'visible', timeout: 5000 });
|
||||
if (!(await this.mobileMenu.isVisible())) {
|
||||
await this.mobileMenuButton.click();
|
||||
await this.mobileMenu.waitFor({ state: 'visible' });
|
||||
await this.mobileMenu.waitFor({ state: 'visible', timeout: 5000 });
|
||||
}
|
||||
}
|
||||
|
||||
async closeMobileMenu(): Promise<void> {
|
||||
if (await this.mobileMenu.isVisible()) {
|
||||
await this.mobileMenuButton.click();
|
||||
await this.mobileMenu.waitFor({ state: 'hidden' });
|
||||
await this.mobileMenu.waitFor({ state: 'hidden', timeout: 5000 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user