|
| 1 | +describe('Origin: /offence-analysis', () => { |
| 2 | + const destinations = { |
| 3 | + landingPage: '/offence-analysis', |
| 4 | + victimCreate: '/offence-analysis-victim/create', |
| 5 | + victimUpdate: '/offence-analysis-victim/edit', |
| 6 | + victimDelete: '/offence-analysis-victim/delete', |
| 7 | + victimsSummary: '/offence-analysis-victims-summary', |
| 8 | + othersInvolved: '/offence-analysis-others-involved', |
| 9 | + details: '/offence-analysis-details', |
| 10 | + summary: '/offence-analysis-complete', |
| 11 | + } |
| 12 | + |
| 13 | + const sectionName = 'Offence analysis' |
| 14 | + |
| 15 | + before(() => { |
| 16 | + cy.createAssessment() |
| 17 | + }) |
| 18 | + |
| 19 | + beforeEach(() => { |
| 20 | + cy.enterAssessment() |
| 21 | + }) |
| 22 | + |
| 23 | + describe(`Destination: ${destinations.othersInvolved}`, () => { |
| 24 | + it(`Victim is "Other" routes to "${destinations.othersInvolved}"`, () => { |
| 25 | + cy.visitStep(destinations.landingPage) |
| 26 | + |
| 27 | + cy.getQuestion('Enter a brief description of the current index offence(s)').enterText('Test') |
| 28 | + cy.getQuestion('Did the current index offence(s) have any of the following elements?') |
| 29 | + .getCheckbox('Arson') |
| 30 | + .clickLabel() |
| 31 | + cy.getQuestion('Why did the current index offence(s) happen?').enterText('Test') |
| 32 | + cy.getQuestion('Did the current index offence(s) involve any of the following motivations?') |
| 33 | + .getCheckbox('Thrill seeking') |
| 34 | + .clickLabel() |
| 35 | + cy.getQuestion('Who was the victim?').getCheckbox('Other').clickLabel() |
| 36 | + cy.getQuestion('Who was the victim?').getCheckbox('Other').getConditionalQuestion().enterText('Test') |
| 37 | + |
| 38 | + cy.assertResumeUrlIs(sectionName, destinations.landingPage) |
| 39 | + cy.saveAndContinue() |
| 40 | + cy.assertStepUrlIs(destinations.othersInvolved) |
| 41 | + cy.assertResumeUrlIs(sectionName, destinations.othersInvolved) |
| 42 | + }) |
| 43 | + |
| 44 | + describe(`Destination: ${destinations.details}`, () => { |
| 45 | + it(`Routes to "${destinations.details}"`, () => { |
| 46 | + cy.visitStep(destinations.othersInvolved) |
| 47 | + |
| 48 | + cy.getQuestion('How many other people were involved with committing the current index offence(s)?') |
| 49 | + .getRadio('1') |
| 50 | + .clickLabel() |
| 51 | + |
| 52 | + cy.assertResumeUrlIs(sectionName, destinations.othersInvolved) |
| 53 | + cy.saveAndContinue() |
| 54 | + cy.assertStepUrlIs(destinations.details) |
| 55 | + cy.assertResumeUrlIs(sectionName, destinations.details) |
| 56 | + }) |
| 57 | + |
| 58 | + describe(`Destination: ${destinations.summary}`, () => { |
| 59 | + it(`Routes to "${destinations.summary}"`, () => { |
| 60 | + cy.visitStep(destinations.details) |
| 61 | + |
| 62 | + cy.getQuestion('Was Sam the leader in regard to committing the current index offence(s)?') |
| 63 | + .getRadio('No') |
| 64 | + .clickLabel() |
| 65 | + cy.getQuestion( |
| 66 | + 'Does Sam recognise the impact or consequences on the victims or others and the wider community?', |
| 67 | + ) |
| 68 | + .getRadio('No') |
| 69 | + .clickLabel() |
| 70 | + cy.getQuestion('Does Sam accept responsibility for the current index offence(s)?').getRadio('No').clickLabel() |
| 71 | + cy.getQuestion('What are the patterns of offending?').enterText('¯\\_(ツ)_/¯') |
| 72 | + cy.getQuestion('Is the current offence(s) an escalation in seriousness from previous offending?') |
| 73 | + .getRadio('No') |
| 74 | + .clickLabel() |
| 75 | + cy.getQuestion( |
| 76 | + 'Is the current offence(s) linked to risk of serious harm, risks to the individual or other risks?', |
| 77 | + ) |
| 78 | + .getRadio('No') |
| 79 | + .clickLabel() |
| 80 | + cy.getQuestion( |
| 81 | + 'Is the current offence(s) linked to risk of serious harm, risks to the individual or other risks?', |
| 82 | + ) |
| 83 | + .getRadio('No') |
| 84 | + .getConditionalQuestion() |
| 85 | + .enterText('¯\\_(ツ)_/¯') |
| 86 | + cy.getQuestion('Is there evidence that Sam has ever been a perpetrator of domestic abuse?') |
| 87 | + .getRadio('No') |
| 88 | + .clickLabel() |
| 89 | + cy.getQuestion('Is there evidence that Sam has ever been a victim of domestic abuse?') |
| 90 | + .getRadio('No') |
| 91 | + .clickLabel() |
| 92 | + |
| 93 | + cy.assertResumeUrlIs(sectionName, destinations.details) |
| 94 | + cy.markAsComplete() |
| 95 | + cy.assertStepUrlIs(destinations.summary) |
| 96 | + cy.assertResumeUrlIs(sectionName, destinations.summary) |
| 97 | + cy.currentSectionMarkedAsComplete(sectionName) |
| 98 | + |
| 99 | + // checkmark is removed on making a change |
| 100 | + cy.getSummary( |
| 101 | + 'How many other people were involved with committing the current index offence(s)?', |
| 102 | + ).clickChange() |
| 103 | + cy.assertStepUrlIs(destinations.othersInvolved) |
| 104 | + cy.getQuestion('How many other people were involved with committing the current index offence(s)?') |
| 105 | + .getRadio('2') |
| 106 | + .clickLabel() |
| 107 | + cy.saveAndContinue() |
| 108 | + |
| 109 | + cy.assertStepUrlIs(destinations.details) |
| 110 | + cy.currentSectionNotMarkedAsComplete(sectionName) |
| 111 | + cy.markAsComplete() |
| 112 | + |
| 113 | + cy.assertStepUrlIs(destinations.summary) |
| 114 | + cy.currentSectionMarkedAsComplete(sectionName) |
| 115 | + }) |
| 116 | + }) |
| 117 | + }) |
| 118 | + }) |
| 119 | + |
| 120 | + describe(`Destination: ${destinations.victimCreate}`, () => { |
| 121 | + it(`Victim is "One or more person" routes to "${destinations.victimCreate}"`, () => { |
| 122 | + cy.visitStep(destinations.landingPage) |
| 123 | + |
| 124 | + cy.getQuestion('Who was the victim?').getCheckbox('One or more person').clickLabel() |
| 125 | + |
| 126 | + cy.assertResumeUrlIs(sectionName, destinations.landingPage) |
| 127 | + cy.saveAndContinue() |
| 128 | + cy.assertStepUrlIs(destinations.victimCreate) |
| 129 | + cy.assertResumeUrlIs(sectionName, destinations.victimsSummary) |
| 130 | + }) |
| 131 | + |
| 132 | + describe(`Destination: ${destinations.victimsSummary}`, () => { |
| 133 | + it(`routes to ${destinations.victimsSummary}`, () => { |
| 134 | + cy.visitStep(destinations.victimCreate) |
| 135 | + |
| 136 | + cy.getQuestion("What is Sam's relationship to the victim?").getRadio('A stranger').clickLabel() |
| 137 | + cy.getQuestion("What is the victim's approximate age?").getRadio('0 to 4 years').clickLabel() |
| 138 | + cy.getQuestion("What is the victim's sex?").getRadio('Male').clickLabel() |
| 139 | + cy.getQuestion("What is the victim's race or ethnicity?").enterText('white{enter}') |
| 140 | + cy.saveAndContinue() |
| 141 | + cy.assertStepUrlIs(destinations.victimsSummary) |
| 142 | + cy.assertResumeUrlIs(sectionName, destinations.victimsSummary) |
| 143 | + }) |
| 144 | + |
| 145 | + describe(`Destination: ${destinations.othersInvolved}`, () => { |
| 146 | + it(`routes to ${destinations.othersInvolved}`, () => { |
| 147 | + cy.assertResumeUrlIs(sectionName, destinations.victimsSummary) |
| 148 | + |
| 149 | + cy.visitStep(destinations.victimsSummary) |
| 150 | + cy.saveAndContinue() |
| 151 | + cy.assertStepUrlIs(destinations.othersInvolved) |
| 152 | + }) |
| 153 | + |
| 154 | + describe(`Destination: ${destinations.details}`, () => { |
| 155 | + it(`routes to ${destinations.details}`, () => { |
| 156 | + cy.assertResumeUrlIs(sectionName, destinations.details) |
| 157 | + |
| 158 | + cy.visitStep(destinations.othersInvolved) |
| 159 | + cy.saveAndContinue() |
| 160 | + cy.assertStepUrlIs(destinations.details) |
| 161 | + }) |
| 162 | + |
| 163 | + describe(`Destination: ${destinations.summary}`, () => { |
| 164 | + it(`routes to ${destinations.summary}`, () => { |
| 165 | + cy.assertResumeUrlIs(sectionName, destinations.details) |
| 166 | + |
| 167 | + cy.visitStep(destinations.details) |
| 168 | + cy.markAsComplete() |
| 169 | + cy.assertStepUrlIs(destinations.summary) |
| 170 | + cy.assertResumeUrlIs(sectionName, destinations.summary) |
| 171 | + }) |
| 172 | + }) |
| 173 | + }) |
| 174 | + }) |
| 175 | + }) |
| 176 | + }) |
| 177 | +}) |
0 commit comments