Skip to content

Commit

Permalink
test(openchallenges): add e2e tests to test paginator resetting (#2589)
Browse files Browse the repository at this point in the history
  • Loading branch information
rrchai authored Mar 27, 2024
1 parent 0fe675b commit 5e08d9f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.pnpm-store/
.scannerwork/
playwright-report/
test-results/

# See http://help.github.com/ignore-files/ for more about ignoring files.
.coveralls.yml
Expand Down
17 changes: 13 additions & 4 deletions apps/openchallenges/app/e2e/challenge-search-paginator.spec.ts
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();
});
8 changes: 4 additions & 4 deletions apps/openchallenges/app/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ export default defineConfig({
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] },
},
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
/* Test against branded browsers. */
// When Google Chrome and/or Microsoft Edge are installed in the dev container, Playwright will
// use one of them to open the HTML report. These browsers are slow to open and respond because
Expand Down

0 comments on commit 5e08d9f

Please sign in to comment.