Skip to content

Commit 3690d7d

Browse files
committed
add confirm details tests
1 parent 9651e41 commit 3690d7d

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import ConfirmSwapVosPinCreditDetailsPage from '../pages/confirmSwapVosPinCreditDetailsPage'
2+
import Page from '../pages/page'
3+
4+
context('Confirm Swap VOs for PIN Credit Details Page', () => {
5+
let page: ConfirmSwapVosPinCreditDetailsPage
6+
7+
beforeEach(() => {
8+
cy.task('reset')
9+
cy.task('stubSignIn')
10+
cy.signIn()
11+
12+
cy.visit('/log/swap-vos-pin-credit-details/confirm')
13+
14+
cy.contains('Swap visiting orders (VOs) for PIN credit').click()
15+
cy.contains('button', 'Continue').click()
16+
cy.contains('button', 'Continue').click()
17+
cy.contains('button', 'Continue').click()
18+
19+
page = Page.verifyOnPage(ConfirmSwapVosPinCreditDetailsPage)
20+
})
21+
22+
it('should display the correct page title', () => {
23+
page.pageTitle().should('include', 'Check details')
24+
})
25+
26+
it('should render the back link with correct text and href', () => {
27+
page.backLink().should('have.text', 'Back').and('have.attr', 'href', '/log/swap-vos-pin-credit-details')
28+
})
29+
30+
it('should render the application type summary with correct text', () => {
31+
page.applicationType().should('contain.text', 'Swap VOs for pin credit')
32+
})
33+
34+
it('should allow changing the application type', () => {
35+
page.changeApplicationType().should('exist').and('have.attr', 'href', '#')
36+
})
37+
38+
it('should render prisoner name summary with correct text', () => {
39+
page.prisonerName().should('exist')
40+
})
41+
42+
it('should allow changing the prisoner details', () => {
43+
page.changePrisoner().should('exist').and('have.attr', 'href', '#')
44+
})
45+
46+
it('should display the submitted on date', () => {
47+
page.submittedOn().should('exist')
48+
})
49+
50+
it('should allow changing the submission date', () => {
51+
page.changeSubmittedOn().should('exist').and('have.attr', 'href', '#')
52+
})
53+
54+
it('should display the VOs to swap details', () => {
55+
page.swapVOsDetails().should('exist')
56+
})
57+
58+
it('should allow changing the swap VOs details', () => {
59+
page.changeSwapVOsDetails().should('exist').and('have.attr', 'href', '#')
60+
})
61+
62+
it('should render a Continue button with the correct text', () => {
63+
page.continueButton().should('contain.text', 'Continue')
64+
})
65+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import Page from './page'
2+
3+
export default class ConfirmSwapVosPinCreditDetailsPage extends Page {
4+
constructor() {
5+
super('Check details')
6+
}
7+
8+
backLink = () => cy.get('.govuk-back-link')
9+
10+
pageTitle = () => cy.title()
11+
12+
applicationType = () => cy.get('.govuk-summary-list__row').contains('Application Type').next()
13+
14+
changeApplicationType = () => cy.get('.govuk-summary-list__row').contains('Application Type').parent().find('a')
15+
16+
prisonerName = () => cy.get('.govuk-summary-list__row').contains('Prisoner').next()
17+
18+
changePrisoner = () => cy.get('.govuk-summary-list__row').contains('Prisoner').parent().find('a')
19+
20+
submittedOn = () => cy.get('.govuk-summary-list__row').contains('Submitted on').next()
21+
22+
changeSubmittedOn = () => cy.get('.govuk-summary-list__row').contains('Submitted on').parent().find('a')
23+
24+
swapVOsDetails = () => cy.get('.govuk-summary-list__row').contains('Details').next()
25+
26+
changeSwapVOsDetails = () => cy.get('.govuk-summary-list__row').contains('Details').parent().find('a')
27+
28+
continueButton = () => cy.get('.govuk-button--primary')
29+
}

0 commit comments

Comments
 (0)