Skip to content

Commit

Permalink
Update .tests.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
barrfalk committed Jul 12, 2024
1 parent f8fa788 commit 15666c1
Showing 1 changed file with 18 additions and 73 deletions.
91 changes: 18 additions & 73 deletions .github/workflows/.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,81 +20,26 @@ env:
PREFIX: ${{ github.event.repository.name }}-${{ inputs.target }}

jobs:
integration-tests:
name: Integration
runs-on: ubuntu-22.04
timeout-minutes: 1
cypress-tests:
env:
DOMAIN: apps.silver.devops.gov.bc.ca
PREFIX: ${{ github.event.repository.name }}-${{ github.event.number }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: cache-npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-cache-node-modules-
${{ runner.os }}-build-
${{ runner.os }}-
- env:
API_NAME: nest
BASE_URL: https://${{ github.event.repository.name }}-${{ inputs.target }}-frontend.${{ env.DOMAIN }}
run: |
cd tests/integration
npm ci
node src/main.js
- name: Checkout GitCode
uses: actions/checkout@v3

e2e-tests:
name: E2E
defaults:
run:
working-directory: frontend
runs-on: ubuntu-22.04
timeout-minutes: 5
strategy:
matrix:
project: [Microsoft Edge]
steps:
- uses: actions/checkout@v4
name: Checkout
- uses: actions/setup-node@v4
name: Setup Node
- name: Run Cypress Test
uses: cypress-io/github-action@v5
with:
node-version: 20
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: |
npm ci
npx playwright install --with-deps
- name: Run Tests
env:
E2E_BASE_URL: https://${{ github.event.repository.name }}-${{ inputs.target }}-frontend.${{ env.DOMAIN }}/
CI: "true"
run: |
npx playwright test --project="${{ matrix.project }}" --reporter=html
working-directory: ./frontend
command: npx cypress run --browser electron --config baseUrl=https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }} --env auth_base_url=${{ vars.KEYCLOAK_URL_DEV }},auth_realm=${{ vars.KEYCLOAK_REALM }},auth_client_id=${{ vars.KEYCLOAK_CLIENT_ID }},keycloak_user=${{ vars.KEYCLOAK_USER }},keycloak_password=${{ secrets.KEYCLOAK_PASSWORD }}

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
name: upload results
with:
name: playwright-report-${{ matrix.project }}
path: "./frontend/playwright-report" # path from current folder
retention-days: 7

load-tests:
name: Load
runs-on: ubuntu-22.04
strategy:
matrix:
name: [backend, frontend]
steps:
- uses: actions/checkout@v4
- uses: grafana/[email protected]
env:
BACKEND_URL: https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}/api
FRONTEND_URL: https://${{ env.PREFIX }}-frontend.${{ env.DOMAIN }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
filename: ./tests/load/${{ matrix.name }}-test.js
flags: --vus 10 --duration 30s
name: cypress-artifacts
path: |-
/home/runner/work/nr-compliance-enforcement/nr-compliance-enforcement/frontend/cypress/videos/
/home/runner/work/nr-compliance-enforcement/nr-compliance-enforcement/frontend/cypress/screenshots/

0 comments on commit 15666c1

Please sign in to comment.