Skip to content

Commit

Permalink
feat: Regression test automation
Browse files Browse the repository at this point in the history
Feature/containerize regression tests
  • Loading branch information
nnagepat authored Sep 22, 2023
2 parents ffd307d + 707ae97 commit 675e779
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/docker-content-regression-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: Run regression tests
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to test'
required: false
default: 'v1.0.0'
workspace:
description: 'Environment to run'
required: true
default: 'Dev'
type: choice
options:
- Dev
- Test
- Pre-Prod
jobs:
build-test-scan:
name: Build image and regression test
runs-on: ubuntu-latest
environment: ${{inputs.workspace}}
env:
CPD_GOOGLEANALYTICSTAG: ${{secrets.TF_VAR_CPD_GOOGLEANALYTICSTAG}}
CPD_SPACE_ID: ${{secrets.TF_VAR_CPD_SPACE_ID}}
CPD_PREVIEW_KEY: ${{secrets.TF_VAR_CPD_PREVIEW_KEY}}
CPD_DELIVERY_KEY: ${{secrets.TF_VAR_CPD_DELIVERY_KEY}}
CPD_CLARITY: ${{secrets.TF_VAR_CPD_CLARITY}}
CPD_AZURE_ENVIRONMENT: ${{inputs.workspace}}
CPD_CONTENTFUL_ENVIRONMENT: ${{inputs.workspace}}
CPD_FEATURE_POLLING_INTERVAL: 0
CPD_INSTRUMENTATION_CONNECTIONSTRING: ""
steps:
- uses: actions/checkout@v3
with:
ref: '${{ inputs.tag }}'

- name: Build the Docker App Image
run: cd Childrens-Social-Care-CPD; docker build . --file Dockerfile --tag childrens-social-care-cpd:ContainerizeRegressionTests
- name: Run the content regression tests
run: cd browser-tests/content-regression-tests; docker-compose up --exit-code-from content-regression-tests

- uses: actions/upload-artifact@v3
name: Playwright report
if: always()
with:
name: playwright-report
retention-days: 7
path: |
${{ github.workspace }}/browser-tests/content-regression-tests/playwright-report
- name: Run Tidy up
if: always()
run: cd browser-tests/content-regression-tests; docker-compose down --volumes
9 changes: 9 additions & 0 deletions browser-tests/content-regression-tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM mcr.microsoft.com/playwright:v1.36.0-jammy

WORKDIR /app

COPY ./tests /app/tests/
COPY ./package*.json /app/
COPY ./playwright.config.ts /app/

RUN npm ci
27 changes: 27 additions & 0 deletions browser-tests/content-regression-tests/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
version: "3.4"
services:
children-social-care-cpd:
image: childrens-social-care-cpd:ContainerizeRegressionTests
environment:
- CPD_AZURE_ENVIRONMENT=${CPD_AZURE_ENVIRONMENT}
- CPD_CLARITY=${CPD_CLARITY}
- CPD_CONTENTFUL_ENVIRONMENT=${CPD_CONTENTFUL_ENVIRONMENT}
- CPD_DELIVERY_KEY=${CPD_DELIVERY_KEY}
- CPD_GOOGLEANALYTICSTAG=${CPD_GOOGLEANALYTICSTAG}
- CPD_PREVIEW_KEY=${CPD_PREVIEW_KEY}
- CPD_SPACE_ID=${CPD_SPACE_ID}
- ASPNETCORE_URLS=http://+
- ASPNETCORE_ENVIRONMENT=
- CPD_DISABLE_SECURE_COOKIES=true
- CPD_FEATURE_POLLING_INTERVAL=0
content-regression-tests:
build:
context: ./
environment:
- PLAYWRIGHT_BASE_URL=http://children-social-care-cpd
- CI=1
volumes:
- ./playwright-report:/app/playwright-report/
command: npx playwright test
working_dir: /app

0 comments on commit 675e779

Please sign in to comment.