Skip to content

Commit 3c4bb9f

Browse files
authored
Merge pull request #105 from devKiratu/feature/hero-header-section
2 parents 750bbb9 + 3191796 commit 3c4bb9f

21 files changed

Lines changed: 538 additions & 268 deletions

e2e/hero-header.spec.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test.beforeEach(async ({ page }) => {
4+
page.goto('http://localhost:3000');
5+
});
6+
7+
test.describe('Test Hero Header 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+
27+
test('Join Community link should open google form in new tab', async ({
28+
page,
29+
context,
30+
}) => {
31+
const [newPage] = await Promise.all([
32+
context.waitForEvent('page'),
33+
page.waitForLoadState(),
34+
page.getByRole('link', { name: 'Join Community' }).click(),
35+
]);
36+
await expect(newPage).toHaveURL(
37+
new RegExp(
38+
'^https://docs.google.com/forms/d/e/1FAIpQLSc_k5sffFTeL9oDug41nXU4Spw5cV84ExaL3jNFu_I1FTZO1w/viewform'
39+
)
40+
);
41+
});
42+
43+
test('Join ReactDevsKe link should open google form in new tab', async ({
44+
page,
45+
context,
46+
}) => {
47+
const [newPage] = await Promise.all([
48+
context.waitForEvent('page'),
49+
page.waitForLoadState(),
50+
page.getByRole('link', { name: 'Join ReactDevsKe' }).click(),
51+
]);
52+
await expect(newPage).toHaveURL(
53+
new RegExp(
54+
'^https://docs.google.com/forms/d/e/1FAIpQLSc_k5sffFTeL9oDug41nXU4Spw5cV84ExaL3jNFu_I1FTZO1w/viewform'
55+
)
56+
);
57+
});
58+
});

0 commit comments

Comments
 (0)