mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-14 23:44:15 +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.
17 lines
805 B
TypeScript
17 lines
805 B
TypeScript
import { test as authManageCloudProvidersSetup } from '@playwright/test';
|
|
import { authenticateAndSaveState } from '@/tests/helpers';
|
|
|
|
const manageCloudProvidersUserFile = 'playwright/.auth/manage_cloud_providers_user.json';
|
|
|
|
authManageCloudProvidersSetup('authenticate as manage cloud providers e2e user', async ({ page }) => {
|
|
const cloudProvidersEmail = process.env.E2E_MANAGE_CLOUD_PROVIDERS_USER;
|
|
const cloudProvidersPassword = process.env.E2E_MANAGE_CLOUD_PROVIDERS_PASSWORD;
|
|
|
|
|
|
if (!cloudProvidersEmail || !cloudProvidersPassword) {
|
|
throw new Error('E2E_MANAGE_CLOUD_PROVIDERS_USER and E2E_MANAGE_CLOUD_PROVIDERS_PASSWORD environment variables are required');
|
|
}
|
|
|
|
await authenticateAndSaveState(page, cloudProvidersEmail, cloudProvidersPassword, manageCloudProvidersUserFile);
|
|
});
|