|
| 1 | +import Page from '../pages/page' |
| 2 | +import SwapVosPinCreditDetailsPage from '../pages/swapVosPinCreditDetailsPage' |
| 3 | + |
| 4 | +context('Swap VOs for PIN Credit Details Page', () => { |
| 5 | + let page: SwapVosPinCreditDetailsPage |
| 6 | + beforeEach(() => { |
| 7 | + cy.task('reset') |
| 8 | + cy.task('stubSignIn') |
| 9 | + cy.signIn() |
| 10 | + cy.visit('/log/swap-vos-pin-credit-details') |
| 11 | + |
| 12 | + // Navigate through the pages |
| 13 | + cy.contains('Swap visiting orders (VOs) for PIN credit').click() |
| 14 | + cy.contains('button', 'Continue').click() // Click the Continue button on the 'Select application type' page |
| 15 | + cy.contains('button', 'Continue').click() // Click the Continue button on the 'Log prisoner details' page |
| 16 | + page = Page.verifyOnPage(SwapVosPinCreditDetailsPage) |
| 17 | + }) |
| 18 | + |
| 19 | + it('should direct the user to the correct page', () => { |
| 20 | + Page.verifyOnPage(SwapVosPinCreditDetailsPage) |
| 21 | + }) |
| 22 | + it('should display the correct page title', () => { |
| 23 | + page.pageTitle().should('include', 'Log swap VOs for PIN credit details') |
| 24 | + }) |
| 25 | + it('should render the page heading correctly', () => { |
| 26 | + page.checkOnPage() |
| 27 | + }) |
| 28 | + it('should render the back link with correct text and href', () => { |
| 29 | + page.backLink().should('have.text', 'Back').and('have.attr', 'href', '/log/prisoner-details') |
| 30 | + }) |
| 31 | + it('should render the correct app type title', () => { |
| 32 | + page.appTypeTitle().should('have.text', 'Swap VOs for PIN credit') |
| 33 | + }) |
| 34 | + it('should render the correct form label for the textarea', () => { |
| 35 | + page.formLabel().should('contain.text', 'Details (optional)') |
| 36 | + }) |
| 37 | + it('should display the hint text correctly', () => { |
| 38 | + page.hintText().should('contain.text', 'Add a brief summary, for example, if this person is a Foreign National') |
| 39 | + }) |
| 40 | + it('should contain a textarea with the correct ID', () => { |
| 41 | + page.textArea().should('have.attr', 'id', 'swap-vos-pin-credit-details') |
| 42 | + }) |
| 43 | + it('should include a hidden CSRF token input field', () => { |
| 44 | + page.csrfToken().should('exist') |
| 45 | + }) |
| 46 | + it('should render a Continue button with the correct text', () => { |
| 47 | + page.continueButton().should('contain.text', 'Continue') |
| 48 | + }) |
| 49 | +}) |
0 commit comments