forked from dedis/d-voting
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some tests for formIndex route and remove HAR files
- Loading branch information
Showing
17 changed files
with
241 additions
and
285 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { expect, test } from '@playwright/test'; | ||
import { default as i18n } from 'i18next'; | ||
import { assertHasFooter, assertHasNavBar, initI18n, setUp } from './shared'; | ||
import { mockEvoting, mockPersonalInfo } from './mocks'; | ||
|
||
initI18n(); | ||
|
||
test.beforeEach(async ({ page }) => { | ||
// mock empty list per default | ||
await mockEvoting(page); | ||
await mockPersonalInfo(page); | ||
await setUp(page, '/form/index'); | ||
}); | ||
|
||
// main elements | ||
|
||
test('Assert navigation bar is present', async ({ page }) => { | ||
await assertHasNavBar(page); | ||
}); | ||
|
||
test('Assert footer is present', async ({ page }) => { | ||
await assertHasFooter(page); | ||
}); | ||
|
||
// pagination bar | ||
|
||
test('Assert pagination bar is present', async ({ page }) => { | ||
await expect(page.getByTestId('navPagination')).toBeVisible(); | ||
await expect(page.getByRole('button', { name: i18n.t('previous') })).toBeVisible(); | ||
await expect(page.getByRole('button', { name: i18n.t('next') })).toBeVisible(); | ||
}); | ||
|
||
test('Assert pagination works correctly for empty list', async ({ page }) => { | ||
await expect(page.getByTestId('navPaginationMessage')).toHaveText( | ||
i18n.t('showingNOverMOfXResults', { n: 1, m: 1, x: 0 }) | ||
); | ||
for (let key of ['next', 'previous']) { | ||
await expect(page.getByRole('button', { name: i18n.t(key) })).toBeDisabled(); | ||
} | ||
}); | ||
|
||
test('Assert pagination works correctly for non-empty list', async ({ page }) => { | ||
// mock non-empty list w/ 11 elements i.e. 2 pages | ||
await mockEvoting(page, false); | ||
await page.reload(); | ||
const next = await page.getByRole('button', { name: i18n.t('next') }); | ||
const previous = await page.getByRole('button', { name: i18n.t('previous') }); | ||
// 1st page | ||
await expect(page.getByTestId('navPaginationMessage')).toHaveText( | ||
i18n.t('showingNOverMOfXResults', { n: 1, m: 2, x: 11 }) | ||
); | ||
await expect(previous).toBeDisabled(); | ||
await expect(next).toBeEnabled(); | ||
await next.click(); | ||
// 2nd page | ||
await expect(page.getByTestId('navPaginationMessage')).toHaveText( | ||
i18n.t('showingNOverMOfXResults', { n: 2, m: 2, x: 11 }) | ||
); | ||
await expect(next).toBeDisabled(); | ||
await expect(previous).toBeEnabled(); | ||
await previous.click(); | ||
// back to 1st page | ||
await expect(page.getByTestId('navPaginationMessage')).toHaveText( | ||
i18n.t('showingNOverMOfXResults', { n: 1, m: 2, x: 11 }) | ||
); | ||
await expect(previous).toBeDisabled(); | ||
await expect(next).toBeEnabled(); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
web/frontend/tests/hars/anonymous/9fd2ff4fc1fb163717539fb04aec420feeb11e5a.html
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.