generated from DFE-Digital/govuk-dotnet-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/containerize regression tests
- Loading branch information
Showing
3 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
27
browser-tests/content-regression-tests/docker-compose.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |