-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PRMDR-722: Add feature flags e2e tests for ARF and LG workflows (#311)
* [PRMDR-722] add upload feature flags e2e tests * [PRMDR-722] add intercept in case default flag settings change in future * Add feature flags e2e tests for ARF and LG workflows * pr changes --------- Co-authored-by: RachelHowellNHS <rachel.howell6@nhs.net>
- Loading branch information
1 parent
427dabc
commit e7adc49
Showing
6 changed files
with
222 additions
and
10 deletions.
There are no files selected for viewing
102 changes: 102 additions & 0 deletions
102
app/cypress/e2e/0-ndr-core-tests/feature_flag_workflows/arf_workflow.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { Roles, roleName } from '../../../support/roles'; | ||
|
||
const baseUrl = Cypress.config('baseUrl'); | ||
const searchPatientUrl = '/search/patient'; | ||
|
||
const testPatient = '9000000009'; | ||
const patient = { | ||
birthDate: '1970-01-01', | ||
familyName: 'Default Surname', | ||
givenName: ['Default Given Name'], | ||
nhsNumber: testPatient, | ||
postalCode: 'AA1 1AA', | ||
superseded: false, | ||
restricted: false, | ||
active: false, | ||
}; | ||
|
||
const navigateToUploadPage = () => { | ||
cy.intercept('GET', '/SearchPatient*', { | ||
statusCode: 200, | ||
body: patient, | ||
}).as('search'); | ||
|
||
cy.visit(searchPatientUrl); | ||
cy.get('#nhs-number-input').click(); | ||
cy.get('#nhs-number-input').type(testPatient); | ||
|
||
cy.get('#search-submit').click(); | ||
cy.wait('@search'); | ||
|
||
cy.get('#verify-submit').click(); | ||
}; | ||
|
||
const gpRoles = [Roles.GP_ADMIN, Roles.GP_CLINICAL]; | ||
|
||
describe('Feature flags - ARF Workflow', () => { | ||
gpRoles.forEach((role) => { | ||
context(`As a ${roleName(role)} user visiting the ARF page for an inactive patient`, () => { | ||
it( | ||
'displays the page when both feature flags are enabled', | ||
{ tags: 'regression' }, | ||
() => { | ||
cy.login(role); | ||
navigateToUploadPage(); | ||
|
||
cy.url().should('eq', baseUrl + '/patient/upload'); | ||
cy.get('h1').should('not.have.text', 'Unauthorised access'); | ||
}, | ||
); | ||
|
||
it( | ||
'displays the unauthorised page when ARF workflow feature flag is disabled', | ||
{ tags: 'regression' }, | ||
() => { | ||
const featureFlags = { | ||
uploadArfWorkflowEnabled: false, | ||
uploadLambdaEnabled: true, | ||
}; | ||
cy.login(role, true, featureFlags); | ||
navigateToUploadPage(); | ||
|
||
cy.url().should('eq', baseUrl + '/unauthorised'); | ||
cy.get('h1').should('have.text', 'Unauthorised access'); | ||
}, | ||
); | ||
|
||
it( | ||
'displays the unauthorised page when upload lambda feature flag is disabled', | ||
{ tags: 'regression' }, | ||
() => { | ||
const featureFlags = { | ||
uploadArfWorkflowEnabled: true, | ||
uploadLambdaEnabled: false, | ||
}; | ||
|
||
cy.login(role, true, featureFlags); | ||
navigateToUploadPage(); | ||
|
||
cy.url().should('eq', baseUrl + '/unauthorised'); | ||
cy.get('h1').should('have.text', 'Unauthorised access'); | ||
}, | ||
); | ||
|
||
it( | ||
'displays the unauthorised page when both upload and ARF workflow feature flag are disabled', | ||
{ tags: 'regression' }, | ||
() => { | ||
const featureFlags = { | ||
uploadArfWorkflowEnabled: false, | ||
uploadLambdaEnabled: false, | ||
}; | ||
|
||
cy.login(role, true, featureFlags); | ||
navigateToUploadPage(); | ||
|
||
cy.url().should('eq', baseUrl + '/unauthorised'); | ||
cy.get('h1').should('have.text', 'Unauthorised access'); | ||
}, | ||
); | ||
}); | ||
}); | ||
}); |
93 changes: 93 additions & 0 deletions
93
app/cypress/e2e/0-ndr-core-tests/feature_flag_workflows/lloyd_george_workflow.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { Roles } from '../../../support/roles'; | ||
import searchPatientPayload from '../../../fixtures/requests/GET_SearchPatient.json'; | ||
|
||
const beforeEachConfiguration = (role, featureFlags) => { | ||
cy.login(role, true, featureFlags); | ||
cy.intercept('GET', '/SearchPatient*', { | ||
statusCode: 200, | ||
body: searchPatientPayload, | ||
}).as('search'); | ||
cy.getByTestId('nhs-number-input').type(searchPatientPayload.nhsNumber); | ||
cy.getByTestId('search-submit-btn').click(); | ||
cy.wait('@search'); | ||
}; | ||
|
||
describe('Feature flags - Lloyd George Workflow', () => { | ||
context('As a GP admin BSOL user visiting Lloyd George record page', () => { | ||
it( | ||
'displays upload text and button when both upload feature flags are enabled', | ||
{ tags: 'regression' }, | ||
() => { | ||
const featureFlags = { | ||
uploadLloydGeorgeWorkflowEnabled: true, | ||
uploadLambdaEnabled: true, | ||
}; | ||
beforeEachConfiguration(Roles.GP_ADMIN, featureFlags); | ||
cy.intercept('GET', '/LloydGeorgeStitch*', { | ||
statusCode: 404, | ||
}); | ||
cy.get('#verify-submit').click(); | ||
|
||
cy.getByTestId('upload-patient-record-text').should('exist'); | ||
cy.getByTestId('upload-patient-record-button').should('exist'); | ||
}, | ||
); | ||
|
||
it( | ||
'does not display upload text and button when neither upload feature flags are enabled', | ||
{ tags: 'regression' }, | ||
() => { | ||
const featureFlags = { | ||
uploadLloydGeorgeWorkflowEnabled: false, | ||
uploadLambdaEnabled: false, | ||
}; | ||
beforeEachConfiguration(Roles.GP_ADMIN, featureFlags); | ||
cy.intercept('GET', '/LloydGeorgeStitch*', { | ||
statusCode: 404, | ||
}); | ||
cy.get('#verify-submit').click(); | ||
|
||
cy.getByTestId('upload-patient-record-text').should('not.exist'); | ||
cy.getByTestId('upload-patient-record-button').should('not.exist'); | ||
}, | ||
); | ||
|
||
it( | ||
'does not display upload text and button when upload lambda feature flag is not enabled', | ||
{ tags: 'regression' }, | ||
() => { | ||
const featureFlags = { | ||
uploadLloydGeorgeWorkflowEnabled: true, | ||
uploadLambdaEnabled: false, | ||
}; | ||
beforeEachConfiguration(Roles.GP_ADMIN, featureFlags); | ||
cy.intercept('GET', '/LloydGeorgeStitch*', { | ||
statusCode: 404, | ||
}); | ||
cy.get('#verify-submit').click(); | ||
|
||
cy.getByTestId('upload-patient-record-text').should('not.exist'); | ||
cy.getByTestId('upload-patient-record-button').should('not.exist'); | ||
}, | ||
); | ||
|
||
it( | ||
'does not display upload text and button when upload Lloyd George feature flag is not enabled', | ||
{ tags: 'regression' }, | ||
() => { | ||
const featureFlags = { | ||
uploadLloydGeorgeWorkflowEnabled: false, | ||
uploadLambdaEnabled: true, | ||
}; | ||
beforeEachConfiguration(Roles.GP_ADMIN, featureFlags); | ||
cy.intercept('GET', '/LloydGeorgeStitch*', { | ||
statusCode: 404, | ||
}); | ||
cy.get('#verify-submit').click(); | ||
|
||
cy.getByTestId('upload-patient-record-text').should('not.exist'); | ||
cy.getByTestId('upload-patient-record-button').should('not.exist'); | ||
}, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export type FeatureFlags = { | ||
[key: string]: boolean; | ||
}; | ||
|
||
export const defaultFeatureFlags: FeatureFlags = { | ||
uploadLloydGeorgeWorkflowEnabled: true, | ||
uploadArfWorkflowEnabled: true, | ||
uploadLambdaEnabled: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters