Files
prowler/ui/tests/setups/manage-scans.auth.setup.ts
T
StylusFrost cf7b66101c test(ui): enhance Playwright test setups for user authentication
- Added multiple authentication setup files for different user roles (admin, manage scans, manage integrations, etc.) to streamline end-to-end testing.
- Introduced a helper function to authenticate users and save their state for reuse in tests.
- Updated Playwright configuration to include new authentication projects.

This change improves the testing framework by allowing for more comprehensive and role-specific user authentication scenarios.
2025-10-09 10:27:37 +02:00

16 lines
644 B
TypeScript

import { test as authManageScansSetup } from '@playwright/test';
import { authenticateAndSaveState } from '@/tests/helpers';
const manageScansUserFile = 'playwright/.auth/manage_scans_user.json';
authManageScansSetup('authenticate as scans e2e user', async ({ page }) => {
const scansEmail = process.env.E2E_MANAGE_SCANS_USER;
const scansPassword = process.env.E2E_MANAGE_SCANS_PASSWORD;
if (!scansEmail || !scansPassword) {
throw new Error('E2E_MANAGE_SCANS_USER and E2E_MANAGE_SCANS_PASSWORD environment variables are required');
}
await authenticateAndSaveState(page, scansEmail, scansPassword, manageScansUserFile);
});