Skip to content

Commit a2d65ec

Browse files
committed
e2e test improvement by waiting for url switch
1 parent 61cd1ba commit a2d65ec

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

e2e/url-navigation.spec.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,12 @@ test.describe('Pagination', () => {
252252
await page.click('.pagination button:has-text("2")');
253253
await expect(page).toHaveURL(new RegExp(`/tag/${uniqueTag}\\?page=2`));
254254

255-
// Click Global Feed
255+
// Click Global Feed and wait for URL to change to root path
256256
await page.click('.nav-link:has-text("Global Feed")');
257-
await page.waitForSelector('.article-preview', { timeout: 10000 });
257+
await expect(page).toHaveURL('/');
258258

259-
// Should be on page 1 (no ?page param)
260-
const url = new URL(page.url());
261-
expect(url.pathname).toBe('/');
262-
expect(url.searchParams.has('page')).toBe(false);
259+
// Verify articles loaded
260+
await page.waitForSelector('.article-preview', { timeout: 10000 });
263261
});
264262

265263
test('tag pagination shows correct articles per page', async ({ page, request }) => {

0 commit comments

Comments
 (0)