diff --git a/.github/workflows/base-cypress-smoketest.yml b/.github/workflows/base-cypress-smoketest.yml index 573f70582..129811f2c 100644 --- a/.github/workflows/base-cypress-smoketest.yml +++ b/.github/workflows/base-cypress-smoketest.yml @@ -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 @@ -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: @@ -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 @@ -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: @@ -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 diff --git a/.github/workflows/lambdas-dev-to-main-ci.yml b/.github/workflows/lambdas-dev-to-main-ci.yml index 9b5d093ca..d29d13e70 100644 --- a/.github/workflows/lambdas-dev-to-main-ci.yml +++ b/.github/workflows/lambdas-dev-to-main-ci.yml @@ -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 @@ -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 }} - - - - \ No newline at end of file diff --git a/.github/workflows/ui-dev-to-main-ci.yml b/.github/workflows/ui-dev-to-main-ci.yml index a746b21c3..6ce6b70fe 100644 --- a/.github/workflows/ui-dev-to-main-ci.yml +++ b/.github/workflows/ui-dev-to-main-ci.yml @@ -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] @@ -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}} diff --git a/.github/workflows/ui-smoketest-ci.yml b/.github/workflows/ui-smoketest-ci.yml new file mode 100644 index 000000000..4b2310fbc --- /dev/null +++ b/.github/workflows/ui-smoketest-ci.yml @@ -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 }} diff --git a/.github/workflows/ui-smoketest.yml b/.github/workflows/ui-smoketest.yml index 75ae4baaf..ff32f6b7b 100644 --- a/.github/workflows/ui-smoketest.yml +++ b/.github/workflows/ui-smoketest.yml @@ -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 diff --git a/app/.env.template b/app/.env.template index 506ba1512..12c6c719b 100644 --- a/app/.env.template +++ b/app/.env.template @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_not_bsol_workflow.cy.js b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_not_bsol_workflow.cy.js index 9c33cb63e..eeedad62b 100644 --- a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_not_bsol_workflow.cy.js +++ b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_not_bsol_workflow.cy.js @@ -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');