🧪 E2E Tests #11425
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 🧪 E2E Tests | |
| on: | |
| deployment_status: | |
| concurrency: | |
| group: e2e-${{ github.event.deployment.environment }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| e2e: | |
| if: ${{ github.event.deployment_status.state == 'success'}} | |
| runs-on: ubuntu-latest | |
| name: "Test e2e" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 | |
| with: | |
| run_install: false | |
| - name: Install dependencies | |
| run: | | |
| pnpm install --frozen-lockfile | |
| - name: Load SocialGouv variables | |
| id: env | |
| uses: socialgouv/kontinuous/.github/actions/env@v1 | |
| - name: Set env | |
| run: | | |
| echo "SITE_URL=https://${{ steps.env.outputs.subdomain }}.ovh.fabrique.social.gouv.fr" >> $GITHUB_ENV | |
| echo "KEYCLOAK_URL=https://keycloak-${{ steps.env.outputs.subdomain }}.ovh.fabrique.social.gouv.fr" >> $GITHUB_ENV | |
| - name: Override subdomain for master branch | |
| if: ${{ github.ref == 'refs/heads/master' }} | |
| run: | | |
| echo "SITE_URL=https://egapro-preprod.ovh.fabrique.social.gouv.fr" >> $GITHUB_ENV | |
| echo "KEYCLOAK_URL=https://keycloak.undercloud.fabrique.social.gouv.fr" >> $GITHUB_ENV | |
| - name: Wait for app and Keycloak to be ready | |
| run: | | |
| echo "Waiting for app at $SITE_URL ..." | |
| timeout 180 bash -c 'until curl -sf -o /dev/null "$SITE_URL"; do sleep 5; done' | |
| echo "✓ App is ready" | |
| echo "Waiting for Keycloak realm egapro at $KEYCLOAK_URL ..." | |
| timeout 180 bash -c 'until curl -sf -o /dev/null "$KEYCLOAK_URL/realms/egapro"; do sleep 5; done' | |
| echo "✓ Keycloak is ready" | |
| - name: Run test e2e | |
| run: | | |
| pnpm test:e2e:app -- --browser chrome | |
| env: | |
| CI: "true" | |
| working-directory: ./packages/app | |
| config: "pageLoadTimeout=100000,baseUrl=${{ env.SITE_URL }}" | |
| TEST_BASEURL: ${{ env.SITE_URL }} | |
| E2E_USERNAME: ${{ github.ref == 'refs/heads/master' && secrets.E2E_USERNAME || 'test@fia1.fr' }} | |
| E2E_PASSWORD: ${{ github.ref == 'refs/heads/master' && secrets.E2E_PASSWORD || 'test' }} | |
| KEYCLOAK_URL: ${{ env.KEYCLOAK_URL }} | |
| - name: Upload Cypress artifacts | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cypress-artifacts | |
| path: | | |
| packages/app/cypress/screenshots | |
| packages/app/cypress/videos | |
| retention-days: 7 |