Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRMDR-803 + 770 update BSOL download journey #362

Merged
merged 82 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
a2ac5cc
refactoring WIP
NogaNHS May 2, 2024
5e944bc
refactoring WIP - 2
NogaNHS May 3, 2024
41fbd27
refactoring WIP - 3
NogaNHS May 3, 2024
b9a5a6a
adding filter for doc in download
NogaNHS May 3, 2024
0f96b6a
refactoring manifest service
NogaNHS May 3, 2024
5231f9f
[PRMDR-803] change get table name method
RachelHowellNHS May 7, 2024
658d3b0
[PRMDR-803] amend doc manifest service function call
RachelHowellNHS May 7, 2024
74f9701
[PRMDR-803] add logs
RachelHowellNHS May 7, 2024
9e78a1d
refactoring document search
NogaNHS May 7, 2024
5446051
[PRMDR-803] add logs
RachelHowellNHS May 7, 2024
c0e94d8
[PRMDR-803] add logs
RachelHowellNHS May 8, 2024
57cee74
[PRMDR-803] try hardcoding query filter attributes
RachelHowellNHS May 8, 2024
6bb0b99
[PRMDR-803] revert query filter
RachelHowellNHS May 8, 2024
c75d5e8
[PRMDR-803] remove one condition from upload completed query filter
RachelHowellNHS May 8, 2024
6b33158
[PRMDR-803] revert query filter
RachelHowellNHS May 8, 2024
6512b10
[PRMDR-803] amend assignment of doc references
RachelHowellNHS May 8, 2024
5b53d76
[PRMDR-803] remove logs
RachelHowellNHS May 8, 2024
dc0ea3a
[PRMDR-803] return id and fix unit tests
RachelHowellNHS May 8, 2024
9450d99
[PRMDR-803] add doc manifest lambda unit tests
RachelHowellNHS May 8, 2024
17fb936
[PRMDR-803] update jinja and werkzeug versions
RachelHowellNHS May 8, 2024
ac01256
refactoring document search wip
NogaNHS May 8, 2024
4045909
[PRMDR-803] add checkbox functionality
RachelHowellNHS May 9, 2024
1859efb
add func to buttons in download screen
NogaNHS May 9, 2024
589a439
[PRMDR-803] add isBSOL check
RachelHowellNHS May 10, 2024
c6b7d4c
[PRMDR-803] fix download LG e2e
RachelHowellNHS May 10, 2024
1d9d39c
[PRMDR-803] add dependency to useEffect
RachelHowellNHS May 10, 2024
9954d1d
Merge branch 'main' into PRMDR-803
RachelHowellNHS May 10, 2024
fa2c51d
[PRMDR-803] add wait to e2e to try to fix pipeline issue
RachelHowellNHS May 10, 2024
e58a51d
[PRMDR-803] add wait to e2e to try to fix pipeline issue
RachelHowellNHS May 10, 2024
dd74703
change doc list to accept document generic type
NogaNHS May 10, 2024
63d63f7
[PRMDR-803] fix issues and add conditions for document complete stage…
RachelHowellNHS May 13, 2024
21154a7
[PRMDR-803] update download submission for all files selected
RachelHowellNHS May 13, 2024
e9b9757
[PRMDR-803] refactor and remove now unused return to medical record b…
RachelHowellNHS May 13, 2024
7bd6a89
[PRMDR-803] remove unused props
RachelHowellNHS May 13, 2024
0272c26
[PRMDR-803] fix unit tests
RachelHowellNHS May 13, 2024
55ad1dc
[PRMDR-803] remove unused imports
RachelHowellNHS May 13, 2024
c66a07c
[PRMDR-803] WIP - fix e2e
RachelHowellNHS May 13, 2024
b1e2c00
[PRMDR-803] add return to medical record button back in
RachelHowellNHS May 14, 2024
0dedd70
[PRMDR-803] add console log
RachelHowellNHS May 14, 2024
e0d4eaf
[PRMDR-803] add console logs
RachelHowellNHS May 14, 2024
bf569e7
[PRMDR-803] add console logs
RachelHowellNHS May 14, 2024
91172ec
[PRMDR-803] add console logs
RachelHowellNHS May 14, 2024
9c58679
[PRMDR-803] change selected docs type
RachelHowellNHS May 14, 2024
2f37843
[PRMDR-803] change documents list function
RachelHowellNHS May 14, 2024
b12124d
[PRMDR-803] add console logs
RachelHowellNHS May 14, 2024
ece7734
[PRMDR-803] change id to lowercase in metadata field names
RachelHowellNHS May 14, 2024
0693431
[PRMDR-803] revert lambda changes and make ID caps in UI
RachelHowellNHS May 14, 2024
ac3713c
[PRMDR-803] remove logs, amend sort and remove unreachable condition …
RachelHowellNHS May 14, 2024
8926501
[PRMDR-803] add return button for delete after download to test if it…
RachelHowellNHS May 14, 2024
c897b89
[PRMDR-803] refactor card header
RachelHowellNHS May 14, 2024
f5650b4
[PRMDR-803] add sort by file name method
RachelHowellNHS May 15, 2024
9c4508e
[PRMDR-803] change sort method
RachelHowellNHS May 15, 2024
e5a475d
[PRMDR-803] Edit method of sortByFileName, Some accessibility fix
joefong-nhs May 15, 2024
bb2277e
[PRMDR-803] address sonar cloud issues
RachelHowellNHS May 15, 2024
4e9a31a
[PRMDR-803] add unit test
RachelHowellNHS May 15, 2024
acaf955
[PRMDR-803] Add cypress tests for download file selecting screen
joefong-nhs May 15, 2024
0d2e7e0
[PRMDR-803] fix not passing cypress test
joefong-nhs May 15, 2024
f9cc3e2
Merge branch 'PRMDR-803-b' into PRMDR-803
joefong-nhs May 15, 2024
ede60e6
[PRMDR-803] content changes
RachelHowellNHS May 16, 2024
e3ec035
[PRMDR-803] content changes
RachelHowellNHS May 16, 2024
fa2fcc8
[PRMDR-803] add unit test
RachelHowellNHS May 16, 2024
39e6da3
[PRMDR-803] add unit test
RachelHowellNHS May 16, 2024
6f3bbfa
[PRMDR-803] add unit test
RachelHowellNHS May 16, 2024
01c941a
[PRMDR-803] use test builder
RachelHowellNHS May 16, 2024
32dd4f5
[PRMDR-803] add unit test
RachelHowellNHS May 16, 2024
65320a3
[PRMDR-803] unit tests - WIP
RachelHowellNHS May 16, 2024
f9602f9
[PRMDR-803] update test
RachelHowellNHS May 17, 2024
314cba1
[PRMDR-803] add error response unit test
RachelHowellNHS May 17, 2024
d2a107c
[PRMDR-803] add error response unit test
RachelHowellNHS May 17, 2024
694abc4
[PRMDR-803] amend test name
RachelHowellNHS May 17, 2024
5824a18
[PRMDR-803] remove unused imports
RachelHowellNHS May 17, 2024
4df58cb
[PRMDR-803] add unit tests
RachelHowellNHS May 17, 2024
fffefe2
[PRMDR-803] add unit tests
RachelHowellNHS May 17, 2024
cfb9ffa
[PRMDR-803] add unit tests
RachelHowellNHS May 17, 2024
8491417
[PRMDR-803] update folder name
RachelHowellNHS May 17, 2024
ade148b
[PRMDR-803] remove unused code
RachelHowellNHS May 20, 2024
8b38c52
[PRMDR-803] address UI PR changes - WIP
RachelHowellNHS May 20, 2024
ceddafa
[PRMDR-803] address UI PR changes
RachelHowellNHS May 21, 2024
6123d3d
PR changes
NogaNHS May 21, 2024
dfc20ba
merge main
NogaNHS May 21, 2024
6439c04
update requirement
NogaNHS May 21, 2024
63223da
[PRMDR-803] address PR changes - add comment re util class
RachelHowellNHS May 21, 2024
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 @@ -5,6 +5,32 @@ import { formatNhsNumber } from '../../../../src/helpers/utils/formatNhsNumber';

const baseUrl = Cypress.config('baseUrl');
const searchPatientUrl = '/search/patient';
const downloadPageTitle =
'Download the Lloyd George record for this patient - Digital Lloyd George records';
const downloadingPageTitle = 'Downloading documents - Digital Lloyd George records';
const downloadCompletePageTitle = 'Download complete - Digital Lloyd George records';
const verifyPatientPageTitle = 'Verify patient details - Digital Lloyd George records';
const lloydGeorgeRecordPageTitle = 'Available records - Digital Lloyd George records';
const testFiles = [
{
fileName: '1of2_testy_test.pdf',
created: '2024-05-07T14:52:00.827602Z',
virusScannerResult: 'Clean',
id: 'test-id',
},
{
fileName: '2of2_testy_test.pdf',
created: '2024-05-07T14:52:00.827602Z',
virusScannerResult: 'Clean',
id: 'test-id-2',
},
{
fileName: '1of1_lone_test_file.pdf',
created: '2024-01-01T14:52:00.827602Z',
virusScannerResult: 'Clean',
id: 'test-id-3',
},
];

describe('GP Workflow: View Lloyd George record', () => {
const beforeEachConfiguration = (role) => {
Expand All @@ -21,9 +47,31 @@ describe('GP Workflow: View Lloyd George record', () => {
cy.wait('@search');
};

const proceedToDownloadSelectionPage = () => {
cy.intercept('GET', '/LloydGeorgeStitch*', {
statusCode: 200,
body: viewLloydGeorgePayload,
}).as('lloydGeorgeStitch');

cy.get('#verify-submit').click();
cy.wait('@lloydGeorgeStitch');

cy.intercept('GET', '/DocumentManifest*', {
statusCode: 200,
body: baseUrl + '/browserconfig.xml', // uses public served file in place of a ZIP file
}).as('documentManifest');

cy.intercept('GET', '/SearchDocumentReferences*', {
statusCode: 200,
body: testFiles,
}).as('searchDocumentReferences');

cy.getByTestId('download-all-files-link').click();
};

context('Download Lloyd George document', () => {
it(
'GP ADMIN user can download the Lloyd George document of an active patient',
'GP ADMIN user can download the entire Lloyd George document of an active patient',
{ tags: 'regression' },
() => {
beforeEachConfiguration(Roles.GP_ADMIN);
Expand All @@ -32,44 +80,99 @@ describe('GP Workflow: View Lloyd George record', () => {
statusCode: 200,
body: viewLloydGeorgePayload,
}).as('lloydGeorgeStitch');
cy.title().should('eq', 'Verify patient details - Digital Lloyd George records');
cy.title().should('eq', verifyPatientPageTitle);

cy.get('#verify-submit').click();
cy.wait('@lloydGeorgeStitch');
cy.title().should('eq', 'Available records - Digital Lloyd George records');
cy.title().should('eq', lloydGeorgeRecordPageTitle);

cy.intercept('GET', '/DocumentManifest*', {
statusCode: 200,
body: baseUrl + '/browserconfig.xml', // uses public served file in place of a ZIP file
}).as('documentManifest');

cy.intercept('GET', '/SearchDocumentReferences*', {
statusCode: 200,
body: testFiles,
}).as('searchDocumentReferences');

cy.getByTestId('download-all-files-link').should('exist');
cy.getByTestId('download-all-files-link').click();
cy.title().should('eq', 'Downloading documents - Digital Lloyd George records');

cy.wait('@documentManifest');
// Select documents page
cy.title().should('eq', downloadPageTitle);
cy.wait('@searchDocumentReferences');

cy.getByTestId('patient-summary').should('exist');

cy.getByTestId('available-files-table-title').should('exist');
cy.getByTestId('download-selected-files-btn').should('exist');
cy.getByTestId('download-all-files-btn').should('exist');

cy.getByTestId('start-again-link').should('exist');
cy.getByTestId('download-all-files-btn').click();

cy.title().should('eq', downloadingPageTitle);

// Assert contents of page when downloading
cy.contains('Downloading documents').should('be.visible');
cy.contains(
`Preparing download for ${viewLloydGeorgePayload.number_of_files} files`,
).should('be.visible');
cy.contains('Compressing record into a zip file').should('be.visible');
cy.contains('Cancel').should('be.visible');
cy.getByTestId('lloyd-george-download-header').should('exist');
cy.getByTestId('lloyd-george-download-card-content').should('exist');
cy.getByTestId('cancel-download-link').should('exist');

// Assert contents of page after download
cy.title().should('eq', 'Download complete - Digital Lloyd George records');

cy.contains('Download complete').should('be.visible');
cy.contains('You have successfully downloaded the Lloyd George record of:').should(
'be.visible',
);
cy.title().should('eq', downloadCompletePageTitle);
cy.getByTestId('downloaded-record-card-header').should('exist');
cy.contains(
`${searchPatientPayload.givenName} ${searchPatientPayload.familyName}`,
).should('be.visible');
cy.contains(formatNhsNumber(searchPatientPayload.nhsNumber)).should('be.visible');

// Assert file has been downloaded
cy.readFile(`${Cypress.config('downloadsFolder')}/browserconfig.xml`);

cy.getByTestId('return-btn').click();

// Assert return button returns to pdf view
cy.getByTestId('pdf-card').should('be.visible');
},
);

it(
'GP ADMIN user can selectively download a portion of Lloyd George document of an active patient',
{ tags: 'regression' },
() => {
beforeEachConfiguration(Roles.GP_ADMIN);
proceedToDownloadSelectionPage();

// Select documents page
cy.title().should('eq', downloadPageTitle);
cy.wait('@searchDocumentReferences');

cy.getByTestId('download-selected-files-btn').should('exist');
cy.getByTestId('download-all-files-btn').should('exist');

cy.getByTestId('checkbox-0').should('exist');
cy.getByTestId('checkbox-1').should('exist');
cy.getByTestId('checkbox-2').should('exist');

cy.getByTestId('checkbox-0').click();
cy.getByTestId('checkbox-1').click();

cy.getByTestId('download-selected-files-btn').click();

// Assert contents of page when downloading
cy.title().should('eq', downloadingPageTitle);
cy.getByTestId('lloyd-george-download-header').should('exist');
cy.getByTestId('lloyd-george-download-card-content').should('exist');
cy.getByTestId('cancel-download-link').should('exist');

// Assert contents of page after download
cy.title().should('eq', downloadCompletePageTitle);
cy.getByTestId('downloaded-files-card-header').should('exist');
cy.contains(
`NHS number: ${formatNhsNumber(searchPatientPayload.nhsNumber)}`,
`${searchPatientPayload.givenName} ${searchPatientPayload.familyName}`,
).should('be.visible');
cy.contains(formatNhsNumber(searchPatientPayload.nhsNumber)).should('be.visible');

// Assert file has been downloaded
cy.readFile(`${Cypress.config('downloadsFolder')}/browserconfig.xml`);
Expand All @@ -81,6 +184,29 @@ describe('GP Workflow: View Lloyd George record', () => {
},
);

it(
'should display an alert if user click "Download selected files" without selecting anything',
{ tags: 'regression' },
() => {
beforeEachConfiguration(Roles.GP_ADMIN);
proceedToDownloadSelectionPage();

// Select documents page
cy.title().should('eq', downloadPageTitle);
cy.wait('@searchDocumentReferences');

cy.getByTestId('download-selected-files-btn').should('exist');
cy.getByTestId('download-selected-files-btn').click();

cy.title().should('not.equal', downloadingPageTitle);
cy.title().should('equal', downloadPageTitle);

cy.get('#error-box-summary').should('be.visible');
cy.get('.nhsuk-error-summary__body').should('be.visible');
cy.getByTestId('download-selection-error-box').should('exist');
},
);

it(
'No download option when no Lloyd George record exists for a patient as a GP ADMIN role',
{ tags: 'regression' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ describe('GP Workflow: View Lloyd George record', () => {
// Assert contents of page when downloading
cy.contains('Downloading documents').should('be.visible');
cy.contains(
`Preparing download for ${viewLloydGeorgePayload.number_of_files} files`,
`Preparing download for ${viewLloydGeorgePayload.number_of_files} file(s)`,
).should('be.visible');
cy.contains('Compressing record into a zip file').should('be.visible');
cy.contains('Cancel').should('be.visible');
Expand All @@ -281,7 +281,7 @@ describe('GP Workflow: View Lloyd George record', () => {
// Assert file has been downloaded
cy.readFile(`${Cypress.config('downloadsFolder')}/browserconfig.xml`);

cy.getByTestId('return-btn').should('not.exist');
cy.getByTestId('return-btn').should('exist');
cy.contains('This record has been removed from our storage.').should(
'be.visible',
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('UploadSummary', () => {
name: /All documents have been successfully uploaded on/,
}),
).toBeInTheDocument();
expect(screen.getByText('NHS Number')).toBeInTheDocument();
expect(screen.getByText('NHS number')).toBeInTheDocument();
expect(screen.getByText('Surname')).toBeInTheDocument();
expect(screen.getByText('First name')).toBeInTheDocument();
expect(screen.getByText('Date of birth')).toBeInTheDocument();
Expand Down
Loading
Loading