mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-21 19:04:19 +00:00
- 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.
16 lines
843 B
TypeScript
16 lines
843 B
TypeScript
import { test as authInviteAndManageUsersSetup } from '@playwright/test';
|
|
import { authenticateAndSaveState } from '@/tests/helpers';
|
|
|
|
const inviteAndManageUsersUserFile = 'playwright/.auth/invite_and_manage_users_user.json';
|
|
|
|
authInviteAndManageUsersSetup('authenticate as invite and manage users e2e user', async ({ page }) => {
|
|
const inviteAndManageUsersEmail = process.env.E2E_INVITE_AND_MANAGE_USERS_USER;
|
|
const inviteAndManageUsersPassword = process.env.E2E_INVITE_AND_MANAGE_USERS_PASSWORD;
|
|
|
|
if (!inviteAndManageUsersEmail || !inviteAndManageUsersPassword) {
|
|
throw new Error('E2E_INVITE_AND_MANAGE_USERS_USER and E2E_INVITE_AND_MANAGE_USERS_PASSWORD environment variables are required');
|
|
}
|
|
|
|
await authenticateAndSaveState(page, inviteAndManageUsersEmail, inviteAndManageUsersPassword, inviteAndManageUsersUserFile);
|
|
});
|