name: Cypress Tests

on: [push, workflow_dispatch]

jobs:
  cypress-chrome:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Chrome Browser Tests
        uses: cypress-io/github-action@v2
        with:
          working-directory: frontend
          build: npm config:defaults
          start: npm run start:local-prod
          wait-on: 'http://localhost:4200'
          wait-on-timeout: 120
          record: true
          browser: chrome
        env:
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
          #GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
          DEBUG: 'cypress:*'
  cypress-firefox:
    runs-on: ubuntu-latest
    container:
      image: cypress/browsers:node14.17.0-chrome88-ff89
      options: --user 1001
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Firefox Browser Tests
        uses: cypress-io/github-action@v2
        with:
          working-directory: frontend
          build: npm config:defaults
          start: npm run start:local-prod
          wait-on: 'http://localhost:4200'
          wait-on-timeout: 120
          record: true
          browser: firefox
        env:
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
          #GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
          DEBUG: 'cypress:*'
  cypress-edge:
    runs-on: windows-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Edge Browser Tests
        uses: cypress-io/github-action@v2
        with:
          working-directory: frontend
          build: npm config:defaults
          start: npm run start:local-prod
          wait-on: 'http://localhost:4200'
          wait-on-timeout: 120
          record: true
          browser: edge
        env:
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
          #GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
          DEBUG: 'cypress:*'
