generated from ministryofjustice/hmpps-template-typescript
-
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.
CDPS-161 - Conditionally show content on the banner based on users ca…
…seload (#125) * Conditionally show content on the banner based on users caseload * Update tests with new auth setup
- Loading branch information
1 parent
af76d14
commit 60ec8cb
Showing
14 changed files
with
143 additions
and
57 deletions.
There are no files selected for viewing
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
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,43 @@ | ||
import Page from '../pages/page' | ||
import OverviewPage from '../pages/overviewPage' | ||
|
||
const visitOverviewPage = (): OverviewPage => { | ||
cy.signIn({ redirectPath: '/prisoner/G6123VU' }) | ||
return Page.verifyOnPage(OverviewPage) | ||
} | ||
|
||
context('Profile banner', () => { | ||
context('Given the prisoner is not within the users caseload', () => { | ||
context('Given the user has the GLOBAL_SEARCH role', () => { | ||
beforeEach(() => { | ||
cy.task('reset') | ||
cy.setupUserAuth({ | ||
roles: ['ROLE_GLOBAL_SEARCH'], | ||
caseLoads: [{ caseloadFunction: '', caseLoadId: '123', currentlyActive: true, description: '', type: '' }], | ||
}) | ||
cy.setupOverviewPageStubs({ prisonerNumber: 'G6123VU', bookingId: '1102484' }) | ||
}) | ||
|
||
it('Displays the banner', () => { | ||
visitOverviewPage() | ||
cy.getDataQa('visible-outside-establishment-banner').should('exist') | ||
}) | ||
}) | ||
}) | ||
|
||
context('Given the prisoner is within the users caseload', () => { | ||
beforeEach(() => { | ||
cy.task('reset') | ||
cy.setupUserAuth({ | ||
roles: ['ROLE_PRISON'], | ||
caseLoads: [{ caseloadFunction: '', caseLoadId: 'MDI', currentlyActive: true, description: '', type: '' }], | ||
}) | ||
cy.setupOverviewPageStubs({ prisonerNumber: 'G6123VU', bookingId: '1102484' }) | ||
}) | ||
|
||
it('Hides the banner', () => { | ||
visitOverviewPage() | ||
cy.getDataQa('hidden-outside-establishment-banner').should('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
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
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
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