This repository has been archived by the owner on Jul 1, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: protected pages tests * fix: admin tests
- Loading branch information
1 parent
66b4d52
commit 7422eee
Showing
14 changed files
with
206 additions
and
37 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
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,62 @@ | ||
import { test, expect } from "@playwright/test"; | ||
import AxeBuilder from "@axe-core/playwright"; | ||
import { login, logout } from "../setup/auth"; | ||
|
||
test("Guest user cannot access admin statistics", async ({ browser }) => { | ||
// fixture: make sure user is not logged in | ||
const context = await logout(browser); | ||
const page = await context.newPage(); | ||
await page.goto("/admin"); | ||
await expect(page).toHaveURL(/auth\/signin/); | ||
}); | ||
|
||
test("Logged in user cannot access admin statistics", async ({ browser }) => { | ||
// fixture: make sure user is not logged in | ||
const context = await login(browser); | ||
const page = await context.newPage(); | ||
await page.goto("/admin"); | ||
await expect(page).toHaveURL(/404/); | ||
}); | ||
|
||
test("Admin user can access dashboard", async ({ browser }) => { | ||
// fixture: make sure user is logged in | ||
const context = await login(browser, { | ||
id: "66666666", | ||
name: "Automated Test Admin User", | ||
email: "test-admin-user@test.com", | ||
username: "_test-admin-user", | ||
}); | ||
const page = await context.newPage(); | ||
await page.goto("/admin"); | ||
await expect(page).toHaveURL(/admin/); | ||
}); | ||
|
||
test.describe("accessibility tests (light)", () => { | ||
test.use({ colorScheme: "light" }); | ||
|
||
test("should pass axe wcag accessibility tests", async ({ browser }) => { | ||
const context = await login(browser); | ||
const page = await context.newPage(); | ||
await page.goto("/admin"); | ||
const accessibilityScanResults = await new AxeBuilder({ page }) | ||
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"]) | ||
.analyze(); | ||
expect(accessibilityScanResults.violations).toEqual([]); | ||
}); | ||
}); | ||
|
||
test.describe("accessibility tests (dark)", () => { | ||
test.use({ colorScheme: "dark" }); | ||
|
||
test("should pass axe wcag accessibility tests (dark)", async ({ | ||
browser, | ||
}) => { | ||
const context = await login(browser); | ||
const page = await context.newPage(); | ||
await page.goto("/admin"); | ||
const accessibilityScanResults = await new AxeBuilder({ page }) | ||
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"]) | ||
.analyze(); | ||
expect(accessibilityScanResults.violations).toEqual([]); | ||
}); | ||
}); |
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,49 @@ | ||
import { test, expect } from "@playwright/test"; | ||
import AxeBuilder from "@axe-core/playwright"; | ||
import { login, logout } from "../setup/auth"; | ||
|
||
test("Guest user cannot access statistics", async ({ browser }) => { | ||
// fixture: make sure user is not logged in | ||
const context = await logout(browser); | ||
const page = await context.newPage(); | ||
await page.goto("/account/statistics"); | ||
await expect(page).toHaveURL(/auth\/signin/); | ||
}); | ||
|
||
test("Logged in user can access statistics", async ({ browser }) => { | ||
// fixture: make sure user is logged in | ||
const context = await login(browser); | ||
const page = await context.newPage(); | ||
await page.goto("/account/statistics"); | ||
await expect(page).toHaveURL(/account\/statistics/); | ||
}); | ||
|
||
test.describe("accessibility tests (light)", () => { | ||
test.use({ colorScheme: "light" }); | ||
|
||
test("should pass axe wcag accessibility tests", async ({ browser }) => { | ||
const context = await login(browser); | ||
const page = await context.newPage(); | ||
await page.goto("/account/manage/events"); | ||
const accessibilityScanResults = await new AxeBuilder({ page }) | ||
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"]) | ||
.analyze(); | ||
expect(accessibilityScanResults.violations).toEqual([]); | ||
}); | ||
}); | ||
|
||
test.describe("accessibility tests (dark)", () => { | ||
test.use({ colorScheme: "dark" }); | ||
|
||
test("should pass axe wcag accessibility tests (dark)", async ({ | ||
browser, | ||
}) => { | ||
const context = await login(browser); | ||
const page = await context.newPage(); | ||
await page.goto("/account/manage/events"); | ||
const accessibilityScanResults = await new AxeBuilder({ page }) | ||
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"]) | ||
.analyze(); | ||
expect(accessibilityScanResults.violations).toEqual([]); | ||
}); | ||
}); |
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
Oops, something went wrong.