Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(openchallenges): add e2e tests to test paginator resetting #2589

Merged
merged 5 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading