From 27547cc19bbde06417b9ccd446a29e666a52bf84 Mon Sep 17 00:00:00 2001 From: robg-test <106234256+robg-test@users.noreply.github.com> Date: Thu, 18 Dec 2025 13:04:04 +0000 Subject: [PATCH] [PRMP-1143] Retrieveal Test Validates PDF --- ....js => download_lloyd_george_record.cy.js} | 2 +- ...ownload_lloyd_george_summary_report.cy.js} | 0 ...=> no_access_to_lloyd_george_record.cy.js} | 0 ...low.cy.js => no_lloyd_george_record.cy.js} | 0 .../view_record_lloyd_george.cy.js | 62 +++++++++++++++++++ 5 files changed, 63 insertions(+), 1 deletion(-) rename app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/{download_lloyd_george_workflow.cy.js => download_lloyd_george_record.cy.js} (98%) rename app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/{download_lloyd_george_summary_report_workflow.cy.js => download_lloyd_george_summary_report.cy.js} (100%) rename app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/{patient_search_and_verify_unhappy_workflow.cy.js => no_access_to_lloyd_george_record.cy.js} (100%) rename app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/{patient_search_and_verify_workflow.cy.js => no_lloyd_george_record.cy.js} (100%) create mode 100644 app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/view_record_lloyd_george.cy.js diff --git a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_workflow.cy.js b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_record.cy.js similarity index 98% rename from app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_workflow.cy.js rename to app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_record.cy.js index c7759b3b6..b116e2f9f 100644 --- a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_workflow.cy.js +++ b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_record.cy.js @@ -14,7 +14,7 @@ const fileName = `${activePatient}/e4a6d7f7-01f3-44be-8964-515b2c0ec180`; const patientVerifyUrl = '/patient/verify'; const lloydGeorgeRecordUrl = '/patient/lloyd-george-record'; -describe('GP Workflow: View Lloyd George record', () => { +describe('GP Workflow: Download Lloyd George record', () => { context('Download Lloyd George document', () => { beforeEach(() => { cy.deleteFileFromS3(bucketName, fileName); diff --git a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_summary_report_workflow.cy.js b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_summary_report.cy.js similarity index 100% rename from app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_summary_report_workflow.cy.js rename to app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_summary_report.cy.js diff --git a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/patient_search_and_verify_unhappy_workflow.cy.js b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/no_access_to_lloyd_george_record.cy.js similarity index 100% rename from app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/patient_search_and_verify_unhappy_workflow.cy.js rename to app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/no_access_to_lloyd_george_record.cy.js diff --git a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/patient_search_and_verify_workflow.cy.js b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/no_lloyd_george_record.cy.js similarity index 100% rename from app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/patient_search_and_verify_workflow.cy.js rename to app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/no_lloyd_george_record.cy.js diff --git a/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/view_record_lloyd_george.cy.js b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/view_record_lloyd_george.cy.js new file mode 100644 index 000000000..4d472df40 --- /dev/null +++ b/app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/view_record_lloyd_george.cy.js @@ -0,0 +1,62 @@ +import { pdsPatients, stubPatients } from '../../../support/patients'; +import { Roles } from '../../../support/roles'; +import dbItem from '../../../fixtures/dynamo-db-items/active-patient.json'; +import { formatNhsNumber } from '../../../../src/helpers/utils/formatNhsNumber'; + +const workspace = Cypress.env('WORKSPACE'); +dbItem.FileLocation = dbItem.FileLocation.replace('{env}', workspace); +const activePatient = + workspace === 'ndr-dev' ? pdsPatients.activeUpload : stubPatients.activeUpload; +const bucketName = `${workspace}-lloyd-george-store`; +const tableName = `${workspace}_LloydGeorgeReferenceMetadata`; +const fileName = `${activePatient}/e4a6d7f7-01f3-44be-8964-515b2c0ec180`; + +const patientVerifyUrl = '/patient/verify'; +const lloydGeorgeRecordUrl = '/patient/lloyd-george-record'; + +describe('GP Workflow: View Lloyd George record', () => { + context('View Lloyd George document', () => { + beforeEach(() => { + cy.deleteFileFromS3(bucketName, fileName); + cy.deleteItemFromDynamoDb(tableName, dbItem.ID); + cy.addPdfFileToS3(bucketName, fileName, 'test_patient_record.pdf'); + cy.addItemToDynamoDb(tableName, dbItem); + }); + + afterEach(() => { + cy.deleteFileFromS3(bucketName, fileName); + cy.deleteItemFromDynamoDb(tableName, dbItem.ID); + }); + + it( + '[Smoke] GP ADMIN user can view the Lloyd George document of an active patient', + { tags: 'smoke', defaultCommandTimeout: 20000 }, + () => { + cy.smokeLogin(Roles.SMOKE_GP_ADMIN); + cy.get('.nhsuk-navigation-container').should('exist'); + cy.navigateToPatientSearchPage(); + cy.get('#nhs-number-input').click(); + cy.get('#nhs-number-input').type(activePatient); + cy.get('#search-submit').click(); + + cy.url().should('contain', patientVerifyUrl); + cy.get('#verify-submit').click(); + + cy.url().should('contain', lloydGeorgeRecordUrl); + cy.contains('Loading...').should('be.visible'); + + cy.document({ timeout: 30000 }).should(doc => { + const text = + doc + .querySelector('[data-testid="pdf-viewer"]') + ?.shadowRoot + ?.querySelector('iframe') + ?.contentDocument + ?.querySelector('#viewer') + ?.innerText + + expect(text).to.include('General Practice Summary') + }); + }) + }); +});