Skip to content

Commit 85caacd

Browse files
committed
update page locators format
1 parent c3bf2d8 commit 85caacd

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

e2e/hero-header.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ test.describe('Test Hero Header Navigation Links', () => {
88
test('About us link should navigate to about us section', async ({
99
page,
1010
}) => {
11-
await page.locator('li:has-text("About us")').click();
11+
await page.getByRole('link', { name: 'About us' }).click();
1212
await expect(page).toHaveURL('/#about-us');
1313
});
1414

1515
test('Events link should navigate to Events section', async ({ page }) => {
16-
await page.locator('li:has-text("Events")').click();
16+
await page.getByRole('link', { name: 'Events' }).click();
1717
await expect(page).toHaveURL('/#events');
1818
});
1919

2020
test('Contact link should navigate to Contact Us section', async ({
2121
page,
2222
}) => {
23-
await page.locator('li:has-text("Contact")').click();
23+
await page.getByRole('link', { name: 'Contact' }).click();
2424
await expect(page).toHaveURL('/#contact-us');
2525
});
2626

@@ -31,7 +31,7 @@ test.describe('Test Hero Header Navigation Links', () => {
3131
const [newPage] = await Promise.all([
3232
context.waitForEvent('page'),
3333
page.waitForLoadState(),
34-
page.locator('text=Join Community').click(),
34+
page.getByRole('link', { name: 'Join Community' }).click(),
3535
]);
3636
await expect(newPage).toHaveURL(
3737
new RegExp(
@@ -47,7 +47,7 @@ test.describe('Test Hero Header Navigation Links', () => {
4747
const [newPage] = await Promise.all([
4848
context.waitForEvent('page'),
4949
page.waitForLoadState(),
50-
page.locator('text=Join ReactDevsKe').click(),
50+
page.getByRole('link', { name: 'Join ReactDevsKe' }).click(),
5151
]);
5252
await expect(newPage).toHaveURL(
5353
new RegExp(

0 commit comments

Comments
 (0)