Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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')
});
})
});
});
Loading