Skip to content

Commit 08bebec

Browse files
use document type enum
1 parent e28c843 commit 08bebec

File tree

2 files changed

+7
-202
lines changed

2 files changed

+7
-202
lines changed

app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_workflow.cy.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import viewLloydGeorgePayload from '../../../fixtures/requests/GET_LloydGeorgeSt
22
import searchPatientPayload from '../../../fixtures/requests/GET_SearchPatient.json';
33
import { Roles, roleName } from '../../../support/roles';
44
import { formatNhsNumber } from '../../../../src/helpers/utils/formatNhsNumber';
5+
import { DOCUMENT_TYPE } from '../../../../src/helpers/utils/documentType';
56

67
const baseUrl = Cypress.config('baseUrl');
78
const gpRoles = [Roles.GP_ADMIN, Roles.GP_CLINICAL];
@@ -294,7 +295,7 @@ describe('GP Workflow: View Lloyd George record', () => {
294295

295296
cy.intercept(
296297
'DELETE',
297-
`/DocumentDelete?patientId=${searchPatientPayload.nhsNumber}&docType=16521000000101`,
298+
`/DocumentDelete?patientId=${searchPatientPayload.nhsNumber}&docType=${DOCUMENT_TYPE.LLOYD_GEORGE}`,
298299
{
299300
statusCode: 200,
300301
body: 'Success',
@@ -384,7 +385,7 @@ describe('GP Workflow: View Lloyd George record', () => {
384385

385386
cy.intercept(
386387
'DELETE',
387-
`/DocumentDelete?patientId=${searchPatientPayload.nhsNumber}&docType=16521000000101`,
388+
`/DocumentDelete?patientId=${searchPatientPayload.nhsNumber}&docType=${DOCUMENT_TYPE.LLOYD_GEORGE}`,
388389
{
389390
statusCode: 500,
390391
body: 'Failed to delete documents',

app/cypress/e2e/0-ndr-core-tests/pcse_user_workflows/download_patient_files_workflow.cy.js

Lines changed: 4 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,10 @@
11
import searchPatientPayload from '../../../fixtures/requests/GET_SearchPatient.json';
22
import { Roles } from '../../../support/roles';
33
import { formatNhsNumber } from '../../../../src/helpers/utils/formatNhsNumber';
4+
import { DOCUMENT_TYPE } from '../../../../src/helpers/utils/documentType';
45

56
describe('PCSE Workflow: Access and download found files', () => {
6-
// env vars
7-
const baseUrl = Cypress.config('baseUrl');
8-
9-
const roles = Object.freeze({
10-
GP: 'GP_ADMIN',
11-
PCSE: 'PCSE',
12-
});
13-
147
const testPatient = '9000000009';
15-
const patient = {
16-
birthDate: new Date('1970-01-01'),
17-
familyName: 'Default Surname',
18-
givenName: ['Default Given Name'],
19-
nhsNumber: testPatient,
20-
postalCode: 'AA1 1AA',
21-
superseded: false,
22-
restricted: false,
23-
deceased: false,
24-
};
258

269
const searchDocumentReferencesResponse = [
2710
{
@@ -43,185 +26,6 @@ describe('PCSE Workflow: Access and download found files', () => {
4326
cy.navigateToPatientSearchPage();
4427
});
4528

46-
const navigateToVerify = () => {
47-
cy.intercept('GET', '/SearchPatient*', {
48-
statusCode: 200,
49-
body: patient,
50-
}).as('search');
51-
52-
cy.getByTestId('nhs-number-input').click();
53-
cy.getByTestId('nhs-number-input').type(testPatient);
54-
cy.getByTestId('search-submit-btn').click();
55-
cy.wait('@search');
56-
};
57-
58-
const navigateToDownload = () => {
59-
navigateToVerify();
60-
cy.get('#verify-submit').click();
61-
};
62-
63-
// it('shows patient details on download page', { tags: 'regression' }, () => {
64-
// navigateToDownload();
65-
66-
// cy.get('#download-page-title').should('have.length', 1);
67-
// cy.get('#patient-details-nhs-number').should('have.text', patient.nhsNumber);
68-
// cy.get('#patient-details-family-name').should('have.text', patient.familyName);
69-
70-
// const givenName = patient.givenName[0];
71-
// cy.get('#patient-details-given-name').should('have.text', givenName + ' ');
72-
// cy.get('#patient-details-date-of-birth').should(
73-
// 'have.text',
74-
// patient.birthDate.toLocaleDateString('en-GB', {
75-
// day: '2-digit',
76-
// month: 'long',
77-
// year: 'numeric',
78-
// }),
79-
// );
80-
// cy.get('#patient-details-postcode').should('have.text', patient.postalCode);
81-
// });
82-
83-
// it('shows no files avaliable on 204 success', { tags: 'regression' }, () => {
84-
// const searchDocumentReferencesResponse = [];
85-
86-
// cy.intercept('GET', '/SearchDocumentReferences*', {
87-
// statusCode: 204,
88-
// body: searchDocumentReferencesResponse,
89-
// }).as('search');
90-
91-
// navigateToDownload(roles.PCSE);
92-
93-
// cy.get('#no-files-message').should('have.length', 1);
94-
// cy.get('#no-files-message').should(
95-
// 'have.text',
96-
// 'There are no documents available for this patient.',
97-
// );
98-
// });
99-
100-
// it('shows avaliable files to download on 200 success', { tags: 'regression' }, () => {
101-
// cy.intercept('GET', '/SearchDocumentReferences*', {
102-
// statusCode: 200,
103-
// body: searchDocumentReferencesResponse,
104-
// }).as('search');
105-
106-
// navigateToDownload(roles.PCSE);
107-
108-
// cy.get('#available-files-table-title').should('have.length', 1);
109-
110-
// cy.get('.available-files-row').should('have.length', 2);
111-
// cy.get('#available-files-row-0-filename').should(
112-
// 'have.text',
113-
// searchDocumentReferencesResponse[1].fileName,
114-
// );
115-
// cy.get('#available-files-row-1-filename').should(
116-
// 'have.text',
117-
// searchDocumentReferencesResponse[0].fileName,
118-
// );
119-
120-
// cy.get('#available-files-row-0-created-date').should('exist');
121-
// cy.get('#available-files-row-1-created-date').should('exist');
122-
123-
// // We cannot test datetimes of a created s3 bucket object easily on a live instance, therefore
124-
125-
// cy.get('#available-files-row-0-created-date').should(
126-
// 'have.text',
127-
// searchDocumentReferencesResponse[1].created.toLocaleDateString('en-GB', {
128-
// day: '2-digit',
129-
// month: 'long',
130-
// year: 'numeric',
131-
// hour: 'numeric',
132-
// minute: 'numeric',
133-
// second: 'numeric',
134-
// }),
135-
// );
136-
// cy.get('#available-files-row-1-created-date').should(
137-
// 'have.text',
138-
// searchDocumentReferencesResponse[0].created.toLocaleDateString('en-GB', {
139-
// day: '2-digit',
140-
// month: 'long',
141-
// year: 'numeric',
142-
// hour: 'numeric',
143-
// minute: 'numeric',
144-
// second: 'numeric',
145-
// }),
146-
// );
147-
// });
148-
149-
// it(
150-
// 'Shows spinner button while waiting for Download Document Manifest response',
151-
// { tags: 'regression' },
152-
// () => {
153-
// cy.intercept('GET', '/SearchDocumentReferences*', {
154-
// statusCode: 200,
155-
// body: searchDocumentReferencesResponse,
156-
// }).as('search');
157-
158-
// navigateToDownload(roles.PCSE);
159-
160-
// const documentManifestResponse = 'test-s3-url';
161-
// cy.intercept({ url: '/DocumentManifest*', middleware: true }, (req) => {
162-
// req.reply({
163-
// statusCode: 200,
164-
// body: documentManifestResponse,
165-
// delay: 1500,
166-
// });
167-
// }).as('search');
168-
169-
// cy.get('#download-documents').click();
170-
// cy.get('#download-spinner').should('exist');
171-
// },
172-
// );
173-
174-
// it(
175-
// 'Shows service error box on Search Document Reference 500 response',
176-
// { tags: 'regression' },
177-
// () => {
178-
// cy.intercept('GET', '/SearchDocumentReferences*', {
179-
// statusCode: 500,
180-
// }).as('search');
181-
182-
// navigateToDownload(roles.PCSE);
183-
184-
// cy.contains('Sorry, there is a problem with the service').should('be.visible');
185-
// },
186-
// );
187-
188-
// it(
189-
// 'Shows progress bar while waiting for Search Document Reference response',
190-
// { tags: 'regression' },
191-
// () => {
192-
// const searchDocumentReferencesResponse = [];
193-
194-
// cy.intercept({ url: '/SearchDocumentReferences*', middleware: true }, (req) => {
195-
// req.reply({
196-
// statusCode: 204,
197-
// body: searchDocumentReferencesResponse,
198-
// delay: 1500,
199-
// });
200-
// }).as('search');
201-
202-
// navigateToDownload(roles.PCSE);
203-
204-
// cy.get('.progress-bar').should('exist');
205-
// },
206-
// );
207-
208-
// it('Start again button takes us to the home page', { tags: 'regression' }, () => {
209-
// const searchDocumentReferencesResponse = [];
210-
211-
// cy.intercept({ url: '/SearchDocumentReferences*', middleware: true }, (req) => {
212-
// req.reply({
213-
// statusCode: 204,
214-
// body: searchDocumentReferencesResponse,
215-
// });
216-
// }).as('search');
217-
218-
// navigateToDownload(roles.PCSE);
219-
220-
// cy.get('#start-again-link').should('exist');
221-
// cy.get('#start-again-link').click();
222-
// cy.url().should('eq', baseUrl + homeUrl);
223-
// });
224-
22529
context('Delete all documents relating to a patient', () => {
22630
beforeEach(() => {
22731
cy.intercept('GET', '/SearchPatient*', {
@@ -250,7 +54,7 @@ describe('PCSE Workflow: Access and download found files', () => {
25054
() => {
25155
cy.intercept(
25256
'DELETE',
253-
`/DocumentDelete?patientId=${searchPatientPayload.nhsNumber}&docType=16521000000101,16521000000102,16521000000103,16521000000104`,
57+
`/DocumentDelete?patientId=${searchPatientPayload.nhsNumber}&docType=${DOCUMENT_TYPE.ALL}`,
25458
{
25559
statusCode: 200,
25660
body: 'Success',
@@ -295,7 +99,7 @@ describe('PCSE Workflow: Access and download found files', () => {
29599
() => {
296100
cy.intercept(
297101
'DELETE',
298-
`/DocumentDelete?patientId=${searchPatientPayload.nhsNumber}&docType=16521000000101,16521000000102,16521000000103,16521000000104`,
102+
`/DocumentDelete?patientId=${searchPatientPayload.nhsNumber}&docType=${DOCUMENT_TYPE.ALL}`,
299103
{
300104
statusCode: 500,
301105
body: 'Failed to delete documents',
@@ -319,7 +123,7 @@ describe('PCSE Workflow: Access and download found files', () => {
319123
() => {
320124
cy.intercept(
321125
'DELETE',
322-
`/DocumentDelete?patientId=${searchPatientPayload.nhsNumber}&docType=16521000000101,16521000000102,16521000000103,16521000000104`,
126+
`/DocumentDelete?patientId=${searchPatientPayload.nhsNumber}&docType=${DOCUMENT_TYPE.ALL}`,
323127
{
324128
statusCode: 404,
325129
body: 'No documents available',

0 commit comments

Comments
 (0)