diff --git a/.github/docker-compose.test.yml b/.github/docker-compose.test.yml index 27f99eb9f0..fd0f275024 100644 --- a/.github/docker-compose.test.yml +++ b/.github/docker-compose.test.yml @@ -14,15 +14,27 @@ services: # The Unleash server contains the Unleash configuration and # communicates with server-side SDKs and the Unleash Proxy - unleash: - image: 726824350591.dkr.ecr.eu-central-1.amazonaws.com/unleash-enterprise:latest - pull_policy: "always" + frontend: + image: node:alpine + working_dir: /app + command: npx http-server ./build -p 80 --cors --proxy http://unleash:4242 ports: - - "4242:4242" + - "3000:80" + volumes: + - ../frontend/build:/app:ro + depends_on: + unleash: + condition: service_healthy + unleash: + image: unleashorg/unleash-enterprise:latest + pull_policy: "always" + expose: + - "4242" environment: DATABASE_URL: "postgres://postgres:unleash@db/unleash" DATABASE_SSL: "false" UNLEASH_LICENSE: "${FRONTEND_TEST_LICENSE}" + LOG_LEVEL: "info" depends_on: db: condition: service_healthy diff --git a/.github/workflows/e2e.frontend.yaml b/.github/workflows/e2e.frontend.yaml index be650a7f53..deabbf368d 100644 --- a/.github/workflows/e2e.frontend.yaml +++ b/.github/workflows/e2e.frontend.yaml @@ -22,9 +22,13 @@ jobs: echo "$GITHUB_CONTEXT" - name: Checkout uses: actions/checkout@v4 + - name: Build static frontend + run: | + cd frontend + yarn install --immutable + yarn build - name: Start Unleash test instance run: | - curl https://app.unleash-hosted.com/docker-login/token/${{ secrets.ECR_ENTERPRISE_TOKEN }} | docker login --username AWS --password-stdin 726824350591.dkr.ecr.eu-central-1.amazonaws.com docker compose -f .github/docker-compose.test.yml up -d --wait -t 90 env: FRONTEND_TEST_LICENSE: ${{ secrets.FRONTEND_TEST_LICENSE }} @@ -33,6 +37,6 @@ jobs: with: working-directory: frontend env: AUTH_USER=admin,AUTH_PASSWORD=unleash4all - config: baseUrl=http://localhost:4242 + config: baseUrl=http://localhost:3000 spec: cypress/integration/${{ matrix.test }} install-command: yarn --immutable diff --git a/frontend/package.json b/frontend/package.json index d94ec6b5d5..ae5e7ce630 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -17,7 +17,6 @@ "start:sandbox": "UNLEASH_API=https://sandbox.getunleash.io/ VITE_TEST_REDIRECT=true UNLEASH_BASE_PATH=/pro/ yarn run start", "start:sandbox:enterprise": "UNLEASH_API=https://sandbox.getunleash.io/ VITE_TEST_REDIRECT=true UNLEASH_BASE_PATH=/enterprise/ yarn run start", "start:demo2": "UNLEASH_API=https://sandbox.getunleash.io/ UNLEASH_BASE_PATH=/demo2/ yarn run start", - "start:enterprise": "UNLEASH_API=https://unleash.herokuapp.com VITE_TEST_REDIRECT=true yarn run start", "start:demo": "UNLEASH_BASE_PATH=/demo/ UNLEASH_API=https://app.unleash-hosted.com/ yarn run start", "test": "NODE_OPTIONS=\"${NODE_OPTIONS:-0} --no-experimental-fetch\" vitest run", "test:snapshot": "NODE_OPTIONS=\"${NODE_OPTIONS:-0} --no-experimental-fetch\" yarn test -u", @@ -30,7 +29,6 @@ "ts:check": "tsc", "e2e": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --no-experimental-fetch\" yarn run cypress open --config baseUrl='http://localhost:3000' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all", "e2e:oss": "yarn --cwd frontend run cypress run --spec \"cypress/oss/**/*.spec.ts\" --config baseUrl=\"http://localhost:${EXPOSED_PORT:-4242}\" --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all", - "e2e:heroku": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --no-experimental-fetch\" yarn run cypress open --config baseUrl='https://unleash.herokuapp.com' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all", "gen:api": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --no-experimental-fetch\" orval --config orval.config.js", "gen:api:demo": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --no-experimental-fetch\" UNLEASH_OPENAPI_URL=https://app.unleash-hosted.com/demo/docs/openapi.json yarn run gen:api", "gen:api:sandbox": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --no-experimental-fetch\" UNLEASH_OPENAPI_URL=https://sandbox.getunleash.io/demo2/docs/openapi.json yarn run gen:api", diff --git a/src/lib/util/rewriteHTML.test.ts b/src/lib/util/rewriteHTML.test.ts index 172e3c0020..bb6fea34f6 100644 --- a/src/lib/util/rewriteHTML.test.ts +++ b/src/lib/util/rewriteHTML.test.ts @@ -49,7 +49,7 @@ test('rewriteHTML swaps out faviconPath if cdnPrefix is set', () => { const result = rewriteHTML(input, '', 'https://cdn.getunleash.io/v4.1.0'); expect( result.includes( - '', + '', ), ).toBe(true); }); diff --git a/src/lib/util/rewriteHTML.ts b/src/lib/util/rewriteHTML.ts index 726ca7b924..97bd20642a 100644 --- a/src/lib/util/rewriteHTML.ts +++ b/src/lib/util/rewriteHTML.ts @@ -9,7 +9,7 @@ export const rewriteHTML = ( result = result.replace(/::baseUriPath::/gi, rewriteValue); result = result.replace(/::cdnPrefix::/gi, cdnPrefix || ''); - const faviconPrefix = cdnPrefix ? 'https://cdn.getunleash.io' : ''; + const faviconPrefix = cdnPrefix ? cdnPrefix : ''; result = result.replace(/::faviconPrefix::/gi, faviconPrefix); result = result.replace(/::uiFlags::/gi, uiFlags || '{}');