Skip to content

Commit 8eaf18f

Browse files
[PRMP-1603] Adjust search error handling and messaging
1 parent 31334f8 commit 8eaf18f

File tree

19 files changed

+426
-163
lines changed

19 files changed

+426
-163
lines changed

app/cypress/e2e/0-ndr-core-tests/auth_routes/auth_gp_clinical_path_access.cy.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ const lloydGeorgeViewUrl = '/patient/lloyd-george-record';
1919
const arfDownloadUrl = '/patient/arf';
2020
const forbiddenRoutes = [arfDownloadUrl];
2121

22-
const bsolOptions = [true];
23-
2422
describe('GP Clinical user role has access to the expected GP_CLINICAL workflow paths', () => {
2523
context(`GP Clinical role has access to expected routes`, () => {
2624
it('GP Clinical role has access to Lloyd George View', { tags: 'regression' }, () => {

app/cypress/e2e/0-ndr-core-tests/feature_flag_workflows/arf_workflow.cy.js

Lines changed: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,74 +30,103 @@ const navigateToUploadPage = () => {
3030

3131
cy.get('#search-submit').click();
3232
cy.wait('@search');
33-
34-
cy.get('#verify-submit').click();
3533
};
3634

3735
const gpRoles = [Roles.GP_ADMIN, Roles.GP_CLINICAL];
3836

3937
describe('Feature flags - ARF Workflow', () => {
38+
it(
39+
'for GP admin it displays the page when both feature flags are enabled',
40+
{ tags: 'regression' },
41+
() => {
42+
cy.login(Roles.GP_ADMIN);
43+
navigateToUploadPage();
44+
cy.get('#verify-submit').click();
45+
46+
cy.url().should('eq', baseUrl + arfUploadUrl);
47+
cy.get('h1').should('not.have.text', 'Unauthorised access');
48+
},
49+
);
50+
51+
it(
52+
'for GP clinical role it does not find patient when both feature flags are enabled',
53+
{ tags: 'regression' },
54+
() => {
55+
cy.login(Roles.GP_CLINICAL);
56+
navigateToUploadPage();
57+
cy.get('#nhs-number-input--error-message').should('be.visible');
58+
cy.get('#nhs-number-input--error-message').should(
59+
'include.text',
60+
"Error: You cannot access this patient's record",
61+
);
62+
cy.get('#error-box-summary').should('be.visible');
63+
cy.get('#error-box-summary').should('have.text', 'There is a problem');
64+
},
65+
);
4066
gpRoles.forEach((role) => {
4167
context(`As a ${roleName(role)} user visiting the ARF page for an inactive patient`, () => {
4268
it(
43-
'displays the page when both feature flags are enabled',
44-
{ tags: 'regression' },
45-
() => {
46-
cy.login(role);
47-
navigateToUploadPage();
48-
49-
cy.url().should('eq', baseUrl + arfUploadUrl);
50-
cy.get('h1').should('not.have.text', 'Unauthorised access');
51-
},
52-
);
53-
54-
it(
55-
'displays the unauthorised page when ARF workflow feature flag is disabled',
69+
'displays the error when ARF workflow feature flag is disabled',
5670
{ tags: 'regression' },
5771
() => {
5872
const featureFlags = {
5973
uploadArfWorkflowEnabled: false,
6074
uploadLambdaEnabled: true,
6175
};
62-
cy.login(role, true, featureFlags);
76+
cy.login(role, featureFlags);
6377
navigateToUploadPage();
6478

65-
cy.url().should('eq', baseUrl + unauthorisedUrl);
66-
cy.get('h1').should('have.text', 'Unauthorised access');
79+
cy.get('#nhs-number-input--error-message').should('be.visible');
80+
cy.get('#nhs-number-input--error-message').should(
81+
'include.text',
82+
"Error: You cannot access this patient's record",
83+
);
84+
cy.get('#error-box-summary').should('be.visible');
85+
cy.get('#error-box-summary').should('have.text', 'There is a problem');
6786
},
6887
);
6988

7089
it(
71-
'displays the unauthorised page when upload lambda feature flag is disabled',
90+
'displays the error page when upload lambda feature flag is disabled',
7291
{ tags: 'regression' },
7392
() => {
7493
const featureFlags = {
7594
uploadArfWorkflowEnabled: true,
7695
uploadLambdaEnabled: false,
7796
};
7897

79-
cy.login(role, true, featureFlags);
98+
cy.login(role, featureFlags);
8099
navigateToUploadPage();
81100

82-
cy.url().should('eq', baseUrl + unauthorisedUrl);
83-
cy.get('h1').should('have.text', 'Unauthorised access');
101+
cy.get('#nhs-number-input--error-message').should('be.visible');
102+
cy.get('#nhs-number-input--error-message').should(
103+
'include.text',
104+
"Error: You cannot access this patient's record",
105+
);
106+
cy.get('#error-box-summary').should('be.visible');
107+
cy.get('#error-box-summary').should('have.text', 'There is a problem');
84108
},
85109
);
86110

87111
it(
88-
'displays the unauthorised page when both upload and ARF workflow feature flag are disabled',
112+
'displays the error page when both upload and ARF workflow feature flag are disabled',
89113
{ tags: 'regression' },
90114
() => {
91115
const featureFlags = {
92116
uploadArfWorkflowEnabled: false,
93117
uploadLambdaEnabled: false,
94118
};
95119

96-
cy.login(role, true, featureFlags);
120+
cy.login(role, featureFlags);
97121
navigateToUploadPage();
98122

99-
cy.url().should('eq', baseUrl + unauthorisedUrl);
100-
cy.get('h1').should('have.text', 'Unauthorised access');
123+
cy.get('#nhs-number-input--error-message').should('be.visible');
124+
cy.get('#nhs-number-input--error-message').should(
125+
'include.text',
126+
"Error: You cannot access this patient's record",
127+
);
128+
cy.get('#error-box-summary').should('be.visible');
129+
cy.get('#error-box-summary').should('have.text', 'There is a problem');
101130
},
102131
);
103132
});

0 commit comments

Comments
 (0)