fix: improve footer visibility with data-testid and waitForFooter method
This commit is contained in:
@@ -36,7 +36,7 @@ export class HomePage extends BasePage {
|
|||||||
this.aboutSection = page.locator('#about');
|
this.aboutSection = page.locator('#about');
|
||||||
this.newsSection = page.locator('#news');
|
this.newsSection = page.locator('#news');
|
||||||
this.contactSection = page.locator('#contact');
|
this.contactSection = page.locator('#contact');
|
||||||
this.footer = page.locator('footer');
|
this.footer = page.locator('[data-testid="footer"]');
|
||||||
}
|
}
|
||||||
|
|
||||||
async getNavigationItemCount(): Promise<number> {
|
async getNavigationItemCount(): Promise<number> {
|
||||||
@@ -147,6 +147,12 @@ export class HomePage extends BasePage {
|
|||||||
return await this.footer.textContent() || '';
|
return await this.footer.textContent() || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async waitForFooter(): Promise<void> {
|
||||||
|
await this.scrollToBottom();
|
||||||
|
await this.page.waitForLoadState('networkidle');
|
||||||
|
await this.footer.waitFor({ state: 'visible', timeout: 10000 });
|
||||||
|
}
|
||||||
|
|
||||||
async waitForHeroSection(): Promise<void> {
|
async waitForHeroSection(): Promise<void> {
|
||||||
await this.heroSection.waitFor({ state: 'visible', timeout: 10000 });
|
await this.heroSection.waitFor({ state: 'visible', timeout: 10000 });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ test.describe('首页冒烟测试 @smoke', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('应该显示页脚', async ({ homePage }) => {
|
test('应该显示页脚', async ({ homePage }) => {
|
||||||
await homePage.scrollToBottom();
|
await homePage.waitForFooter();
|
||||||
await expect(homePage.footer).toBeVisible();
|
await expect(homePage.footer).toBeVisible();
|
||||||
const footerText = await homePage.getFooterText();
|
const footerText = await homePage.getFooterText();
|
||||||
expect(footerText.length).toBeGreaterThan(0);
|
expect(footerText.length).toBeGreaterThan(0);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { COMPANY_INFO, NAVIGATION } from '@/lib/constants';
|
|||||||
|
|
||||||
export function Footer() {
|
export function Footer() {
|
||||||
return (
|
return (
|
||||||
<footer className="bg-[#F5F5F5] border-t border-[#E5E5E5] py-12">
|
<footer className="bg-[#F5F5F5] border-t border-[#E5E5E5] py-12" data-testid="footer" role="contentinfo">
|
||||||
<div className="container-wide">
|
<div className="container-wide">
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-12">
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-12">
|
||||||
<div className="lg:col-span-1">
|
<div className="lg:col-span-1">
|
||||||
|
|||||||
Reference in New Issue
Block a user