diff --git a/.github/workflows/ui-e2e-tests.yml b/.github/workflows/ui-e2e-tests.yml index dea6f1f3e2..81f191765c 100644 --- a/.github/workflows/ui-e2e-tests.yml +++ b/.github/workflows/ui-e2e-tests.yml @@ -18,6 +18,7 @@ jobs: AUTH_TRUST_HOST: true NEXTAUTH_URL: 'http://localhost:3000' NEXT_PUBLIC_API_BASE_URL: 'http://localhost:8080/api/v1' + E2E_NEW_PASSWORD: ${{ secrets.E2E_NEW_PASSWORD }} steps: - name: Checkout repository uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 diff --git a/ui/tests/sign-up/sign-up.md b/ui/tests/sign-up/sign-up.md index 4b0d8b38de..1ebff2a7d9 100644 --- a/ui/tests/sign-up/sign-up.md +++ b/ui/tests/sign-up/sign-up.md @@ -18,6 +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. ### Flow Steps: 1. Navigate to the Sign up page. @@ -37,5 +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. diff --git a/ui/tests/sign-up/sign-up.spec.ts b/ui/tests/sign-up/sign-up.spec.ts index e0f8f4e462..19d831705c 100644 --- a/ui/tests/sign-up/sign-up.spec.ts +++ b/ui/tests/sign-up/sign-up.spec.ts @@ -4,38 +4,46 @@ import { SignInPage } from "../sign-in/sign-in-page"; import { makeSuffix } from "../helpers"; test.describe("Sign Up Flow", () => { - test("should register a new user successfully", { tag: ['@critical', '@e2e', '@signup', '@SIGNUP-E2E-001'] }, async ({ page }) => { - const signUpPage = new SignUpPage(page); - await signUpPage.goto(); + test( + "should register a new user successfully", + { tag: ["@critical", "@e2e", "@signup", "@SIGNUP-E2E-001"] }, + async ({ page }) => { + const password = process.env.E2E_NEW_PASSWORD; - // Generate unique test data - const suffix = makeSuffix(10); - const uniqueEmail = `e2e+${suffix}@prowler.com`; + if (!password) { + throw new Error("E2E_NEW_PASSWORD environment variable is not set"); + } - // Fill and submit the sign-up form - await signUpPage.signup({ - name: `E2E User ${suffix}`, - company: `Test E2E Co ${suffix}`, - email: uniqueEmail, - password: "Thisisapassword123@", - confirmPassword: "Thisisapassword123@", - acceptTerms: true, - }); - - // Verify no errors occurred during sign-up - await signUpPage.verifyNoErrors(); - - // Verify redirect to login page (OSS environment) - await signUpPage.verifyRedirectToLogin(); - - // Verify the newly created user can log in successfully - const signInPage = new SignInPage(page); - await signInPage.login({ - email: uniqueEmail, - password: "Thisisapassword123@", - }); - await signInPage.verifySuccessfulLogin(); - }); + const signUpPage = new SignUpPage(page); + await signUpPage.goto(); + + // Generate unique test data + const suffix = makeSuffix(10); + const uniqueEmail = `e2e+${suffix}@prowler.com`; + + // Fill and submit the sign-up form + await signUpPage.signup({ + name: `E2E User ${suffix}`, + company: `Test E2E Co ${suffix}`, + email: uniqueEmail, + password: password, + confirmPassword: password, + acceptTerms: true, + }); + + // Verify no errors occurred during sign-up + await signUpPage.verifyNoErrors(); + + // Verify redirect to login page (OSS environment) + await signUpPage.verifyRedirectToLogin(); + + // Verify the newly created user can log in successfully + const signInPage = new SignInPage(page); + await signInPage.login({ + email: uniqueEmail, + password: password, + }); + await signInPage.verifySuccessfulLogin(); + }, + ); }); - -