Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update 'no-errors' page design & content #610

Merged
merged 8 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 18 additions & 41 deletions src/views/check/results/no-errors.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
{% set dataLooksCorrectError = true %}
{% endif %}

{% if options.data.params.dataset %}
{% set checkToolLink = { name: (options.deepLink.orgName or '') } | checkToolDeepLink(options.data.params) %}
{% else %}
{% set checkToolLink = "/check" %}
{% endif %}

{% block pageTitle %}
{% set pageTitle = super() %}
Expand All @@ -40,18 +45,15 @@
{{ datasetBanner(options.datasetName) }}
{% endif %}
<h1 class="govuk-heading-l">
{{pageName}}
You have {{options.pagination.totalResults}} {{ "row" | pluralise(options.pagination.totalResults) }} ready to publish
</h1>
<p>{{options.buttonText}}</p>
</div>
</div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<p>{{options.pagination.totalResults}} rows can be published.</p>



{{ table(options.tableParams) }}

{% if options.pagination.items | length > 1 %}
Expand Down Expand Up @@ -79,46 +81,21 @@ <h1 class="govuk-heading-l">

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
{% if dataLooksCorrectError %}
{{ govukErrorSummary({
titleText: "There’s a problem",
errorList: [
{
text: errorMessage,
href: "#dataLooksCorrect"
}
]
}) }}
{% endif %}
<form method="post">
{{ govukRadios({
idPrefix: "dataLooksCorrect",
name: "dataLooksCorrect",
fieldset: {
legend: {
text: "Is your data correct?",
isPageHeading: false,
classes: "govuk-fieldset__legend--m"
}
},
items: [
{
value: "yes",
text: "Yes"
},
{
value: "no",
text: "No, I need to fix it"
}
],
errorMessage: {
text: errorMessage
} if dataLooksCorrectError else undefined
})
}}

<form novalidate method="post">
<h3 class="govuk-heading-m">Before you continue</h3>

<p>Make sure your data is correct.</p>

<p>If you see anything wrong with your data, you can check it again.</p>

{{ govukButton({
text: "Continue"
}) }}

<input type="hidden" name="dataLooksCorrect" value="yes">
<p><a href="{{ checkToolLink }}">Check your updated data</a></p>

rosado marked this conversation as resolved.
Show resolved Hide resolved
</form>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion test/PageObjectModels/resultsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class ResultsPage extends BasePage {
}

async expectPageIsNoErrorsPage () {
expect(await this.page.locator('h1').innerText()).toEqual('Check your data before you continue')
expect(await this.page.locator('h1').innerText()).toMatch(/You have \d+ row.* ready to publish/)
}

async expectIsFailedPage () {
Expand Down
2 changes: 0 additions & 2 deletions test/acceptance/request_check.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ test.describe('Request Check', () => {
await resultsPage.waitForPage(id)
await resultsPage.expectPageIsNoErrorsPage()

await resultsPage.selectLabel('Yes')
const confirmationPage = await resultsPage.clickContinue()
await confirmationPage.waitForPage()
})
Expand Down Expand Up @@ -170,7 +169,6 @@ test.describe('Request Check', () => {
await resultsPage.waitForPage(id)
await resultsPage.expectPageIsNoErrorsPage()

await resultsPage.selectLabel('Yes')
const confirmationPage = await resultsPage.clickContinue()
await confirmationPage.waitForPage()
})
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_recieving_results.playwright.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test('receiving a successful result', async ({ page }) => {
await resultsPage.navigateToRequest('complete')
await resultsPage.expectPageIsNoErrorsPage()

await expect(page.locator('#main-content')).toContainText('3 rows can be published.')
await expect(page.locator('#main-content')).toContainText(/You have \d+ row.* ready to publish/)

const tableValues = await getTableContents(page, 'govuk-table')
const expectedTableValues = getTableValuesFromResponse(successResponse, successResponseDetails)
Expand Down
18 changes: 0 additions & 18 deletions test/integration/validation_errors.playwright.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { test } from '@playwright/test'
import StartPage from '../PageObjectModels/startPage'
import NoErrorsPage from '../PageObjectModels/noErrorsPage'

import { datasets } from '../PageObjectModels/datasetPage'
import { uploadMethods } from '../PageObjectModels/uploadMethodPage'

Expand Down Expand Up @@ -104,19 +102,3 @@ test('when the user clicks continue on the url page without entering a url, the

await uploadURLPage.expectErrorMessages(expectedErrors)
})

// ToDo: rewrite this for the new async flow
test('when the user clicks continue on the no errors page, without saying their data looks ok, the page correctly indicates there\'s an error', async ({ page }) => {
const noErrorsPage = new NoErrorsPage(page)

await noErrorsPage.navigateToRequest('complete')
await noErrorsPage.clickContinue(true)

const expectedErrors = [
{
fieldName: 'input#dataLooksCorrect.govuk-radios__input',
expectedErrorMessage: 'Select if your data looks ok'
}
]
await noErrorsPage.expectErrorMessages(expectedErrors)
})