|
| 1 | +import LogPrisonerDetailsPage from '../pages/logPrisonerDetails' |
| 2 | +import Page from '../pages/page' |
| 3 | + |
| 4 | +context('Log Prisoner Details Page', () => { |
| 5 | + let page: LogPrisonerDetailsPage |
| 6 | + |
| 7 | + beforeEach(() => { |
| 8 | + cy.task('reset') |
| 9 | + cy.task('stubSignIn') |
| 10 | + cy.signIn() |
| 11 | + |
| 12 | + cy.visit('/log/prisoner-details') |
| 13 | + |
| 14 | + cy.contains('Swap visiting orders (VOs) for PIN credit').click() |
| 15 | + cy.contains('button', 'Continue').click() |
| 16 | + |
| 17 | + page = Page.verifyOnPage(LogPrisonerDetailsPage) |
| 18 | + }) |
| 19 | + |
| 20 | + it('should direct the user to the correct page', () => { |
| 21 | + Page.verifyOnPage(LogPrisonerDetailsPage) |
| 22 | + }) |
| 23 | + |
| 24 | + it('should display the correct page title', () => { |
| 25 | + page.pageTitle().should('include', 'Log prisoner details') |
| 26 | + }) |
| 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/application-type') |
| 30 | + }) |
| 31 | + |
| 32 | + it('should display the prisoner details form', () => { |
| 33 | + page.form().should('exist') |
| 34 | + }) |
| 35 | + |
| 36 | + it('should include a hidden CSRF token input field', () => { |
| 37 | + page.csrfToken().should('exist').and('have.attr', 'type', 'hidden') |
| 38 | + }) |
| 39 | + |
| 40 | + it('should render the prison number input field', () => { |
| 41 | + page.prisonNumberInput().should('exist').and('have.attr', 'type', 'text').and('have.attr', 'name', 'prisonNumber') |
| 42 | + }) |
| 43 | + |
| 44 | + it('should render the "Find prisoner" button', () => { |
| 45 | + page |
| 46 | + .findPrisonerButton() |
| 47 | + .should('exist') |
| 48 | + .and('have.class', 'govuk-button--secondary') |
| 49 | + .and('include.text', 'Find prisoner') |
| 50 | + }) |
| 51 | + |
| 52 | + it('should render the prisoner name inset text', () => { |
| 53 | + page.prisonerNameInsetText().should('exist').and('contain.text', 'Prisoner name: Patel, Taj') |
| 54 | + }) |
| 55 | + |
| 56 | + it('should render the date picker', () => { |
| 57 | + page.dateInput().should('exist') |
| 58 | + page.dateLabel().should('exist').and('include.text', 'Date') |
| 59 | + }) |
| 60 | + |
| 61 | + it('should render the continue button with the correct text', () => { |
| 62 | + page.continueButton().should('exist').and('include.text', 'Continue').and('have.class', 'govuk-button--primary') |
| 63 | + }) |
| 64 | +}) |
0 commit comments