Skip to content

Commit

Permalink
PRMDR 627 - Smoke test CI to Main (#300)
Browse files Browse the repository at this point in the history
Add CI to Main smoke tests
  • Loading branch information
RioKnightleyNHS authored Feb 21, 2024
1 parent 02b60c1 commit 524e02c
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 41 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/base-cypress-smoketest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ jobs:
repository: 'nhsconnect/national-document-repository'
ref: ${{ inputs.build_branch}}

- name: AWS Role
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
role-skip-session-tagging: true
aws-region: ${{ vars.AWS_REGION }}

- name: Cypress install
run: |
npm install --legacy-peer-deps
Expand Down Expand Up @@ -73,7 +80,7 @@ jobs:
if-no-files-found: ignore

cypress-run-firefox:
needs: ["cypress-run-chrome"]
needs: ['cypress-run-chrome']
runs-on: ubuntu-22.04
environment: ${{ inputs.environment }}
steps:
Expand All @@ -83,6 +90,13 @@ jobs:
repository: 'nhsconnect/national-document-repository'
ref: ${{ inputs.build_branch}}

- name: AWS Role
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
role-skip-session-tagging: true
aws-region: ${{ vars.AWS_REGION }}

- name: Cypress install
run: |
npm install --legacy-peer-deps
Expand All @@ -103,7 +117,7 @@ jobs:
CYPRESS_OUTPUT_VIDEO: false

cypress-run-edge:
needs: ["cypress-run-firefox"]
needs: ['cypress-run-firefox']
runs-on: ubuntu-22.04
environment: ${{ inputs.environment }}
steps:
Expand All @@ -113,6 +127,13 @@ jobs:
repository: 'nhsconnect/national-document-repository'
ref: ${{ inputs.build_branch}}

- name: AWS Role
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
role-skip-session-tagging: true
aws-region: ${{ vars.AWS_REGION }}

- name: Cypress install
run: |
npm install --legacy-peer-deps
Expand Down
31 changes: 6 additions & 25 deletions .github/workflows/lambdas-dev-to-main-ci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: " CI Lambdas - CI Feature to Main"
name: 'CI Lambdas - CI Feature to Main'

on:
push:
branches:
- main
paths:
- "lambdas/**"
- 'lambdas/**'
pull_request:
branches:
- main
paths:
- "lambdas/**"
- 'lambdas/**'

permissions:
pull-requests: write
Expand All @@ -33,32 +33,13 @@ jobs:

deploy_all_lambdas:
uses: ./.github/workflows/base-lambdas-reusable-deploy-all.yml
needs: ["run_tests"]
needs: ['run_tests']
if: |
(github.ref == 'refs/heads/main')
(github.ref == 'refs/heads/main')
with:
environment: development
python_version: "3.11"
python_version: '3.11'
build_branch: ${{github.event.pull_request.head.ref}}
sandbox: ndr-dev
secrets:
AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }}

# smoketest:
# uses: ./.github/workflows/ui-smoketest-base.yml
# needs: ["deploy_all_lambdas"]
# if: |
# (github.ref == 'refs/heads/main')
# with:
# build_branch: ${{github.event.pull_request.head.ref}}
# environment: development
# sandbox: ndr-dev
# aws_region: ${{ vars.AWS_REGION }}
# secrets:
# AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }}
# CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
# CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }}




4 changes: 2 additions & 2 deletions .github/workflows/ui-dev-to-main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: ./.github/workflows/base-cypress-build.yml
with:
build_branch: ${{github.event.pull_request.head.ref}}

cypress_test_job:
name: Run Cypress E2E Tests
needs: [cypress_build_job]
Expand All @@ -42,7 +42,7 @@ jobs:
deploy_ui:
name: Deploy UI
if: github.ref == 'refs/heads/main'
needs: ["react_testing_job", "cypress_test_job"]
needs: ['react_testing_job', 'cypress_test_job']
uses: ./.github/workflows/base-deploy-ui.yml
with:
build_branch: ${{github.event.pull_request.head.ref}}
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/ui-smoketest-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# .github/workflows/terraform-dev
name: 'Cypress Smoketest CI to Main: Smoketest shared actions checking CI deployments'

on:
workflow_run:
workflows:
[
'CI UI - Development CI Feature Branch to Main',
'CI Lambdas - CI Feature to Main'
]
types:
- completed

permissions:
pull-requests: write
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

jobs:
smoketest:
uses: ./.github/workflows/base-cypress-smoketest.yml
with:
build_branch: main
environment: development
sandbox: ndr-dev
secrets:
AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }}
CYPRESS_USERNAME: ${{ secrets.CYPRESS_USERNAME }}
CYPRESS_PASSWORD: ${{ secrets.CYPRESS_PASSWORD }}
7 changes: 0 additions & 7 deletions .github/workflows/ui-smoketest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ on:
required: true
type: 'string'
default: 'ndr'
secrets:
AWS_ASSUME_ROLE:
required: true
CYPRESS_USERNAME:
required: true
CYPRESS_PASSWORD:
required: true

permissions:
pull-requests: write
Expand Down
8 changes: 4 additions & 4 deletions app/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CYPRESS_BASE_URL=http://localhost:xxxx # Use the port number same as above PORT
CYPRESS_USERNAME=xxxx # For Cypress CIS2 Login during smoke tests
CYPRESS_PASSWORD=xxxx # For Cypress CIS2 Login during smoke tests
CYPRESS_WORKSPACE=local # Helps find the correct patient data relative to the workspace
AWS_ACCESS_KEY_ID=xxxx # If workspace is a sandbox, data is seeded with these credentials
AWS_SECRET_ACCESS_KEY=xxxx # If workspace is a sandbox, data is seeded with these credentials
AWS_SESSION_TOKEN=xxxx # If workspace is a sandbox, data is seeded with these credentials
AWS_REGION=xxxx # If workspace is a sandbox, data is seeded with these credentials
AWS_ACCESS_KEY_ID=xxxx # If workspace is a sandbox, data is seeded with these credentials. You can bypass this by assuming AWS role in your terminal
AWS_SECRET_ACCESS_KEY=xxxx # If workspace is a sandbox, data is seeded with these credentials. You can bypass this by assuming AWS role in your terminal
AWS_SESSION_TOKEN=xxxx # If workspace is a sandbox, data is seeded with these credentials. You can bypass this by assuming AWS role in your terminal
AWS_REGION=xxxx # If workspace is a sandbox, data is seeded with these credentials. You can bypass this by assuming AWS role in your terminal
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('GP Workflow: View Lloyd George record', () => {
cy.contains('Cancel').should('be.visible');

// Assert contents of page after download
cy.get('.lloydgeorge_download-complete', { timeout: 10000 }).should('exist');
cy.get('.lloydgeorge_download-complete', { timeout: 20000 }).should('exist');
cy.contains('Download complete').should('be.visible');
cy.contains('Documents from the Lloyd George record of:').should('be.visible');
cy.contains(`(NHS number: ${activePatient})`).should('be.visible');
Expand Down

0 comments on commit 524e02c

Please sign in to comment.