Files
pleno-vue/tests/e2e/userProfileVisibility.spec.ts
Jeppe B 1729443cc3 Resolve frontend Qodana critical and high findings (#176)
Resolve recommended-profile Critical and High findings, update vulnerable dependencies, restore invoice queue E2E authentication setup, and clear the remaining frontend Qodana findings.
2026-07-17 06:22:51 +02:00

31 lines
1.3 KiB
TypeScript

import { test, expect } from "@playwright/test";
import { userCredentials as _userCredentials, loginAsUser, loginAsSubuserByPhone } from "./fixtures";
// Navigate to profile page helper
async function goToUserProfile(page) {
await page.goto("/user/profile");
await expect(page).toHaveURL(/\/user\/profile(?:[?#].*)?$/);
}
/** User Profile Tests - Section Visibility */
test("[PROFILE][User][Visibility] should NOT display subuser sections for customer user", async ({ page }) => {
await loginAsUser(page);
await goToUserProfile(page);
// Customer users should see Invoicing section
await expect(page.locator(".card-header").filter({ hasText: "Fakturaoplysninger" })).toBeVisible();
// Grant selector (users icon) should not be visible for customers
await expect(page.locator(".card-header .fa-users")).not.toBeVisible();
});
test("[PROFILE][Subuser][Visibility] should NOT display customer sections for subuser", async ({ page }) => {
await loginAsSubuserByPhone(page);
await goToUserProfile(page);
// Invoicing section should not be visible for subusers
await expect(page.locator(".card-header").filter({ hasText: "Fakturaoplysninger" })).not.toBeVisible();
// Subuser should see driver profile sections
await expect(page.locator(".card-header").filter({ hasText: "Chauffør" }).first()).toBeVisible();
});