diff --git a/.github/workflows/docker-content-regression-tests.yml b/.github/workflows/docker-content-regression-tests.yml new file mode 100644 index 00000000..d60913a8 --- /dev/null +++ b/.github/workflows/docker-content-regression-tests.yml @@ -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 \ No newline at end of file diff --git a/browser-tests/content-regression-tests/Dockerfile b/browser-tests/content-regression-tests/Dockerfile new file mode 100644 index 00000000..ea18b9dd --- /dev/null +++ b/browser-tests/content-regression-tests/Dockerfile @@ -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 \ No newline at end of file diff --git a/browser-tests/content-regression-tests/docker-compose.yaml b/browser-tests/content-regression-tests/docker-compose.yaml new file mode 100644 index 00000000..b4b7e301 --- /dev/null +++ b/browser-tests/content-regression-tests/docker-compose.yaml @@ -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 \ No newline at end of file