Skip to content

Commit 27547cc

Browse files
committed
[PRMP-1143] Retrieveal Test Validates PDF
1 parent 0be883f commit 27547cc

File tree

5 files changed

+63
-1
lines changed

5 files changed

+63
-1
lines changed

app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_workflow.cy.js renamed to app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_record.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const fileName = `${activePatient}/e4a6d7f7-01f3-44be-8964-515b2c0ec180`;
1414
const patientVerifyUrl = '/patient/verify';
1515
const lloydGeorgeRecordUrl = '/patient/lloyd-george-record';
1616

17-
describe('GP Workflow: View Lloyd George record', () => {
17+
describe('GP Workflow: Download Lloyd George record', () => {
1818
context('Download Lloyd George document', () => {
1919
beforeEach(() => {
2020
cy.deleteFileFromS3(bucketName, fileName);

app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_summary_report_workflow.cy.js renamed to app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/download_lloyd_george_summary_report.cy.js

File renamed without changes.

app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/patient_search_and_verify_unhappy_workflow.cy.js renamed to app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/no_access_to_lloyd_george_record.cy.js

File renamed without changes.

app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/patient_search_and_verify_workflow.cy.js renamed to app/cypress/e2e/1-ndr-smoke-tests/gp_user_workflows/no_lloyd_george_record.cy.js

File renamed without changes.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { pdsPatients, stubPatients } from '../../../support/patients';
2+
import { Roles } from '../../../support/roles';
3+
import dbItem from '../../../fixtures/dynamo-db-items/active-patient.json';
4+
import { formatNhsNumber } from '../../../../src/helpers/utils/formatNhsNumber';
5+
6+
const workspace = Cypress.env('WORKSPACE');
7+
dbItem.FileLocation = dbItem.FileLocation.replace('{env}', workspace);
8+
const activePatient =
9+
workspace === 'ndr-dev' ? pdsPatients.activeUpload : stubPatients.activeUpload;
10+
const bucketName = `${workspace}-lloyd-george-store`;
11+
const tableName = `${workspace}_LloydGeorgeReferenceMetadata`;
12+
const fileName = `${activePatient}/e4a6d7f7-01f3-44be-8964-515b2c0ec180`;
13+
14+
const patientVerifyUrl = '/patient/verify';
15+
const lloydGeorgeRecordUrl = '/patient/lloyd-george-record';
16+
17+
describe('GP Workflow: View Lloyd George record', () => {
18+
context('View Lloyd George document', () => {
19+
beforeEach(() => {
20+
cy.deleteFileFromS3(bucketName, fileName);
21+
cy.deleteItemFromDynamoDb(tableName, dbItem.ID);
22+
cy.addPdfFileToS3(bucketName, fileName, 'test_patient_record.pdf');
23+
cy.addItemToDynamoDb(tableName, dbItem);
24+
});
25+
26+
afterEach(() => {
27+
cy.deleteFileFromS3(bucketName, fileName);
28+
cy.deleteItemFromDynamoDb(tableName, dbItem.ID);
29+
});
30+
31+
it(
32+
'[Smoke] GP ADMIN user can view the Lloyd George document of an active patient',
33+
{ tags: 'smoke', defaultCommandTimeout: 20000 },
34+
() => {
35+
cy.smokeLogin(Roles.SMOKE_GP_ADMIN);
36+
cy.get('.nhsuk-navigation-container').should('exist');
37+
cy.navigateToPatientSearchPage();
38+
cy.get('#nhs-number-input').click();
39+
cy.get('#nhs-number-input').type(activePatient);
40+
cy.get('#search-submit').click();
41+
42+
cy.url().should('contain', patientVerifyUrl);
43+
cy.get('#verify-submit').click();
44+
45+
cy.url().should('contain', lloydGeorgeRecordUrl);
46+
cy.contains('Loading...').should('be.visible');
47+
48+
cy.document({ timeout: 30000 }).should(doc => {
49+
const text =
50+
doc
51+
.querySelector('[data-testid="pdf-viewer"]')
52+
?.shadowRoot
53+
?.querySelector('iframe')
54+
?.contentDocument
55+
?.querySelector('#viewer')
56+
?.innerText
57+
58+
expect(text).to.include('General Practice Summary')
59+
});
60+
})
61+
});
62+
});

0 commit comments

Comments
 (0)