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.
test: add navigation bar tests for authenticated/admin users
- Loading branch information
1 parent
260175d
commit 801ca6a
Showing
1 changed file
with
36 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { default as i18n } from 'i18next'; | ||
import { test, expect } from '@playwright/test'; | ||
import { | ||
initI18n, | ||
logIn, | ||
logOut, | ||
assertOnlyVisibleToAuthenticated, | ||
assertOnlyVisibleToAdmin, | ||
} from './shared'; | ||
|
||
initI18n(); | ||
|
||
// authenticated non-admin | ||
|
||
test('Assert "Profile" button is visible upon logging in', async({ page }) => { | ||
await page.goto(process.env.FRONT_END_URL); | ||
await assertOnlyVisibleToAuthenticated( | ||
page, page.getByRole('button', { name: i18n.t('Profile') }) | ||
); | ||
}); | ||
|
||
// admin | ||
|
||
test('Assert "Create form" button is (only) visible to admin', async({ page }) => { | ||
await page.goto(process.env.FRONT_END_URL); | ||
await assertOnlyVisibleToAdmin( | ||
page, page.getByRole('link', { name: i18n.t('navBarCreateForm')}) | ||
); | ||
}); | ||
|
||
test('Assert "Admin" button is (only) visible to admin', async({ page }) => { | ||
await page.goto(process.env.FRONT_END_URL); | ||
await assertOnlyVisibleToAdmin( | ||
page, page.getByRole('link', { name: i18n.t('navBarAdmin') }) | ||
); | ||
}); |