Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RA-250: add confirm details tests #21

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
}
Loading