feat: 添加面包屑导航组件并优化页面布局
refactor: 重构页面结构和导航逻辑 fix: 修复移动端菜单导航和滚动行为 perf: 优化图片加载性能和资源请求 test: 添加端到端测试和性能测试用例 docs: 更新.gitignore文件 chore: 更新依赖和配置 style: 优化代码格式和类型安全 ci: 调整Playwright测试超时时间 build: 更新Next.js配置和构建选项
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Page, Locator, expect } from '@playwright/test';
|
||||
import { Page, Locator } from '@playwright/test';
|
||||
import { BasePage } from './BasePage';
|
||||
import { ContactFormData } from '../types';
|
||||
|
||||
@@ -46,6 +46,31 @@ export class ContactPage extends BasePage {
|
||||
this.emailInfo = this.contactInfoCard.locator('text=电子邮箱');
|
||||
}
|
||||
|
||||
get breadcrumb(): Locator {
|
||||
return this.page.locator('nav[aria-label="breadcrumb"]');
|
||||
}
|
||||
|
||||
async navigateToContact(): Promise<void> {
|
||||
await this.navigate(this.url);
|
||||
}
|
||||
|
||||
async verifyBreadcrumb(): Promise<boolean> {
|
||||
return await this.breadcrumb.isVisible();
|
||||
}
|
||||
|
||||
async verifyPageHeader(): Promise<boolean> {
|
||||
const header = await this.pageHeader.textContent();
|
||||
return header?.includes('与我们取得联系') || false;
|
||||
}
|
||||
|
||||
async verifyContactForm(): Promise<boolean> {
|
||||
return await this.contactForm.isVisible();
|
||||
}
|
||||
|
||||
async verifyContactInfo(): Promise<boolean> {
|
||||
return await this.contactInfoCard.isVisible();
|
||||
}
|
||||
|
||||
async goto(): Promise<void> {
|
||||
await this.navigate(this.url);
|
||||
await this.waitForLoadState('networkidle');
|
||||
@@ -90,8 +115,11 @@ export class ContactPage extends BasePage {
|
||||
}
|
||||
|
||||
async fillAndSubmitForm(data: ContactFormData): Promise<void> {
|
||||
console.log('Filling form with data:', data);
|
||||
await this.fillContactForm(data);
|
||||
console.log('Form filled, clicking submit button');
|
||||
await this.submitForm();
|
||||
console.log('Submit button clicked');
|
||||
}
|
||||
|
||||
async isSuccessMessageVisible(): Promise<boolean> {
|
||||
@@ -224,10 +252,13 @@ export class ContactPage extends BasePage {
|
||||
async waitForFormSubmission(): Promise<void> {
|
||||
await this.page.waitForTimeout(3000);
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
await this.page.waitForTimeout(2000);
|
||||
}
|
||||
|
||||
async isFormSubmitted(): Promise<boolean> {
|
||||
return await this.isSuccessMessageVisible();
|
||||
const isSuccessVisible = await this.isSuccessMessageVisible();
|
||||
console.log('Success message visible:', isSuccessVisible);
|
||||
return isSuccessVisible;
|
||||
}
|
||||
|
||||
async getFormValidationErrors(): Promise<string[]> {
|
||||
|
||||
Reference in New Issue
Block a user