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.
- Loading branch information
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
integration_tests/e2e/confirm-swap-vos-pin-credit-details.cy.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,65 @@ | ||
import ConfirmSwapVosPinCreditDetailsPage from '../pages/confirmSwapVosPinCreditDetailsPage' | ||
import Page from '../pages/page' | ||
|
||
context('Confirm Swap VOs for PIN Credit Details Page', () => { | ||
let page: ConfirmSwapVosPinCreditDetailsPage | ||
|
||
beforeEach(() => { | ||
cy.task('reset') | ||
cy.task('stubSignIn') | ||
cy.signIn() | ||
|
||
cy.visit('/log/swap-vos-pin-credit-details/confirm') | ||
|
||
cy.contains('Swap visiting orders (VOs) for PIN credit').click() | ||
cy.contains('button', 'Continue').click() | ||
cy.contains('button', 'Continue').click() | ||
cy.contains('button', 'Continue').click() | ||
|
||
page = Page.verifyOnPage(ConfirmSwapVosPinCreditDetailsPage) | ||
}) | ||
|
||
it('should display the correct page title', () => { | ||
page.pageTitle().should('include', 'Check details') | ||
}) | ||
|
||
it('should render the back link with correct text and href', () => { | ||
page.backLink().should('have.text', 'Back').and('have.attr', 'href', '/log/swap-vos-pin-credit-details') | ||
}) | ||
|
||
it('should render the application type summary with correct text', () => { | ||
page.applicationType().should('contain.text', 'Swap VOs for pin credit') | ||
}) | ||
|
||
it('should allow changing the application type', () => { | ||
page.changeApplicationType().should('exist').and('have.attr', 'href', '#') | ||
}) | ||
|
||
it('should render prisoner name summary with correct text', () => { | ||
page.prisonerName().should('exist') | ||
}) | ||
|
||
it('should allow changing the prisoner details', () => { | ||
page.changePrisoner().should('exist').and('have.attr', 'href', '#') | ||
}) | ||
|
||
it('should display the submitted on date', () => { | ||
page.submittedOn().should('exist') | ||
}) | ||
|
||
it('should allow changing the submission date', () => { | ||
page.changeSubmittedOn().should('exist').and('have.attr', 'href', '#') | ||
}) | ||
|
||
it('should display the VOs to swap details', () => { | ||
page.swapVOsDetails().should('exist') | ||
}) | ||
|
||
it('should allow changing the swap VOs details', () => { | ||
page.changeSwapVOsDetails().should('exist').and('have.attr', 'href', '#') | ||
}) | ||
|
||
it('should render a Continue button with the correct text', () => { | ||
page.continueButton().should('contain.text', 'Continue') | ||
}) | ||
}) |
29 changes: 29 additions & 0 deletions
29
integration_tests/pages/confirmSwapVosPinCreditDetailsPage.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,29 @@ | ||
import Page from './page' | ||
|
||
export default class ConfirmSwapVosPinCreditDetailsPage extends Page { | ||
constructor() { | ||
super('Check details') | ||
} | ||
|
||
backLink = () => cy.get('.govuk-back-link') | ||
|
||
pageTitle = () => cy.title() | ||
|
||
applicationType = () => cy.get('.govuk-summary-list__row').contains('Application Type').next() | ||
|
||
changeApplicationType = () => cy.get('.govuk-summary-list__row').contains('Application Type').parent().find('a') | ||
|
||
prisonerName = () => cy.get('.govuk-summary-list__row').contains('Prisoner').next() | ||
|
||
changePrisoner = () => cy.get('.govuk-summary-list__row').contains('Prisoner').parent().find('a') | ||
|
||
submittedOn = () => cy.get('.govuk-summary-list__row').contains('Submitted on').next() | ||
|
||
changeSubmittedOn = () => cy.get('.govuk-summary-list__row').contains('Submitted on').parent().find('a') | ||
|
||
swapVOsDetails = () => cy.get('.govuk-summary-list__row').contains('Details').next() | ||
|
||
changeSwapVOsDetails = () => cy.get('.govuk-summary-list__row').contains('Details').parent().find('a') | ||
|
||
continueButton = () => cy.get('.govuk-button--primary') | ||
} |