Skip to content

Commit f3d98ae

Browse files
committed
Fixed tests
1 parent b1d4511 commit f3d98ae

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

frontend/tests/user-settings.spec.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,27 @@ test("My profile tab is active by default", async ({ page }) => {
1414
)
1515
})
1616

17-
test("All tabs are visible", async ({ page }) => {
17+
test("Admin does not see the Danger zone tab", async ({ page }) => {
1818
await page.goto("/settings")
19-
for (const tab of tabs) {
20-
await expect(page.getByRole("tab", { name: tab })).toBeVisible()
21-
}
19+
await expect(page.getByRole("tab", { name: "My profile" })).toBeVisible()
20+
await expect(page.getByRole("tab", { name: "Password" })).toBeVisible()
21+
await expect(page.getByRole("tab", { name: "Danger zone" })).not.toBeVisible()
22+
})
23+
24+
test.describe("Non-admin settings tabs", () => {
25+
test.use({ storageState: { cookies: [], origins: [] } })
26+
27+
test("All tabs are visible for a non-admin user", async ({ page }) => {
28+
const email = randomEmail()
29+
const password = randomPassword()
30+
await createUser({ email, password })
31+
32+
await logInUser(page, email, password)
33+
await page.goto("/settings")
34+
for (const tab of tabs) {
35+
await expect(page.getByRole("tab", { name: tab })).toBeVisible()
36+
}
37+
})
2238
})
2339

2440
test.describe("Edit user profile", () => {

0 commit comments

Comments
 (0)