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.
Browse files
Browse the repository at this point in the history
* RASS-296 overall conviction date page * updated mapping to include overall conviction date * content fix * corrected variable name
- Loading branch information
1 parent
422d8bd
commit 31289c5
Showing
10 changed files
with
821 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import dayjs from 'dayjs' | ||
import CourtCaseOverallConvictionDatePage from '../pages/courtCaseOverallConvictionDatePage' | ||
import Page from '../pages/page' | ||
|
||
context('Court Case Overall Conviction Date Page', () => { | ||
let courtCaseOverallConvictionDatePage: CourtCaseOverallConvictionDatePage | ||
beforeEach(() => { | ||
cy.task('happyPathStubs') | ||
cy.signIn() | ||
cy.visit('/person/A1234AB/add-court-case/0/add-court-appearance/0/overall-conviction-date') | ||
courtCaseOverallConvictionDatePage = Page.verifyOnPage(CourtCaseOverallConvictionDatePage) | ||
}) | ||
|
||
it('displays person details', () => { | ||
courtCaseOverallConvictionDatePage | ||
.prisonerBanner() | ||
.should('contain.text', 'Haggler, Marvin') | ||
.and('contain.text', 'A1234AB') | ||
.and('contain.text', 'EstablishmentHMP Bedford') | ||
.and('contain.text', 'Cell numberCELL-1') | ||
}) | ||
|
||
it('button to continue is displayed', () => { | ||
courtCaseOverallConvictionDatePage.button().should('contain.text', 'Continue') | ||
}) | ||
|
||
it('submitting without entering anything in the inputs results in an error', () => { | ||
courtCaseOverallConvictionDatePage.button().click() | ||
courtCaseOverallConvictionDatePage = Page.verifyOnPage(CourtCaseOverallConvictionDatePage) | ||
courtCaseOverallConvictionDatePage | ||
.errorSummary() | ||
.trimTextContent() | ||
.should( | ||
'equal', | ||
'There is a problem Overall conviction date must include day Overall conviction date must include month Overall conviction date must include year', | ||
) | ||
}) | ||
|
||
it('submitting an invalid date results in an error', () => { | ||
courtCaseOverallConvictionDatePage.dayDateInput('overallConvictionDate').type('35') | ||
courtCaseOverallConvictionDatePage.monthDateInput('overallConvictionDate').type('1') | ||
courtCaseOverallConvictionDatePage.yearDateInput('overallConvictionDate').type('2024') | ||
courtCaseOverallConvictionDatePage.button().click() | ||
courtCaseOverallConvictionDatePage = Page.verifyOnPage(CourtCaseOverallConvictionDatePage) | ||
courtCaseOverallConvictionDatePage | ||
.errorSummary() | ||
.trimTextContent() | ||
.should('equal', 'There is a problem This date does not exist.') | ||
}) | ||
|
||
it('submitting a date in the future results in an error', () => { | ||
const futureDate = dayjs().add(7, 'day') | ||
courtCaseOverallConvictionDatePage.dayDateInput('overallConvictionDate').type(futureDate.date().toString()) | ||
courtCaseOverallConvictionDatePage.monthDateInput('overallConvictionDate').type((futureDate.month() + 1).toString()) | ||
courtCaseOverallConvictionDatePage.yearDateInput('overallConvictionDate').type(futureDate.year().toString()) | ||
courtCaseOverallConvictionDatePage.button().click() | ||
courtCaseOverallConvictionDatePage = Page.verifyOnPage(CourtCaseOverallConvictionDatePage) | ||
courtCaseOverallConvictionDatePage | ||
.errorSummary() | ||
.trimTextContent() | ||
.should('equal', 'There is a problem Overall conviction date must be in the past') | ||
}) | ||
}) |
7 changes: 7 additions & 0 deletions
7
integration_tests/pages/courtCaseOverallConvictionDatePage.ts
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,7 @@ | ||
import Page from './page' | ||
|
||
export default class CourtCaseOverallConvictionDatePage extends Page { | ||
constructor() { | ||
super('Enter the conviction date') | ||
} | ||
} |
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.