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.
Merge typescript-template into repo (#66)
Merge in typescript template updates
- Loading branch information
1 parent
19ba19c
commit 8c8d5c4
Showing
44 changed files
with
791 additions
and
430 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 @@ | ||
window.MOJFrontend.initAll() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
--- | ||
# Per environment values which override defaults in hmpps-authorization/values.yaml | ||
|
||
generic-service: | ||
|
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
--- | ||
# Per environment values which override defaults in hmpps-authorization/values.yaml | ||
|
||
generic-service: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import IndexPage from '../pages/index' | ||
import AuthSignInPage from '../pages/authSignIn' | ||
import Page from '../pages/page' | ||
import AuthManageDetailsPage from '../pages/authManageDetails' | ||
|
||
context('Sign In', () => { | ||
beforeEach(() => { | ||
cy.task('reset') | ||
cy.task('stubSignIn') | ||
cy.task('stubManageUser') | ||
cy.task('stubListBaseClients') | ||
}) | ||
|
||
it('Unauthenticated user directed to auth', () => { | ||
cy.visit('/') | ||
Page.verifyOnPage(AuthSignInPage) | ||
}) | ||
|
||
it('Unauthenticated user navigating to sign in page directed to auth', () => { | ||
cy.visit('/sign-in') | ||
Page.verifyOnPage(AuthSignInPage) | ||
}) | ||
|
||
it('User name visible in header', () => { | ||
cy.signIn() | ||
const indexPage = Page.verifyOnPage(IndexPage) | ||
indexPage.headerUserName().should('contain.text', 'J. Smith') | ||
}) | ||
|
||
it('Phase banner visible in header', () => { | ||
cy.signIn() | ||
const indexPage = Page.verifyOnPage(IndexPage) | ||
indexPage.headerPhaseBanner().should('contain.text', 'dev') | ||
}) | ||
|
||
it('User can sign out', () => { | ||
cy.signIn() | ||
const indexPage = Page.verifyOnPage(IndexPage) | ||
indexPage.signOut().click() | ||
Page.verifyOnPage(AuthSignInPage) | ||
}) | ||
|
||
it('User can manage their details', () => { | ||
cy.signIn() | ||
cy.task('stubAuthManageDetails') | ||
const indexPage = Page.verifyOnPage(IndexPage) | ||
|
||
indexPage.manageDetails().get('a').invoke('removeAttr', 'target') | ||
indexPage.manageDetails().click() | ||
Page.verifyOnPage(AuthManageDetailsPage) | ||
}) | ||
|
||
it('Token verification failure takes user to sign in page', () => { | ||
cy.signIn() | ||
Page.verifyOnPage(IndexPage) | ||
cy.task('stubVerifyToken', false) | ||
|
||
// can't do a visit here as cypress requires only one domain | ||
cy.request('/').its('body').should('contain', 'Sign in') | ||
}) | ||
|
||
it('Token verification failure clears user session', () => { | ||
cy.signIn() | ||
const indexPage = Page.verifyOnPage(IndexPage) | ||
cy.task('stubVerifyToken', false) | ||
|
||
// can't do a visit here as cypress requires only one domain | ||
cy.request('/').its('body').should('contain', 'Sign in') | ||
|
||
cy.task('stubVerifyToken', true) | ||
cy.task('stubManageUser', 'bobby brown') | ||
cy.signIn() | ||
|
||
indexPage.headerUserName().contains('B. Brown') | ||
}) | ||
}) |
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
Oops, something went wrong.