From 676cc44fe2d7cfe3c0274f8766ce13d43eeb9bbd Mon Sep 17 00:00:00 2001 From: Alejandro Bailo <59607668+alejandrobailo@users.noreply.github.com> Date: Wed, 23 Jul 2025 10:44:28 +0200 Subject: [PATCH] feat: env keys behavior updated (#8348) --- .github/workflows/ui-pull-request.yml | 11 +++++++++-- ui/playwright.config.ts | 2 ++ ui/tests/helpers.ts | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ui-pull-request.yml b/.github/workflows/ui-pull-request.yml index c67014dc73..ad22630e32 100644 --- a/.github/workflows/ui-pull-request.yml +++ b/.github/workflows/ui-pull-request.yml @@ -53,16 +53,20 @@ jobs: AUTH_TRUST_HOST: true NEXTAUTH_URL: http://localhost:3000 PROWLER_API_PORT: 8080 - NEXT_PUBLIC_API_BASE_URL: http://localhost:8080/api/v1 + NEXT_PUBLIC_API_BASE_URL: ${{ secrets.API_BASE_URL || 'http://localhost:8080/api/v1' }} + E2E_USER: ${{ secrets.E2E_USER }} + E2E_PASSWORD: ${{ secrets.E2E_PASSWORD }} steps: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - name: Start needed services with docker compose + if: github.repository == 'prowler-cloud/prowler' run: | docker compose up -d api worker worker-beat - name: Wait for prowler-api to respond + if: github.repository == 'prowler-cloud/prowler' run: | echo "Waiting for prowler-api..." for i in {1..30}; do @@ -74,6 +78,7 @@ jobs: sleep 3 done - name: Run database migrations + if: github.repository == 'prowler-cloud/prowler' run: | echo "Running Django migrations..." docker compose exec -T api sh -c ' @@ -81,9 +86,11 @@ jobs: ' echo "Database migrations completed!" - name: Copy local fixtures into API container + if: github.repository == 'prowler-cloud/prowler' run: | docker cp ./api/src/backend/api/fixtures/dev/. prowler-api-1:/home/prowler/backend/api/fixtures/dev - name: Load database fixtures for e2e tests + if: github.repository == 'prowler-cloud/prowler' run: | docker compose exec -T api sh -c ' echo "Loading all fixtures from api/fixtures/dev/..." @@ -131,7 +138,7 @@ jobs: retention-days: 30 - name: Cleanup services - if: always() + if: github.repository == 'prowler-cloud/prowler' run: | echo "Shutting down services..." docker-compose down -v || true diff --git a/ui/playwright.config.ts b/ui/playwright.config.ts index a31621d537..8fd6bc0dd4 100644 --- a/ui/playwright.config.ts +++ b/ui/playwright.config.ts @@ -34,6 +34,8 @@ export default defineConfig({ AUTH_SECRET: process.env.AUTH_SECRET || "fallback-ci-secret-for-testing", AUTH_TRUST_HOST: process.env.AUTH_TRUST_HOST || "true", NEXTAUTH_URL: process.env.NEXTAUTH_URL || "http://localhost:3000", + E2E_USER: process.env.E2E_USER || "e2e@prowler.com", + E2E_PASSWORD: process.env.E2E_PASSWORD || "Thisisapassword123@", }, }, }); diff --git a/ui/tests/helpers.ts b/ui/tests/helpers.ts index e807c595fd..cb2e8d2857 100644 --- a/ui/tests/helpers.ts +++ b/ui/tests/helpers.ts @@ -13,8 +13,8 @@ export const URLS = { export const TEST_CREDENTIALS = { VALID: { - email: "e2e@prowler.com", - password: "Thisisapassword123@", + email: process.env.E2E_USER || "e2e@prowler.com", + password: process.env.E2E_PASSWORD || "Thisisapassword123@", }, INVALID: { email: "invalid@example.com",