Compare commits

...

68 Commits

Author SHA1 Message Date
StylusFrost
4a100e9ce1 test(ui): remove unnecessary blank lines in test files 2025-11-21 17:55:03 +01:00
StylusFrost
385133b63a fix(auth): update logout behavior to redirect to sign-in page;
refactor tests to remove unnecessary page load waits
2025-11-21 11:21:33 +01:00
StylusFrost
054f85d7ba Merge branch 'master' into PROWLER-182-kubernetes-add-and-connect-the-provider 2025-11-19 14:07:57 +01:00
StylusFrost
693a2e9694 Merge branch 'master' into PROWLER-182-kubernetes-add-and-connect-the-provider 2025-11-07 13:01:18 +01:00
StylusFrost
34c84d1c02 Merge branch 'PROWLER-184-m365-add-and-connect-the-provider' into PROWLER-182-kubernetes-add-and-connect-the-provider 2025-11-03 12:31:45 +01:00
StylusFrost
0917817028 Merge branch 'master' into PROWLER-184-m365-add-and-connect-the-provider 2025-11-03 12:28:22 +01:00
StylusFrost
271c7c4e01 test(ui): improve formatting and readability in ProvidersPage tests 2025-10-29 15:34:18 +01:00
StylusFrost
f02fc07ed3 Merge branch 'PROWLER-184-m365-add-and-connect-the-provider' into PROWLER-182-kubernetes-add-and-connect-the-provider 2025-10-28 12:42:47 +01:00
StylusFrost
d762a3433a Merge branch 'PROWLER-180-azure-add-and-connect-the-provider-new' into PROWLER-184-m365-add-and-connect-the-provider 2025-10-28 12:41:40 +01:00
StylusFrost
cd8b4dd2da fix(tests): fix merge errors 2025-10-28 12:40:17 +01:00
StylusFrost
3665435aa4 Merge branch 'PROWLER-184-m365-add-and-connect-the-provider' into PROWLER-182-kubernetes-add-and-connect-the-provider 2025-10-28 12:18:24 +01:00
StylusFrost
853f926fa1 Merge branch 'PROWLER-180-azure-add-and-connect-the-provider-new' into PROWLER-184-m365-add-and-connect-the-provider 2025-10-28 12:17:20 +01:00
StylusFrost
834cef28a1 Merge branch 'master' into PROWLER-180-azure-add-and-connect-the-provider-new 2025-10-28 12:16:03 +01:00
StylusFrost
477de791a9 test(ui): update environment variable name for user password in sign-up tests
- Changed the environment variable name from 'E2E_NEW_PASSWORD' to 'E2E_NEW_USER_PASSWORD' in the UI E2E tests workflow and related documentation.
- This update ensures consistency across the test setup and improves clarity in the sign-up flow tests.
2025-10-24 13:15:18 +02:00
StylusFrost
53607597b6 test(ci): remove push trigger from UI E2E tests workflow
- Eliminated the push trigger for the UI E2E tests workflow to streamline the process and focus on pull request events.
- This change enhances the workflow by ensuring tests are only run during pull requests, reducing unnecessary executions.
2025-10-24 12:08:40 +02:00
StylusFrost
4250d4ee07 test(ci): correct kubeconfig cluster name in UI E2E tests workflow
- Updated the kubeconfig cluster name from 'kind' to 'kind-kind' in the UI E2E tests workflow for improved accuracy and consistency.
- This change ensures proper configuration when interacting with the Kind cluster during end-to-end tests.
2025-10-24 11:14:19 +02:00
StylusFrost
f26083772e test(ci): correct parameter name for Kind cluster in UI E2E tests workflow
- Updated the parameter name for the Kind cluster creation from 'cluster-name' to 'cluster_name' in the UI E2E tests workflow for consistency with Kubernetes naming conventions.
- This change enhances clarity and aligns with best practices in the workflow configuration.
2025-10-24 11:11:06 +02:00
StylusFrost
a2e409d10e test(ci): update cluster name parameter in UI E2E tests workflow
- Changed the parameter name for the Kind cluster creation from 'name' to 'cluster-name' in the UI E2E tests workflow for improved clarity and consistency.
- This update aligns with best practices for Kubernetes configurations and enhances the overall readability of the workflow.
2025-10-24 11:09:59 +02:00
StylusFrost
027ae6cd73 test(ci): update kubeconfig context name in UI E2E tests workflow
- Changed the Kubernetes context name from 'kind-kind' to 'kind' in the UI E2E tests workflow for better clarity and consistency.
- Added a parameter to specify the Kind cluster name during its creation, ensuring proper integration with the Kubernetes setup.
2025-10-24 11:08:49 +02:00
StylusFrost
bc76a8cf25 test(ci): add kubectl config view step in UI E2E tests workflow
- Included a step to view the current kubeconfig in the UI E2E tests workflow, aiding in debugging and verification of the Kubernetes context setup.
- This addition enhances the workflow by providing visibility into the kubeconfig configuration during the test execution.
2025-10-24 11:05:52 +02:00
StylusFrost
e0bedb06d7 test(ci): update UI E2E tests workflow for Kubernetes integration
- Modified the Kubernetes context in the UI E2E tests workflow to use a fixed context 'kind-kind' instead of a secret.
- Added steps to create a Kind cluster and modify the kubeconfig for proper integration with the Kind cluster.
- Updated the docker-compose configuration to include the Kind network, ensuring seamless connectivity with the Kubernetes cluster.
2025-10-24 10:55:17 +02:00
StylusFrost
0b372477be Merge branch 'PROWLER-184-m365-add-and-connect-the-provider' into PROWLER-182-kubernetes-add-and-connect-the-provider 2025-10-23 15:12:00 +02:00
StylusFrost
670d9a8f87 test(ui): refactor ProvidersPage and enhance M365 provider tests
- Refactored the ProvidersPage class to improve the structure and clarity of provider data and credential handling for AWS, AZURE, and M365 providers.
- Introduced new methods for filling provider details and credentials, ensuring better organization and maintainability of the test code.
- Updated M365 provider tests to utilize the new structure, including verification of credential pages and improved error handling during provider management.
- Enhanced the test setup to ensure a clean state by deleting existing providers before each test.
2025-10-23 15:10:13 +02:00
StylusFrost
f6f25d1191 Merge branch 'PROWLER-180-azure-add-and-connect-the-provider-new' into PROWLER-184-m365-add-and-connect-the-provider 2025-10-23 15:01:44 +02:00
StylusFrost
bd1aac2527 test(ui): rename Azure provider input locators for clarity
- Updated Azure provider input locators in the ProvidersPage class to include the 'azure' prefix, enhancing clarity and consistency.
- Adjusted the corresponding fill methods to reference the new locator names, ensuring proper functionality in the tests.
2025-10-23 15:00:45 +02:00
StylusFrost
cb1284e6e7 Merge branch 'PROWLER-179-aws-add-an-connect-the-provider' into PROWLER-180-azure-add-and-connect-the-provider-new 2025-10-23 14:56:43 +02:00
StylusFrost
74580291a7 test(ui): refactor provider deletion logic and improve error handling
- Updated the ProvidersPage class to include a new method for deleting a provider if it exists, enhancing the test setup by ensuring a clean state.
- Improved error handling during the test connection process to provide clearer feedback on failures.
- Refactored existing tests to utilize the new deletion method, streamlining the test code and improving maintainability.
2025-10-23 14:52:24 +02:00
StylusFrost
83540472e4 test(ci): correct kubeconfig environment variable usage in UI E2E tests
- Changed the kubeconfig file creation step in the UI E2E tests workflow to use the environment variable directly instead of accessing it through secrets.
- This adjustment ensures proper handling of the kubeconfig setup for Kubernetes provider tests.
2025-10-23 13:26:32 +02:00
StylusFrost
1cec011d8d test(ci): create kubeconfig directory for UI E2E tests
- Added a step to create the kubeconfig directory in the UI E2E tests workflow to ensure proper setup for Kubernetes provider tests.
- This change enhances the configuration process by preventing potential errors related to missing directories.
2025-10-23 13:06:39 +02:00
StylusFrost
5af7c950ac test(ci): update UI E2E tests configuration and improve Kubernetes context setup
- Updated the Kubernetes context and kubeconfig path in the E2E tests workflow to use secrets for better security.
- Added a step to create the kubeconfig file from the secret, ensuring proper configuration for Kubernetes provider tests.
- Changed the "Add Kubernetes Provider" test to run serially for improved execution flow.
2025-10-23 13:03:53 +02:00
StylusFrost
642efecd37 test(ui): refactoring tests
Correct serial execution
Best process for deleting a provider
New scans page to manage properly when creating a provider
2025-10-22 20:51:35 +02:00
StylusFrost
ccd8908128 Merge branch 'PROWLER-184-m365-add-and-connect-the-provider' into PROWLER-182-kubernetes-add-and-connect-the-provider 2025-10-21 12:34:31 +02:00
StylusFrost
c0a82910ad test(ui): add M365 provider data and credentials to provider tests
- Introduced M365ProviderData, M365ProviderCredential, and M365_CREDENTIAL_OPTIONS to enhance the provider tests.
- This addition supports the integration of M365 provider functionalities in the UI tests.
2025-10-21 12:33:41 +02:00
StylusFrost
a004a73891 Merge branch 'PROWLER-180-azure-add-and-connect-the-provider-new' into PROWLER-184-m365-add-and-connect-the-provider 2025-10-21 12:31:29 +02:00
StylusFrost
fccd2c3b9c test(ui): enhance AWS and Azure provider tests with role-based credentials
- Added tests for adding AWS providers with both static and role-based credentials, ensuring environment variables are validated.
- Refactored Azure provider tests to include role-based credential handling and improved setup for test state management.
- Updated test descriptions and tags for better clarity and organization.
2025-10-21 12:29:03 +02:00
StylusFrost
e8712359c7 test(ui): refactor ProvidersPage input locators to use role-based queries
- Updated additional input locators in ProvidersPage tests to utilize role-based queries for improved accessibility and consistency across the UI tests.
2025-10-21 12:02:36 +02:00
StylusFrost
1ea859f606 Merge branch 'PROWLER-180-azure-add-and-connect-the-provider-new' into PROWLER-184-m365-add-and-connect-the-provider 2025-10-21 11:58:48 +02:00
StylusFrost
d13182288e test(ui): refactor ProvidersPage input locators to use role-based queries
- Updated input locators in ProvidersPage tests to utilize role-based queries for improved accessibility and consistency across the UI tests.
2025-10-21 11:44:50 +02:00
StylusFrost
85d9411283 Merge branch 'PROWLER-179-aws-add-an-connect-the-provider' into PROWLER-180-azure-add-and-connect-the-provider-new 2025-10-21 11:37:35 +02:00
StylusFrost
a500339138 test(ui): update ProvidersPage locators to use role-based queries
- Refactored input locators in ProvidersPage tests to utilize role-based queries for improved accessibility and consistency across the UI tests.
2025-10-21 11:35:29 +02:00
StylusFrost
4a0f0ba5bb Merge branch 'PROWLER-179-aws-add-an-connect-the-provider' into PROWLER-180-azure-add-and-connect-the-provider-new 2025-10-21 11:28:51 +02:00
StylusFrost
5384d30fd5 Merge branch 'PROWLER-187-create-new-user' into PROWLER-179-aws-add-an-connect-the-provider 2025-10-21 11:19:50 +02:00
StylusFrost
a6121396ca test(ui): remove unnecessary blank line in admin authentication setup test
- Cleaned up the admin authentication setup test by removing an unnecessary blank line for improved readability.
2025-10-21 11:13:52 +02:00
StylusFrost
d17d519a3e test(ui): update locators in tests to use role-based queries
- Refactored locators in BasePage, HomePage, SignInPage, and SignUpPage to utilize role-based queries for improved accessibility and consistency across the UI tests.
2025-10-21 11:12:09 +02:00
StylusFrost
71f5ac5165 test(ui): add Kubernetes provider management E2E tests
- Introduced support for adding Kubernetes providers with kubeconfig content in the UI.
- Updated the ProvidersPage interface to include fields and methods for Kubernetes provider details and credentials.
- Enhanced E2E tests to validate the complete flow of adding a new Kubernetes provider, ensuring proper handling of context and kubeconfig content.
- Included necessary environment variable checks for Kubernetes context and kubeconfig path to maintain test integrity.
2025-10-21 10:56:37 +02:00
StylusFrost
f15fdfc642 test(test): update button selector in ProvidersPage tests
- Changed the selector for the "Add Cloud Provider" button from text-based to role-based for improved reliability and maintainability.
2025-10-21 09:31:11 +02:00
StylusFrost
94d5322f16 test(ui): update locators in tests to use role-based queries
- Replaced text-based locators with role-based queries in various test files for improved accessibility and consistency.
- Removed deprecated HomePage and SignInPage files to streamline the test structure.
2025-10-20 18:11:29 +02:00
StylusFrost
4920f84d75 test(ui): update sign-up tests to use E2E_NEW_PASSWORD environment variable
- Modified the sign-up test to retrieve the password from the E2E_NEW_PASSWORD environment variable.
- Updated documentation to specify the requirement for the E2E_NEW_PASSWORD variable before running tests.
2025-10-20 17:35:54 +02:00
StylusFrost
7b321c8cd1 test(ui): enhance M365 provider management E2E tests
- Added support for certificate-based authentication in M365 provider management.
- Updated the ProvidersPage interface to include fields for certificate credentials.
- Enhanced E2E tests to validate the complete flow of adding a new M365 provider with certificate credentials.
- Included necessary environment variable checks for certificate content and updated test steps accordingly.
2025-10-20 17:00:42 +02:00
StylusFrost
1212356db3 Merge branch 'master' into PROWLER-184-m365-add-and-connect-the-provider 2025-10-20 14:57:57 +02:00
StylusFrost
13436613d6 test(ui): add M365 provider management E2E tests
- Introduced new E2E tests for adding Microsoft 365 providers with static credentials.
- Updated the ProvidersPage interface to include M365-specific fields and methods.
- Enhanced the test suite to validate the complete flow of adding a new M365 provider, ensuring proper handling of credentials and provider details.
- Added necessary environment variable checks and cleanup steps to maintain test integrity.
2025-10-20 14:53:43 +02:00
StylusFrost
b23b083092 Merge branch 'master' into PROWLER-180-azure-add-and-connect-the-provider-new 2025-10-20 14:13:31 +02:00
StylusFrost
d63ae0e40f Merge branch 'master' into PROWLER-179-aws-add-an-connect-the-provider 2025-10-20 14:11:46 +02:00
StylusFrost
5d86aacb2a Merge branch 'master' into PROWLER-187-create-new-user 2025-10-20 13:51:07 +02:00
StylusFrost
0d088eca13 test(ui): add Azure environment variables for E2E tests
- Added necessary Azure environment variables to the UI E2E test workflow.
- This enhancement supports the integration of Azure provider management in the testing suite.
2025-10-20 11:56:16 +02:00
StylusFrost
055964aff3 test(ui): add Azure provider management E2E tests
- Introduced new E2E tests for adding Azure providers with static credentials.
- Updated the ProvidersPage interface to include Azure-specific fields and methods.
- Enhanced the test suite to validate the complete flow of adding a new Azure provider, ensuring proper handling of credentials and provider details.
- Added necessary environment variable checks and cleanup steps to maintain test integrity.
2025-10-20 11:51:21 +02:00
StylusFrost
447d754b49 test(ui): add page load wait to sign-up page tests
- Introduced a call to `waitForPageLoad` in the sign-up page test to ensure the page is fully loaded before proceeding with visibility checks for elements.
2025-10-20 10:36:40 +02:00
StylusFrost
761563472b test(ui): improve provider page load handling in tests
- Added a wait for network idle state in the ProvidersPage test to ensure all network requests are completed before proceeding.
- This enhancement improves the reliability of the test by ensuring the page is fully loaded before assertions are made.
2025-10-20 10:30:51 +02:00
StylusFrost
5e3db29de7 test(ui): update AWS provider credential handling in tests
- Refactored AWS provider credential interfaces to improve type safety and clarity.
- Replaced `ProviderCredentials` with `AWSProviderCredential` and introduced `AWS_CREDENTIAL_OPTIONS` for credential types.
- Updated tests to utilize the new credential structure, ensuring consistency across AWS provider management actions.
2025-10-17 19:35:25 +02:00
StylusFrost
d8ca60a4ab test(ui): add AWS provider management E2E tests
- Introduced new E2E tests for adding AWS providers with both static and role-based credentials.
- Updated Playwright configuration to include a new test suite for providers.
- Enhanced the UI workflow by adding necessary environment variables for E2E testing.
- Created helper functions for provider management actions and validations.
2025-10-17 13:41:40 +02:00
StylusFrost
cef7fcc24b Merge branch 'master' into PROWLER-187-create-new-user 2025-10-14 11:03:23 +02:00
StylusFrost
fcf42937aa test(ui): enhance session management tests with new helper functions
- Updated the `verifyLogoutSuccess` function to use a regex for URL verification.
- Added new helper functions `getSession` and `verifySessionValid` to streamline session validation in tests, ensuring that session data is correctly retrieved and validated.
2025-10-14 10:26:00 +02:00
StylusFrost
2c9d8ad8ea test(ui): simplify sign-up page tests by removing redundant loading state verification
- Removed the `verifyLoadingState` method from the `SignUpPage` class as it was redundant.
- Updated comments in the sign-up test to enhance clarity and focus on key actions.
- Added a call to `verifyNoErrors` to ensure no errors occur during the sign-up process.
2025-10-10 18:21:43 +02:00
StylusFrost
f424342e7e test(ui): add E2E tests document for user sign-up flow
- Documented test case details including flow steps, expected results, and key verification points.
- Enhanced existing sign-up test specifications to include relevant tags for better categorization and tracking.
2025-10-10 11:53:18 +02:00
StylusFrost
9b7e4f59e1 test(ui): implement base page object and enhance sign-up flow tests
- Introduced a BasePage class to encapsulate common functionality for page objects, improving code reusability and maintainability.
- Created new page objects for HomePage, SignInPage, and SignUpPage to streamline the sign-up and login processes in tests.
- Added comprehensive sign-up flow tests to validate user registration and login functionality, ensuring a smooth user experience.
- Updated Playwright configuration to support new test structures and improve overall test organization.
2025-10-09 16:19:27 +02:00
StylusFrost
d21222aa3a test(ui): format Playwright configuration for consistency
- Added missing commas and improved formatting in the Playwright configuration file to enhance readability and maintain consistency across the codebase.
2025-10-09 11:05:09 +02:00
StylusFrost
bdbb2fad78 test(ui): update Playwright test commands to specify project. Compatibility with current e2e test
- Modified Playwright test commands in package.json to explicitly use the 'chromium' project.
2025-10-09 10:54:34 +02:00
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
10 changed files with 265 additions and 51 deletions

View File

@@ -10,6 +10,7 @@ on:
- 'ui/**'
jobs:
e2e-tests:
if: github.repository == 'prowler-cloud/prowler'
runs-on: ubuntu-latest
@@ -33,10 +34,29 @@ jobs:
E2E_M365_SECRET_ID: ${{ secrets.E2E_M365_SECRET_ID }}
E2E_M365_TENANT_ID: ${{ secrets.E2E_M365_TENANT_ID }}
E2E_M365_CERTIFICATE_CONTENT: ${{ secrets.E2E_M365_CERTIFICATE_CONTENT }}
E2E_NEW_PASSWORD: ${{ secrets.E2E_NEW_PASSWORD }}
E2E_KUBERNETES_CONTEXT: 'kind-kind'
E2E_KUBERNETES_KUBECONFIG_PATH: /home/runner/.kube/config
E2E_NEW_USER_PASSWORD: ${{ secrets.E2E_NEW_USER_PASSWORD }}
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1
with:
cluster_name: kind
- name: Modify kubeconfig
run: |
# Modify the kubeconfig to use the kind cluster server to https://kind-control-plane:6443
# from worker service into docker-compose.yml
kubectl config set-cluster kind-kind --server=https://kind-control-plane:6443
kubectl config view
- name: Add network kind to docker compose
run: |
# Add the network kind to the docker compose to interconnect to kind cluster
yq -i '.networks.kind.external = true' docker-compose.yml
# Add network kind to worker service and default network too
yq -i '.services.worker.networks = ["kind","default"]' docker-compose.yml
- name: Fix API data directory permissions
run: docker run --rm -v $(pwd)/_data/api:/data alpine chown -R 1000:1000 /data
- name: Start API services
@@ -113,4 +133,4 @@ jobs:
run: |
echo "Shutting down services..."
docker compose down -v || true
echo "Cleanup completed"
echo "Cleanup completed"

View File

@@ -188,5 +188,5 @@ export const getUserByMe = async (accessToken: string) => {
};
export async function logOut() {
await signOut();
await signOut({ redirectTo: "/sign-in" });
}

View File

@@ -24,21 +24,14 @@ export abstract class BasePage {
// Common navigation methods
async goto(url: string): Promise<void> {
await this.page.goto(url);
await this.waitForPageLoad();
}
async waitForPageLoad(): Promise<void> {
await this.page.waitForLoadState("networkidle");
}
async refresh(): Promise<void> {
await this.page.reload();
await this.waitForPageLoad();
}
async goBack(): Promise<void> {
await this.page.goBack();
await this.waitForPageLoad();
}
// Common verification methods

View File

@@ -23,6 +23,12 @@ export interface M365ProviderData {
alias?: string;
}
// Kubernetes provider data
export interface KubernetesProviderData {
context: string;
alias?: string;
}
// AWS credential options
export const AWS_CREDENTIAL_OPTIONS = {
AWS_ROLE_ARN: "role",
@@ -78,6 +84,20 @@ export interface M365ProviderCredential {
certificateContent?: string;
}
// Kubernetes credential options
export const KUBERNETES_CREDENTIAL_OPTIONS = {
KUBECONFIG_CONTENT: "kubeconfig"
} as const;
// Kubernetes credential type
type KubernetesCredentialType = (typeof KUBERNETES_CREDENTIAL_OPTIONS)[keyof typeof KUBERNETES_CREDENTIAL_OPTIONS];
// Kubernetes provider credential
export interface KubernetesProviderCredential {
type: KubernetesCredentialType;
kubeconfigContent:string;
}
// Providers page
export class ProvidersPage extends BasePage {
// Button to add a new cloud provider
@@ -129,6 +149,10 @@ export class ProvidersPage extends BasePage {
readonly m365TenantIdInput: Locator;
readonly m365CertificateContentInput: Locator;
// Kubernetes provider form elements
readonly kubernetesContextInput: Locator;
readonly kubernetesKubeconfigContentInput: Locator;
// Delete button
readonly deleteProviderConfirmationButton: Locator;
@@ -180,10 +204,12 @@ export class ProvidersPage extends BasePage {
name: "Client Secret",
});
this.m365TenantIdInput = page.getByRole("textbox", { name: "Tenant ID" });
this.m365CertificateContentInput = page.getByRole("textbox", {
name: "Certificate Content",
});
this.m365CertificateContentInput = page.getByRole("textbox", { name: "Certificate Content" });
// Kubernetes provider form inputs
this.kubernetesContextInput = page.getByRole("textbox", { name: "Context" });
this.kubernetesKubeconfigContentInput = page.getByRole("textbox", { name: "Kubeconfig Content" });
// Alias input
this.aliasInput = page.getByRole("textbox", {
name: "Provider alias (optional)",
@@ -249,28 +275,31 @@ export class ProvidersPage extends BasePage {
// Click the add provider button
await this.addProviderButton.click();
await this.waitForPageLoad();
}
async selectAWSProvider(): Promise<void> {
// Prefer label-based click for radios, force if overlay intercepts
await this.awsProviderRadio.click({ force: true });
await this.waitForPageLoad();
}
async selectAZUREProvider(): Promise<void> {
// Prefer label-based click for radios, force if overlay intercepts
await this.azureProviderRadio.click({ force: true });
await this.waitForPageLoad();
}
async selectM365Provider(): Promise<void> {
// Select the M365 provider
await this.m365ProviderRadio.click({ force: true });
await this.waitForPageLoad();
}
async selectKubernetesProvider(): Promise<void> {
// Select the Kubernetes provider
await this.kubernetesProviderRadio.click({ force: true });
}
async fillAWSProviderDetails(data: AWSProviderData): Promise<void> {
// Fill the AWS provider details
@@ -301,6 +330,17 @@ export class ProvidersPage extends BasePage {
}
}
async fillKubernetesProviderDetails(data: KubernetesProviderData): Promise<void> {
// Fill the Kubernetes provider details
await this.kubernetesContextInput.fill(data.context);
if (data.alias) {
await this.aliasInput.fill(data.alias);
}
}
async clickNext(): Promise<void> {
// The wizard interface may use different labels for its primary action button on each step.
// This function determines which button to click depending on the current URL and page content.
@@ -311,7 +351,6 @@ export class ProvidersPage extends BasePage {
// If on the "connect-account" step, click the "Next" button
if (/\/providers\/connect-account/.test(url)) {
await this.nextButton.click();
await this.waitForPageLoad();
return;
}
@@ -319,15 +358,14 @@ export class ProvidersPage extends BasePage {
if (/\/providers\/add-credentials/.test(url)) {
// Some UI implementations use "Save" instead of "Next" for primary action
const saveBtn = this.saveButton;
if (await saveBtn.count()) {
await saveBtn.click();
await this.waitForPageLoad();
return;
}
// If "Save" is not present, try clicking the "Next" button
if (await this.nextButton.count()) {
await this.nextButton.click();
await this.waitForPageLoad();
return;
}
}
@@ -339,7 +377,6 @@ export class ProvidersPage extends BasePage {
.filter({ hasText: "Launch scan" });
await buttonByText.click();
await this.waitForPageLoad();
// Wait for either success (redirect to scans) or error message to appear
// The error container has multiple p.text-text-error elements, we want the first one with the technical error
@@ -368,9 +405,8 @@ export class ProvidersPage extends BasePage {
}
} catch (error) {
// If timeout or other error, check if error message is present
const isErrorVisible = await errorMessage
.isVisible()
.catch(() => false);
const isErrorVisible = await errorMessage.isVisible().catch(() => false);
if (isErrorVisible) {
const errorText = await errorMessage.textContent();
throw new Error(
@@ -401,7 +437,6 @@ export class ProvidersPage extends BasePage {
if (await btn.count()) {
await btn.click();
await this.waitForPageLoad();
return;
}
}
@@ -416,6 +451,7 @@ export class ProvidersPage extends BasePage {
// Ensure we are on the add-credentials page where the selector exists
await expect(this.page).toHaveURL(/\/providers\/add-credentials/);
if (type === AWS_CREDENTIAL_OPTIONS.AWS_ROLE_ARN) {
await this.roleCredentialsRadio.click({ force: true });
} else if (type === AWS_CREDENTIAL_OPTIONS.AWS_CREDENTIALS) {
@@ -423,14 +459,13 @@ export class ProvidersPage extends BasePage {
} else {
throw new Error(`Invalid AWS credential type: ${type}`);
}
// Wait for the page to load
await this.waitForPageLoad();
}
async selectM365CredentialsType(type: M365CredentialType): Promise<void> {
// Ensure we are on the add-credentials page where the selector exists
await expect(this.page).toHaveURL(/\/providers\/add-credentials/);
if (type === M365_CREDENTIAL_OPTIONS.M365_CREDENTIALS) {
await this.m365StaticCredentialsRadio.click({ force: true });
} else if (type === M365_CREDENTIAL_OPTIONS.M365_CERTIFICATE_CREDENTIALS) {
@@ -438,8 +473,6 @@ export class ProvidersPage extends BasePage {
} else {
throw new Error(`Invalid M365 credential type: ${type}`);
}
// Wait for the page to load
await this.waitForPageLoad();
}
async fillRoleCredentials(credentials: AWSProviderCredential): Promise<void> {
@@ -525,12 +558,20 @@ export class ProvidersPage extends BasePage {
}
}
async fillKubernetesCredentials(credentials: KubernetesProviderCredential): Promise<void> {
// Fill the Kubernetes credentials form
if (credentials.kubeconfigContent) {
await this.kubernetesKubeconfigContentInput.fill(credentials.kubeconfigContent);
}
}
async verifyPageLoaded(): Promise<void> {
// Verify the providers page is loaded
await expect(this.page).toHaveTitle(/Prowler/);
await expect(this.addProviderButton).toBeVisible();
await this.page.waitForLoadState("networkidle");
}
async verifyConnectAccountPageLoaded(): Promise<void> {
@@ -565,6 +606,13 @@ export class ProvidersPage extends BasePage {
await expect(this.m365CertificateContentInput).toBeVisible();
}
async verifyKubernetesCredentialsPageLoaded(): Promise<void> {
// Verify the Kubernetes credentials page is loaded
await expect(this.page).toHaveTitle(/Prowler/);
await expect(this.kubernetesContextInput).toBeVisible();
}
async verifyLaunchScanPageLoaded(): Promise<void> {
// Verify the launch scan page is loaded
@@ -575,13 +623,13 @@ export class ProvidersPage extends BasePage {
const launchScanButton = this.page
.locator("button")
.filter({ hasText: "Launch scan" });
await expect(launchScanButton).toBeVisible();
}
async verifyLoadProviderPageAfterNewProvider(): Promise<void> {
// Verify the provider page is loaded
await this.waitForPageLoad();
await expect(this.page).toHaveTitle(/Prowler/);
await expect(this.providersTable).toBeVisible();
}
@@ -598,6 +646,7 @@ export class ProvidersPage extends BasePage {
// Verify the number of matching rows is 1
const count = await matchingRows.count();
if (count !== 1) return false;
return true;
}
@@ -618,9 +667,6 @@ export class ProvidersPage extends BasePage {
await searchInput.fill(providerUID);
await searchInput.press("Enter");
// Wait for the table to finish loading/filtering
await this.waitForPageLoad();
// Additional wait for React table to re-render with the server-filtered data
// The filtering happens on the server, but the table component needs time
// to process the response and update the DOM after network idle
@@ -632,6 +678,7 @@ export class ProvidersPage extends BasePage {
// Helper function to check if a row is the "No results" row
const isNoResultsRow = async (row: Locator): Promise<boolean> => {
const text = await row.textContent();
return text?.includes("No results") || text?.includes("No data") || false;
};
@@ -688,11 +735,8 @@ export class ProvidersPage extends BasePage {
}
// Find and click the action button (last cell = actions column)
const actionButton = targetRow
.locator("td")
.last()
.locator("button")
.first();
const actionButton = targetRow.locator("td").last().locator("button").first();
await expect(actionButton).toBeVisible({ timeout: 5000 });
await actionButton.click();
@@ -700,13 +744,13 @@ export class ProvidersPage extends BasePage {
const deleteMenuItem = this.page.getByRole("menuitem", {
name: /delete.*provider/i,
});
await expect(deleteMenuItem).toBeVisible({ timeout: 5000 });
await deleteMenuItem.click();
// Wait for confirmation modal to appear
const modal = this.page
.locator('[role="dialog"], .modal, [data-testid*="modal"]')
.first();
const modal = this.page.locator('[role="dialog"], .modal, [data-testid*="modal"]').first();
await expect(modal).toBeVisible({ timeout: 10000 });
// Find and click the delete confirmation button
@@ -718,9 +762,6 @@ export class ProvidersPage extends BasePage {
// Wait for modal to close (this indicates deletion was initiated)
await expect(modal).not.toBeVisible({ timeout: 10000 });
// Wait for page to reload
await this.waitForPageLoad();
// Navigate back to providers page to ensure clean state
await this.goto();
await expect(this.providersTable).toBeVisible({ timeout: 10000 });

View File

@@ -265,3 +265,61 @@
- Provider cleanup performed before each test to ensure clean state
- Requires valid Microsoft 365 tenant with certificate-based authentication
- Certificate must be properly configured and have sufficient permissions for security scanning
---
## Test Case: `PROVIDER-E2E-006` - Add Kubernetes Provider with Kubeconfig Content
**Priority:** `critical`
**Tags:**
- type → @e2e, @serial
- feature → @providers
- provider → @kubernetes
**Description/Objective:** Validates the complete flow of adding a new Kubernetes provider using kubeconfig content authentication
**Preconditions:**
- Admin user authentication required (admin.auth.setup setup)
- Environment variables configured: E2E_KUBERNETES_CONTEXT, E2E_KUBERNETES_KUBECONFIG_PATH
- Kubeconfig file must exist at the specified path
- Remove any existing provider with the same Context before starting the test
- This test must be run serially and never in parallel with other tests, as it requires the Context not to be already registered beforehand.
### Flow Steps:
1. Navigate to providers page
2. Click "Add Provider" button
3. Select Kubernetes provider type
4. Fill provider details (context and alias)
5. Verify credentials page is loaded
6. Fill Kubernetes credentials (kubeconfig content)
7. Launch initial scan
8. Verify redirect to provider management page
### Expected Result:
- Kubernetes provider successfully added with kubeconfig content
- Initial scan launched successfully
- User redirected to provider details page
### Key verification points:
- Provider page loads correctly
- Connect account page displays Kubernetes option
- Provider details form accepts context and alias
- Credentials page loads with kubeconfig content field
- Kubeconfig content is properly filled in the correct field
- Launch scan page appears
- Successful redirect to provider page after scan launch
### Notes:
- Test uses environment variables for Kubernetes context and kubeconfig file path
- Kubeconfig content is read from file and used for authentication
- Provider cleanup performed before each test to ensure clean state
- Requires valid Kubernetes cluster with accessible kubeconfig
- Kubeconfig must have sufficient permissions for security scanning
- Test validates that kubeconfig content goes to the correct field (not the context field)

View File

@@ -10,7 +10,11 @@ import {
M365ProviderData,
M365ProviderCredential,
M365_CREDENTIAL_OPTIONS,
KubernetesProviderData,
KubernetesProviderCredential,
KUBERNETES_CREDENTIAL_OPTIONS,
} from "./providers-page";
import fs from "fs";
import { ScansPage } from "../scans/scans-page";
test.describe("Add Provider", () => {
@@ -440,4 +444,104 @@ test.describe("Add Provider", () => {
);
});
test.describe.serial("Add Kubernetes Provider", () => {
// Providers page object
let providersPage: ProvidersPage;
let scansPage: ScansPage;
// Test data from environment variables
const context = process.env.E2E_KUBERNETES_CONTEXT;
const kubeconfigPath = process.env.E2E_KUBERNETES_KUBECONFIG_PATH;
// Validate required environment variables
if (!context || !kubeconfigPath) {
throw new Error(
"E2E_KUBERNETES_CONTEXT and E2E_KUBERNETES_KUBECONFIG_PATH environment variables are not set",
);
}
// Setup before each test
test.beforeEach(async ({ page }) => {
providersPage = new ProvidersPage(page);
// Clean up existing provider to ensure clean test state
await providersPage.deleteProviderIfExists(context);
});
// Use admin authentication for provider management
test.use({ storageState: "playwright/.auth/admin_user.json" });
test(
"should add a new Kubernetes provider with kubeconfig context",
{
tag: [
"@critical",
"@e2e",
"@providers",
"@kubernetes",
"@serial",
"@PROVIDER-E2E-006",
],
},
async ({ page }) => {
// Verify kubeconfig file exists
if (!fs.existsSync(kubeconfigPath)) {
throw new Error(`Kubeconfig file not found at ${kubeconfigPath}`);
}
// Read kubeconfig content from file
let kubeconfigContent: string;
try {
kubeconfigContent = fs.readFileSync(kubeconfigPath, "utf8");
} catch (error) {
throw new Error(
`Failed to read kubeconfig file at ${kubeconfigPath}: ${error}`,
);
}
// Prepare test data for Kubernetes provider
const kubernetesProviderData: KubernetesProviderData = {
context: context,
alias: "Test E2E Kubernetes Account - Kubeconfig Context",
};
// Prepare static credentials
const kubernetesCredentials: KubernetesProviderCredential = {
type: KUBERNETES_CREDENTIAL_OPTIONS.KUBECONFIG_CONTENT,
kubeconfigContent: kubeconfigContent,
};
// Navigate to providers page
await providersPage.goto();
await providersPage.verifyPageLoaded();
// Start adding new provider
await providersPage.clickAddProvider();
await providersPage.verifyConnectAccountPageLoaded();
// Select Kubernetes provider
await providersPage.selectKubernetesProvider();
// Fill provider details
await providersPage.fillKubernetesProviderDetails(
kubernetesProviderData,
);
await providersPage.clickNext();
// Verify credentials page is loaded
await providersPage.verifyKubernetesCredentialsPageLoaded();
// Fill static credentials details
await providersPage.fillKubernetesCredentials(kubernetesCredentials);
await providersPage.clickNext();
// Launch scan
await providersPage.verifyLaunchScanPageLoaded();
await providersPage.clickNext();
// Wait for redirect to provider page
scansPage = new ScansPage(page);
await scansPage.verifyPageLoaded();
},
);
});
});

View File

@@ -23,6 +23,5 @@ export class ScansPage extends BasePage {
async verifyPageLoaded(): Promise<void> {
await expect(this.page).toHaveTitle(/Prowler/);
await expect(this.scanTable).toBeVisible();
await this.waitForPageLoad();
}
}

View File

@@ -50,7 +50,6 @@ export class SignUpPage extends BasePage {
await expect(this.page.getByRole("heading", { name: "Sign up" })).toBeVisible();
await expect(this.emailInput).toBeVisible();
await expect(this.submitButton).toBeVisible();
await this.waitForPageLoad();
}
async fillName(name: string): Promise<void> {

View File

@@ -18,7 +18,7 @@
**Preconditions:**
- Application is running, email domain & password is acceptable for sign-up.
- No existing data in Prowler is required; the test can run on a clean state.
- `E2E_NEW_PASSWORD` environment variable must be set with a valid password for the test.
- `E2E_NEW_USER_PASSWORD` environment variable must be set with a valid password for the test.
### Flow Steps:
1. Navigate to the Sign up page.
@@ -38,6 +38,6 @@
### Notes:
- Test data uses a random base36 suffix to avoid collisions with email.
- The test requires the `E2E_NEW_PASSWORD` environment variable to be set before running.
- The test requires the `E2E_NEW_USER_PASSWORD` environment variable to be set before running.

View File

@@ -8,10 +8,10 @@ test.describe("Sign Up Flow", () => {
"should register a new user successfully",
{ tag: ["@critical", "@e2e", "@signup", "@SIGNUP-E2E-001"] },
async ({ page }) => {
const password = process.env.E2E_NEW_PASSWORD;
const password = process.env.E2E_NEW_USER_PASSWORD;
if (!password) {
throw new Error("E2E_NEW_PASSWORD environment variable is not set");
throw new Error("E2E_NEW_USER_PASSWORD environment variable is not set");
}
const signUpPage = new SignUpPage(page);