department-of-veterans-affairs/vets-website

View on GitHub
.github/workflows/e2e-injection-test.yml

Summary

Maintainability
Test Coverage
name: E2E Proxy Rewrite Injection Test


on:
  workflow_dispatch:
  schedule:
    - cron: 0 14 * * 1-5

jobs:
  cypress-tests:
    name: Cypress E2E Proxy Rewrite Header/Footer Injection Test
    runs-on: self-hosted
    container:
      image: public.ecr.aws/cypress-io/cypress/browsers:node16.13.2-chrome100-ff98
      options: -u 1001:1001 -v /usr/local/share:/share

    env:
      CHROMEDRIVER_FILEPATH: /share/chrome_driver/chromedriver
      NODE_EXTRA_CA_CERTS: /share/ca-certificates/VA-Internal-S2-RCA1-v1.cer.crt

    steps:
      - name: Checkout
        uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017

      - name: Install dependencies
        uses: ./.github/workflows/install
        with:
          key: ${{ hashFiles('yarn.lock') }}
          yarn_cache_folder: .cache/yarn
          path: |
            .cache/yarn
            /github/home/.cache/Cypress
            node_modules
      
      - name: Start server
        run: node src/platform/testing/e2e/test-server.js --buildtype=${{ env.BUILDTYPE }} --port=3001 &

      - name: Run Cypress tests
        uses: nick-fields/retry@v3
        with:
          command: yarn cy:run --spec "src/applications/proxy-rewrite/tests/e2e/proxy-rewrite-entry.cypress.spec.js"
          max_attempts: 3
          timeout_minutes: 30
          retry_wait_seconds: 600
        env:
          CYPRESS_CI: false
          CYPRESS_RUN_INJECTION: true

  notify-failure:
    name: Notify Failure
    runs-on: ubuntu-latest
    needs: cypress-tests
    if: ${{ failure() }}
    env:
      VETS_WEBSITE_CHANNEL_ID: C02V265VCGH #status-vets-website

    steps:
      - name: Checkout
        uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017

      - name: Notify Slack - \#status-vets-website
        uses: ./.github/workflows/slack-notify
        continue-on-error: true
        env:
          SSL_CERT_DIR: /etc/ssl/certs
        with:
          payload: '{"attachments": [{"color": "#FF0800","blocks": [{"type": "section","text": {"type": "mrkdwn","text": "Proxy Rewrite Header/Footer e2e test run in `vets-website` failed: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|${{github.run_id}}>"}}]}]}'
          channel_id: ${{ env.VETS_WEBSITE_CHANNEL_ID }}
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}