|
| 1 | +context('Log Prisoner Details Page', () => { |
| 2 | + beforeEach(() => { |
| 3 | + cy.task('reset') |
| 4 | + cy.task('stubSignIn') |
| 5 | + cy.signIn() |
| 6 | + cy.request('/mock-session').then(() => { |
| 7 | + cy.visit('/log/prisoner-details') |
| 8 | + }) |
| 9 | + }) |
| 10 | + |
| 11 | + it('should display the page title', () => { |
| 12 | + cy.title().should('include', 'Log prisoner details') |
| 13 | + cy.log('Checked page title') |
| 14 | + }) |
| 15 | + |
| 16 | + it('should display the back link', () => { |
| 17 | + cy.get('.govuk-back-link') |
| 18 | + .should('exist') |
| 19 | + .and('have.attr', 'href', '/log/application-type') |
| 20 | + .and('have.text', 'Back') |
| 21 | + cy.log('Checked back link') |
| 22 | + }) |
| 23 | + |
| 24 | + it('should display the prisoner details form', () => { |
| 25 | + cy.get('form#log-prisoner-details').should('exist') |
| 26 | + cy.log('Checked prisoner details form') |
| 27 | + }) |
| 28 | + |
| 29 | + it('should display the hidden CSRF token field', () => { |
| 30 | + cy.get('input[name="_csrf"]').should('exist').and('have.attr', 'type', 'hidden') |
| 31 | + cy.log('Checked CSRF token field') |
| 32 | + }) |
| 33 | + |
| 34 | + it('should display the prison number input field', () => { |
| 35 | + cy.get('input#prisonNumber') |
| 36 | + .should('exist') |
| 37 | + .and('have.attr', 'type', 'text') |
| 38 | + .and('have.attr', 'name', 'prisonNumber') |
| 39 | + cy.log('Checked prison number input field') |
| 40 | + }) |
| 41 | + |
| 42 | + it('should display the "Find prisoner" button', () => { |
| 43 | + cy.get('#prison-number-lookup') |
| 44 | + .should('exist') |
| 45 | + .and('include.text', 'Find prisoner') |
| 46 | + .and('have.class', 'govuk-button--secondary') |
| 47 | + cy.log('Checked "Find prisoner" button') |
| 48 | + }) |
| 49 | + |
| 50 | + it('should display the prisoner name inset text', () => { |
| 51 | + cy.get('.govuk-inset-text').should('exist').and('contain.text', 'Prisoner name: Patel, Taj') |
| 52 | + cy.log('Checked prisoner name inset text') |
| 53 | + }) |
| 54 | + |
| 55 | + it('should display the date picker', () => { |
| 56 | + cy.get('#date').should('exist') |
| 57 | + cy.get('label[for="date"]').should('exist').and('include.text', 'Date') |
| 58 | + cy.log('Checked date picker') |
| 59 | + }) |
| 60 | + |
| 61 | + it('should display the continue button', () => { |
| 62 | + cy.get('[data-test="continue-button"]') |
| 63 | + .should('exist') |
| 64 | + .and('include.text', 'Continue') |
| 65 | + .and('have.class', 'govuk-button--primary') |
| 66 | + cy.log('Checked continue button') |
| 67 | + }) |
| 68 | +}) |
0 commit comments