diff --git a/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/upload_lloyd_george_is_bsol_gp_admin.cy.js b/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/upload_lloyd_george_is_bsol_gp_admin.cy.js index 309014a7b..e50322702 100644 --- a/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/upload_lloyd_george_is_bsol_gp_admin.cy.js +++ b/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/upload_lloyd_george_is_bsol_gp_admin.cy.js @@ -604,5 +604,24 @@ describe('GP Workflow: Upload Lloyd George record when user is GP admin BSOL and cy.url().should('eq', baseUrl + '/patient/upload/lloyd-george-record'); }, ); + it( + `It navigate to error page when uploading Lloyd George record is in progress for the patient`, + { tags: 'regression' }, + () => { + const stubbedResponse = { + statusCode: 423, + data: { err_code: 'LGL_423' }, + }; + + cy.intercept('POST', '**/DocumentReference**', stubbedResponse); + + cy.getByTestId('button-input').selectFile( + uploadedFilePathNames.LG[singleFileUsecaseIndex], + { force: true }, + ); + clickUploadButton(); + cy.contains('Sorry, there is a problem with the service').should('be.visible'); + }, + ); }); }); diff --git a/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_is_bsol_workflow.cy.js b/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_is_bsol_workflow.cy.js index 0aa857a33..da51a5d4c 100644 --- a/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_is_bsol_workflow.cy.js +++ b/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_is_bsol_workflow.cy.js @@ -56,10 +56,10 @@ describe('GP Workflow: View Lloyd George record', () => { }; gpRoles.forEach((role) => { - beforeEach(() => { - beforeEachConfiguration(role); - }); context(`View Lloyd George document for ${roleName(role)} role`, () => { + beforeEach(() => { + beforeEachConfiguration(role); + }); it( roleName(role) + ' can view a Lloyd George document of an active patient', { tags: 'regression' }, @@ -98,22 +98,25 @@ describe('GP Workflow: View Lloyd George record', () => { ); it( - `It displays an empty Lloyd George card when no Lloyd George record exists for the patient for a ${roleName( + `It displays an waiting message when uploading Lloyd George record is in progress for the patient for a ${roleName( role, )}`, { tags: 'regression' }, () => { cy.intercept('GET', '/LloydGeorgeStitch*', { - statusCode: 404, + statusCode: 423, }); cy.get('#verify-submit').click(); // Assert assertPatientInfo(); - assertEmptyLloydGeorgeCard(); + cy.getByTestId('pdf-card').should('include.text', 'Lloyd George record'); + cy.getByTestId('pdf-card').should( + 'include.text', + 'You can view this record once it’s finished uploading. This may take a few minutes.', + ); }, ); - it( `It displays an error when the Lloyd George Stitch API call fails for a ${roleName( role, @@ -147,7 +150,39 @@ describe('GP Workflow: View Lloyd George record', () => { assertTimeoutLloydGeorgeError(true); }, ); + it( + `It displays an empty Lloyd George card when no Lloyd George record exists for the patient for a GP_CLINICAL`, + { tags: 'regression' }, + () => { + beforeEachConfiguration(Roles.GP_CLINICAL); + cy.intercept('GET', '/LloydGeorgeStitch*', { + statusCode: 404, + }); + cy.get('#verify-submit').click(); + // Assert + assertPatientInfo(); + assertEmptyLloydGeorgeCard(); + }, + ); + it( + `It displays an upload button when no Lloyd George record exists for the patient for a GP_ADMIN`, + { tags: 'regression' }, + () => { + beforeEachConfiguration(Roles.GP_ADMIN); + + cy.intercept('GET', '/LloydGeorgeStitch*', { + statusCode: 404, + }); + cy.get('#verify-submit').click(); + // Assert + assertPatientInfo(); + cy.getByTestId('pdf-card').should('include.text', 'Lloyd George record'); + cy.getByTestId('no-records-title').should('be.visible'); + cy.getByTestId('upload-patient-record-text').should('be.visible'); + cy.getByTestId('upload-patient-record-button').should('be.visible'); + }, + ); it( 'It displays an error with download link when a Lloyd George stitching timeout occurs via the API Gateway for a GP_CLINICAL but link access is denied', { tags: 'regression' }, diff --git a/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_not_bsol_workflow.cy.js b/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_not_bsol_workflow.cy.js index 1f8110616..c09d80ba9 100644 --- a/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_not_bsol_workflow.cy.js +++ b/app/cypress/e2e/0-ndr-core-tests/gp_user_workflows/view_lloyd_george_not_bsol_workflow.cy.js @@ -124,7 +124,26 @@ describe('GP Workflow: View Lloyd George record', () => { assertEmptyLloydGeorgeCard(); }, ); + it( + `It displays an waiting message when uploading Lloyd George record is in progress for the patient for a ${roleName( + role, + )}`, + { tags: 'regression' }, + () => { + cy.intercept('GET', '/LloydGeorgeStitch*', { + statusCode: 423, + }); + cy.get('#verify-submit').click(); + // Assert + assertPatientInfo(); + cy.getByTestId('pdf-card').should('include.text', 'Lloyd George record'); + cy.getByTestId('pdf-card').should( + 'include.text', + 'You can view this record once it’s finished uploading. This may take a few minutes.', + ); + }, + ); it( `It displays an error when the Lloyd George Stitch API call fails for a ${roleName( role,