Skip to content

Cypress end-to-end Testing #23

Cypress end-to-end Testing

Cypress end-to-end Testing #23

name: Firebase Deploy to Staging and Cypress e2e Tests
on:
pull_request:
types: [opened, reopened, synchronize]
concurrency:
group: ci-preview-tests-${{ github.ref }}-1
cancel-in-progress: true
jobs:
build-and-preview:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- run: npm ci && npm run build
- name: Deploy to Firebase Hosting Channel
id: firebase-deploy
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_GSE_ROAR_ADMIN }}'
projectId: gse-roar-admin
target: staging
- run: echo ${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }}
outputs:
deployUrl: ${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }}
cypress-run:
needs: [build-and-preview]
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
browser: [chromium, edge]
containers: [1, 2]
env:
CYPRESS_BASE_URL: ${{ needs.build-and-preview.outputs.deployUrl }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
PARTNER_ADMIN_USERNAME: ${{ secrets.PARTNER_ADMIN_USERNAME }}
PARTNER_ADMIN_PASSWORD: ${{ secrets.PARTNER_ADMIN_PASSWORD }}
PARTNER_ADMIN_ID: ${{ secrets.PARTNER_ADMIN_ID }}
PARTICIPANT_USERNAME: ${{ secrets.PARTICIPANT_USERNAME }}
PARTICIPANT_PASSWORD: ${{ secrets.PARTICIPANT_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress run
uses: cypress-io/github-action@v6
with:
browser: ${{ matrix.browser }}
build: echo "Build step already completed"
start: echo "App already deployed to Firebase"
wait-on: ${{ env.CYPRESS_BASE_URL }}
wait-on-timeout: 60
record: true
parallel: true
spec: 'cypress/e2e/participant/**/*,cypress/e2e/partner-admin/**/*'
ci-build-id: ${{ github.run_id }}-${{ matrix.browser }}