@@ -6,14 +6,14 @@ const workspace = Cypress.env('WORKSPACE');
66const baseUrl = Cypress . config ( 'baseUrl' ) ;
77
88const uploadedFilePathNames = [
9- 'cypress/fixtures/lg-files/zenia_lees/1of3_Lloyd_George_Record_[Zenia Ellisa LEES]_[9730153930]_[20-03-1929].pdf' ,
10- 'cypress/fixtures/lg-files/zenia_lees/2of3_Lloyd_George_Record_[Zenia Ellisa LEES]_[9730153930]_[20-03-1929].pdf' ,
11- 'cypress/fixtures/lg-files/zenia_lees/3of3_Lloyd_George_Record_[Zenia Ellisa LEES]_[9730153930]_[20-03-1929].pdf' ,
9+ 'cypress/fixtures/lg-files/zenia_lees/1of3_Lloyd_George_Record_[Zenia Ellisa LEES]_[9730153930]_[20-03-1929].pdf' ,
10+ 'cypress/fixtures/lg-files/zenia_lees/2of3_Lloyd_George_Record_[Zenia Ellisa LEES]_[9730153930]_[20-03-1929].pdf' ,
11+ 'cypress/fixtures/lg-files/zenia_lees/3of3_Lloyd_George_Record_[Zenia Ellisa LEES]_[9730153930]_[20-03-1929].pdf' ,
1212] ;
1313const uploadedFileNames = [
14- '1of3_Lloyd_George_Record_[Zenia Ellisa LEES]_[9730153930]_[20-03-1929].pdf' ,
15- '2of3_Lloyd_George_Record_[Zenia Ellisa LEES]_[9730153930]_[20-03-1929].pdf' ,
16- '3of3_Lloyd_George_Record_[Zenia Ellisa LEES]_[9730153930]_[20-03-1929].pdf' ,
14+ '1of3_Lloyd_George_Record_[Zenia Ellisa LEES]_[9730153930]_[20-03-1929].pdf' ,
15+ '2of3_Lloyd_George_Record_[Zenia Ellisa LEES]_[9730153930]_[20-03-1929].pdf' ,
16+ '3of3_Lloyd_George_Record_[Zenia Ellisa LEES]_[9730153930]_[20-03-1929].pdf' ,
1717] ;
1818
1919const bucketName = `${ workspace } -lloyd-george-store` ;
@@ -28,108 +28,111 @@ const confirmationUrl = '/patient/document-upload/confirmation';
2828const activePatient = pdsPatients . activeNoUpload ;
2929
3030describe ( 'GP Workflow: Upload Lloyd George record' , ( ) => {
31- context ( 'Upload a Lloyd George document' , ( ) => {
32- beforeEach ( ( ) => {
33- //delete any records present for the active patient
34- cy . deleteItemsBySecondaryKeyFromDynamoDb (
35- referenceTableName ,
36- 'NhsNumberIndex' ,
37- 'NhsNumber' ,
38- activePatient . toString ( ) ,
39- ) ;
40- cy . deleteItemsBySecondaryKeyFromDynamoDb (
41- stitchTableName ,
42- 'NhsNumberIndex' ,
43- 'NhsNumber' ,
44- activePatient . toString ( )
45- ) ;
46- uploadedFileNames . forEach ( ( file ) => {
47- cy . deleteFileFromS3 ( bucketName , file ) ;
48- } ) ;
49- } ) ;
50-
51- afterEach ( ( ) => {
52- //clean up any records present for the active patient
53- cy . deleteItemsBySecondaryKeyFromDynamoDb (
54- referenceTableName ,
55- 'NhsNumberIndex' ,
56- 'NhsNumber' ,
57- activePatient . toString ( ) ,
58- ) ;
59- cy . deleteItemsBySecondaryKeyFromDynamoDb (
60- stitchTableName ,
61- 'NhsNumberIndex' ,
62- 'NhsNumber' ,
63- activePatient . toString ( )
64- ) ;
65- uploadedFileNames . forEach ( ( file ) => {
66- cy . deleteFileFromS3 ( bucketName , file ) ;
67- } ) ;
68- } ) ;
69-
70- it (
71- '[Smoke] GP ADMIN can upload multiple files and then view a Lloyd George record for an active patient with no record' ,
72- { tags : 'smoke' , defaultCommandTimeout : 20000 } ,
73- ( ) => {
74- cy . smokeLogin ( Roles . SMOKE_GP_ADMIN ) ;
75-
76- cy . navigateToPatientSearchPage ( ) ;
77-
78- cy . get ( '#nhs-number-input' ) . should ( 'exist' ) ;
79- cy . get ( '#nhs-number-input' ) . click ( ) ;
80- cy . get ( '#nhs-number-input' ) . type ( activePatient ) ;
81- cy . getByTestId ( 'search-submit-btn' ) . should ( 'exist' ) ;
82- cy . getByTestId ( 'search-submit-btn' ) . click ( ) ;
83-
84- cy . url ( { timeout : 15000 } ) . should ( 'contain' , patientVerifyUrl ) ;
85-
86- cy . get ( '#verify-submit' ) . should ( 'exist' ) ;
87- cy . get ( '#verify-submit' ) . click ( ) ;
88-
89- cy . url ( ) . should ( 'contain' , lloydGeorgeRecordUrl ) ;
90- cy . getByTestId ( 'no-records-title' ) . should (
91- 'include.text' ,
92- 'This patient does not have a Lloyd George record' ,
93- ) ;
94- cy . getByTestId ( 'upload-patient-record-button' ) . should ( 'exist' ) ;
95- cy . getByTestId ( 'upload-patient-record-button' ) . click ( ) ;
96- uploadedFilePathNames . forEach ( ( file ) => {
97- cy . getByTestId ( 'button-input' ) . selectFile ( file , { force : true } ) ;
98- var index = uploadedFilePathNames . indexOf ( file ) ;
99- cy . get ( '#selected-documents-table' ) . should ( 'contain' , uploadedFileNames [ index ] ) ;
31+ context ( 'Upload a Lloyd George document' , ( ) => {
32+ beforeEach ( ( ) => {
33+ //delete any records present for the active patient
34+ cy . deleteItemsBySecondaryKeyFromDynamoDb (
35+ referenceTableName ,
36+ 'NhsNumberIndex' ,
37+ 'NhsNumber' ,
38+ activePatient . toString ( ) ,
39+ ) ;
40+ cy . deleteItemsBySecondaryKeyFromDynamoDb (
41+ stitchTableName ,
42+ 'NhsNumberIndex' ,
43+ 'NhsNumber' ,
44+ activePatient . toString ( ) ,
45+ ) ;
46+ uploadedFileNames . forEach ( ( file ) => {
47+ cy . deleteFileFromS3 ( bucketName , file ) ;
48+ } ) ;
10049 } ) ;
101- cy . get ( '#continue-button' ) . click ( ) ;
10250
103- cy . url ( ) . should ( 'contain' , selectOrderUrl ) ;
104- cy . get ( '#selected-documents-table' ) . should ( 'exist' ) ;
105- uploadedFileNames . forEach ( ( name ) => {
106- cy . get ( '#selected-documents-table' ) . should ( 'contain' , name ) ;
51+ afterEach ( ( ) => {
52+ //clean up any records present for the active patient
53+ cy . deleteItemsBySecondaryKeyFromDynamoDb (
54+ referenceTableName ,
55+ 'NhsNumberIndex' ,
56+ 'NhsNumber' ,
57+ activePatient . toString ( ) ,
58+ ) ;
59+ cy . deleteItemsBySecondaryKeyFromDynamoDb (
60+ stitchTableName ,
61+ 'NhsNumberIndex' ,
62+ 'NhsNumber' ,
63+ activePatient . toString ( ) ,
64+ ) ;
65+ uploadedFileNames . forEach ( ( file ) => {
66+ cy . deleteFileFromS3 ( bucketName , file ) ;
67+ } ) ;
10768 } ) ;
108- cy . getByTestId ( 'form-submit-button' ) . click ( ) ;
10969
110- cy . url ( ) . should ( 'contain' , confirmationUrl ) ;
111- uploadedFileNames . forEach ( ( name ) => {
112- cy . get ( '#selected-documents-table' ) . should ( 'contain' , name ) ;
113- } ) ;
114- cy . getByTestId ( 'confirm-button' ) . click ( ) ;
115-
116- cy . getByTestId ( 'upload-complete-page' , { timeout : 25000 } ) . should ( 'exist' ) ;
117- cy . getByTestId ( 'upload-complete-page' )
118- . should ( 'include.text' , 'You have successfully uploaded a digital Lloyd George record for' ) ;
119-
120- cy . getByTestId ( 'upload-complete-card' ) . should ( 'be.visible' ) ;
121-
122- cy . getByTestId ( 'home-btn' ) . eq ( 1 ) . click ( ) ;
123-
124- cy . navigateToPatientSearchPage ( ) ;
125-
126- cy . get ( '#nhs-number-input' ) . type ( activePatient ) ;
127- cy . get ( '#search-submit' ) . click ( ) ;
128- cy . wait ( 5000 )
129-
130- cy . get ( '.patient-results-form' ) . submit ( ) ;
131-
132- cy . get ( "#pdf-viewer" , { timeout : 20000 } ) . should ( 'exist' ) ;
133- } ) ;
134- } ) ;
70+ it (
71+ '[Smoke] GP ADMIN can upload multiple files and then view a Lloyd George record for an active patient with no record' ,
72+ { tags : 'smoke' , defaultCommandTimeout : 20000 } ,
73+ ( ) => {
74+ cy . smokeLogin ( Roles . SMOKE_GP_ADMIN ) ;
75+
76+ cy . navigateToPatientSearchPage ( ) ;
77+
78+ cy . get ( '#nhs-number-input' ) . should ( 'exist' ) ;
79+ cy . get ( '#nhs-number-input' ) . click ( ) ;
80+ cy . get ( '#nhs-number-input' ) . type ( activePatient ) ;
81+ cy . getByTestId ( 'search-submit-btn' ) . should ( 'exist' ) ;
82+ cy . getByTestId ( 'search-submit-btn' ) . click ( ) ;
83+
84+ cy . url ( { timeout : 15000 } ) . should ( 'contain' , patientVerifyUrl ) ;
85+
86+ cy . get ( '#verify-submit' ) . should ( 'exist' ) ;
87+ cy . get ( '#verify-submit' ) . click ( ) ;
88+
89+ cy . url ( ) . should ( 'contain' , lloydGeorgeRecordUrl ) ;
90+ cy . getByTestId ( 'no-records-title' ) . should (
91+ 'include.text' ,
92+ 'This patient does not have a Lloyd George record' ,
93+ ) ;
94+ cy . getByTestId ( 'upload-patient-record-button' ) . should ( 'exist' ) ;
95+ cy . getByTestId ( 'upload-patient-record-button' ) . click ( ) ;
96+ uploadedFilePathNames . forEach ( ( file ) => {
97+ cy . getByTestId ( 'button-input' ) . selectFile ( file , { force : true } ) ;
98+ var index = uploadedFilePathNames . indexOf ( file ) ;
99+ cy . get ( '#selected-documents-table' ) . should ( 'contain' , uploadedFileNames [ index ] ) ;
100+ } ) ;
101+ cy . get ( '#continue-button' ) . click ( ) ;
102+
103+ cy . url ( ) . should ( 'contain' , selectOrderUrl ) ;
104+ cy . get ( '#selected-documents-table' ) . should ( 'exist' ) ;
105+ uploadedFileNames . forEach ( ( name ) => {
106+ cy . get ( '#selected-documents-table' ) . should ( 'contain' , name ) ;
107+ } ) ;
108+ cy . getByTestId ( 'form-submit-button' ) . click ( ) ;
109+
110+ cy . url ( ) . should ( 'contain' , confirmationUrl ) ;
111+ uploadedFileNames . forEach ( ( name ) => {
112+ cy . get ( '#selected-documents-table' ) . should ( 'contain' , name ) ;
113+ } ) ;
114+ cy . getByTestId ( 'confirm-button' ) . click ( ) ;
115+
116+ cy . getByTestId ( 'upload-complete-page' , { timeout : 25000 } ) . should ( 'exist' ) ;
117+ cy . getByTestId ( 'upload-complete-page' ) . should (
118+ 'include.text' ,
119+ 'You have successfully uploaded a digital Lloyd George record for' ,
120+ ) ;
121+
122+ cy . getByTestId ( 'upload-complete-card' ) . should ( 'be.visible' ) ;
123+
124+ cy . getByTestId ( 'home-btn' ) . eq ( 1 ) . click ( ) ;
125+
126+ cy . navigateToPatientSearchPage ( ) ;
127+
128+ cy . get ( '#nhs-number-input' ) . type ( activePatient ) ;
129+ cy . get ( '#search-submit' ) . click ( ) ;
130+ cy . wait ( 5000 ) ;
131+
132+ cy . get ( '.patient-results-form' ) . submit ( ) ;
133+
134+ cy . get ( '#pdf-viewer' , { timeout : 20000 } ) . should ( 'exist' ) ;
135+ } ,
136+ ) ;
137+ } ) ;
135138} ) ;
0 commit comments