fix(test-ui): update authentication method selection in ProvidersPage for AWS Add Provider e2e test (#9161)

This commit is contained in:
StylusFrost
2025-11-11 15:11:56 +01:00
committed by GitHub
parent beec37b0da
commit 203b46196b
3 changed files with 27 additions and 1 deletions

View File

@@ -13,7 +13,9 @@ export default defineConfig({
},
use: {
baseURL: "http://localhost:3000",
baseURL: process.env.AUTH_URL
? process.env.AUTH_URL
: "http://localhost:3000",
trace: "off",
screenshot: "off",
video: "off",

View File

@@ -689,4 +689,23 @@ export class ProvidersPage extends BasePage {
await this.goto();
await expect(this.providersTable).toBeVisible({ timeout: 10000 });
}
async selectAuthenticationMethod(method: AWSCredentialType): Promise<void> {
// Select the authentication method
// Search botton that contains text AWS SDK Default or Prowler Cloud will assume or Access & Secret Key
const button = this.page.locator('button').filter({ hasText: /AWS SDK Default|Prowler Cloud will assume|Access & Secret Key/i });
await button.click();
if (method === AWS_CREDENTIAL_OPTIONS.AWS_ROLE_ARN) {
const modal = this.page.locator('[role="dialog"], .modal, [data-testid*="modal"]').first();
await expect(modal).toBeVisible({ timeout: 10000 });
// Select the role credentials
this.page.getByRole('option', { name: 'Access & Secret Key' }).click({ force: true });
} else {
throw new Error(`Invalid authentication method: ${method}`);
}
}
}

View File

@@ -164,6 +164,11 @@ test.describe("Add Provider", () => {
);
await providersPage.verifyCredentialsPageLoaded();
// Select Authentication Method
await providersPage.selectAuthenticationMethod(
AWS_CREDENTIAL_OPTIONS.AWS_ROLE_ARN,
);
// Fill role credentials
await providersPage.fillRoleCredentials(roleCredentials);
await providersPage.clickNext();