Skip to content

Commit

Permalink
add confirm details tests
Browse files Browse the repository at this point in the history
  • Loading branch information
madebyzak committed Feb 10, 2025
1 parent 9651e41 commit 3690d7d
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
65 changes: 65 additions & 0 deletions integration_tests/e2e/confirm-swap-vos-pin-credit-details.cy.ts
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 integration_tests/pages/confirmSwapVosPinCreditDetailsPage.ts
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')
}

0 comments on commit 3690d7d

Please sign in to comment.