diff --git a/e2e/src/pages/HomePage.ts b/e2e/src/pages/HomePage.ts index 4236bfb..59ee135 100644 --- a/e2e/src/pages/HomePage.ts +++ b/e2e/src/pages/HomePage.ts @@ -36,7 +36,7 @@ export class HomePage extends BasePage { this.aboutSection = page.locator('#about'); this.newsSection = page.locator('#news'); this.contactSection = page.locator('#contact'); - this.footer = page.locator('footer'); + this.footer = page.locator('[data-testid="footer"]'); } async getNavigationItemCount(): Promise { @@ -147,6 +147,12 @@ export class HomePage extends BasePage { return await this.footer.textContent() || ''; } + async waitForFooter(): Promise { + await this.scrollToBottom(); + await this.page.waitForLoadState('networkidle'); + await this.footer.waitFor({ state: 'visible', timeout: 10000 }); + } + async waitForHeroSection(): Promise { await this.heroSection.waitFor({ state: 'visible', timeout: 10000 }); } diff --git a/e2e/src/tests/smoke/home-page.smoke.spec.ts b/e2e/src/tests/smoke/home-page.smoke.spec.ts index ccb51b5..09c0e06 100644 --- a/e2e/src/tests/smoke/home-page.smoke.spec.ts +++ b/e2e/src/tests/smoke/home-page.smoke.spec.ts @@ -70,7 +70,7 @@ test.describe('首页冒烟测试 @smoke', () => { }); test('应该显示页脚', async ({ homePage }) => { - await homePage.scrollToBottom(); + await homePage.waitForFooter(); await expect(homePage.footer).toBeVisible(); const footerText = await homePage.getFooterText(); expect(footerText.length).toBeGreaterThan(0); diff --git a/src/components/layout/footer.tsx b/src/components/layout/footer.tsx index c4c603a..78a9d93 100644 --- a/src/components/layout/footer.tsx +++ b/src/components/layout/footer.tsx @@ -5,7 +5,7 @@ import { COMPANY_INFO, NAVIGATION } from '@/lib/constants'; export function Footer() { return ( -