From 62485531e52af166c4cc7734342cfde80391d206 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Fri, 18 Oct 2024 11:16:44 -0700 Subject: [PATCH] test: Navigate to page 2 --- src/lib/components/PostList.svelte | 4 ++++ tests/post.spec.ts | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/lib/components/PostList.svelte b/src/lib/components/PostList.svelte index d2de152..35d4b91 100644 --- a/src/lib/components/PostList.svelte +++ b/src/lib/components/PostList.svelte @@ -26,10 +26,12 @@
diff --git a/tests/post.spec.ts b/tests/post.spec.ts index bcd1052..fde2be8 100644 --- a/tests/post.spec.ts +++ b/tests/post.spec.ts @@ -5,3 +5,15 @@ test('Navigate to blog post', async ({ page }) => { await page.getByText('The Perfect Math Class').click(); await expect(page).toHaveURL("/post/the-perfect-math-class/"); }); + +test('Navigate to page 2', async ({ page }) => { + await page.goto('/post'); + await page.getByRole('link', { name: 'Next Page' }).click(); + await expect(page).toHaveURL("/page/2/"); + await page.getByRole('link', { name: 'Prev Page' }).click(); + await expect(page).toHaveURL("/post/"); + await page.getByRole('link', { name: 'Last Page' }).click(); + await expect(page).toHaveURL("/page/2/"); + await page.getByRole('link', { name: 'First Page' }).click(); + await expect(page).toHaveURL("/post/"); +});