Skip to content

Commit

Permalink
Merge pull request #91 from DEFRA/DSFAAP-603
Browse files Browse the repository at this point in the history
DSFAAP-603: update origin exit page content
  • Loading branch information
hughfdjackson authored Dec 19, 2024
2 parents 087d5b5 + 8e8405a commit 6914043
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 25 deletions.
21 changes: 15 additions & 6 deletions src/server/origin/exit-page/controller.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { createServer } from '~/src/server/index.js'
import { statusCodes } from '~/src/server/common/constants/status-codes.js'
import { parseDocument } from '../../common/test-helpers/dom.js'

describe('#exitPageController', () => {
const pageTitleAndHeading =
'This service is not available for your movement type'
const govukTB204Link =
'https://www.gov.uk/government/publications/tb-restricted-cattle-application-for-movement-licence-in-england'

/** @type {Server} */
let server

Expand All @@ -15,16 +21,19 @@ describe('#exitPageController', () => {
})

test('Should provide expected response', async () => {
const { result, statusCode } = await server.inject({
const { payload, statusCode } = await server.inject({
method: 'GET',
url: '/exit-page'
})

expect(result).toEqual(
expect.stringContaining(
'This service is not available for your movement type'
)
)
const document = parseDocument(payload)

expect(document.querySelector('h1')?.innerHTML).toEqual(pageTitleAndHeading)
expect(document.title).toBe(pageTitleAndHeading)

expect(
document.querySelector(`[href='${govukTB204Link}']`)?.innerHTML.trim()
).toBe('submit the current application form on GOV.UK')
expect(statusCode).toBe(statusCodes.ok)
})
})
Expand Down
10 changes: 3 additions & 7 deletions src/server/origin/exit-page/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@
This service is currently only available for movements off your farm
or premises.
</p>

<p>You need to complete and submit the current form.</p>

<p>
You need to complete and
<a
data-testid="view-application-link"
href="https://www.gov.uk/government/publications/tb-restricted-cattle-application-for-movement-licence-in-england"
>
View the application form
</a>
on
<a data-testid="gov-uk-link" href="https://www.gov.uk/"> GOV.UK </a>
submit the current application form on GOV.UK </a
>.
</p>
</div>
</div>
Expand Down
8 changes: 0 additions & 8 deletions user-journey-tests/page-objects/origin/exitPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,12 @@ class ExitPage extends Page {
return $('[data-testid="view-application-link"]')
}

get govUkLink() {
return $('[data-testid="gov-uk-link"]')
}

async verifyViewApplicationLink() {
await page.selectLinkAndVerifyTitle(
this.viewApplicationLink,
'TB restricted cattle: application for movement licence in England - GOV.UK'
)
}

async verifyGovUkLink() {
await page.selectLinkAndVerifyTitle(this.govUkLink, 'Welcome to GOV.UK')
}
}

export default new ExitPage()
4 changes: 0 additions & 4 deletions user-journey-tests/specs/origin/exit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,4 @@ describe('Exit page test', () => {
it('Should verify the view application link', async () => {
await exitPage.verifyViewApplicationLink()
})

it('Should verify the gov uk link', async () => {
await exitPage.verifyGovUkLink()
})
})

0 comments on commit 6914043

Please sign in to comment.