Skip to content

Commit 47eb015

Browse files
committed
add e2e tests for footer component
1 parent 68d7d83 commit 47eb015

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

e2e/footer.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test.beforeEach(async ({ page }) => {
4+
page.goto('http://localhost:3000/#footer');
5+
});
6+
7+
test.describe('Test Footer Navigation Links', () => {
8+
test('About us link should navigate to about us section', async ({
9+
page,
10+
}) => {
11+
await page.getByRole('link', { name: 'About us' }).click();
12+
await expect(page).toHaveURL('/#about-us');
13+
});
14+
15+
test('Events link should navigate to Events section', async ({ page }) => {
16+
await page.getByRole('link', { name: 'Events' }).click();
17+
await expect(page).toHaveURL('/#events');
18+
});
19+
20+
test('Contact link should navigate to Contact Us section', async ({
21+
page,
22+
}) => {
23+
await page.getByRole('link', { name: 'Contact' }).click();
24+
await expect(page).toHaveURL('/#contact-us');
25+
});
26+
});

src/components/Footer/Footer.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ export default function Footer() {
2020
}, []);
2121

2222
return (
23-
<footer className="bg-[#CEEDF4] w-full md:pt-12 md:pb-[25px] py-4">
23+
<footer
24+
id="footer"
25+
className="bg-[#CEEDF4] w-full md:pt-12 md:pb-[25px] py-4"
26+
>
2427
<div className="lg:w-1/4 md:w-[35%] sm:w-[40%] w-[65%] mx-auto flex flex-col justify-center items-center">
2528
{screenWidth && (
2629
<div>

0 commit comments

Comments
 (0)