-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(openchallenges): add e2e tests to test paginator resetting (#2589)
- Loading branch information
Showing
3 changed files
with
18 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 13 additions & 4 deletions
17
apps/openchallenges/app/e2e/challenge-search-paginator.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('reset page number when query input changes', async ({ page }) => { | ||
test('paginator reset to page 1 on filter change', async ({ page }) => { | ||
// Go to the challenge search page | ||
await page.goto('/challenge'); | ||
|
||
// dummy assertion | ||
await expect(page.locator('h2')).toHaveText('Challenges'); | ||
// Go to the second page | ||
await page.getByRole('button', { name: '2' }).click(); | ||
// Make a change to the challenge query input by selecting 'active' status | ||
await page | ||
.locator('div') | ||
.filter({ hasText: /^Active$/ }) | ||
.locator('div') | ||
.nth(2) | ||
.click(); | ||
// Assert that the paginator page number has been reset to 1 | ||
await expect(page.getByRole('button', { name: '1' })).toBeVisible(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters