Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions e2e/cypress/e2e/runner/dateValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Then("I see the date parts error {string}", (error) => {
/**
* Date parts only show one error at a time.
*/
cy.findByText("Fix the following errors");
cy.findByText("There is a problem");
cy.findByRole("link", { name: error, exact: false });
});

Expand All @@ -32,7 +32,7 @@ Then(
/**
* Date parts only show one error at a time.
*/
cy.findByText("Fix the following errors");
cy.findByText("There is a problem");
cy.get(`#${fieldName}-error`).within(() => {
cy.findByText(error, { exact: false });
});
Expand Down
8 changes: 4 additions & 4 deletions e2e/cypress/e2e/runner/initialiseSession.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Feature: Initialise session - prepopulate a session
| form | callbackUrl | redirectPath | message | htmlMessage | title |
| initialiseSession | https://61bca17e-fe74-40e0-9c15-a901ad120eca.mock.pstmn.io | /summary | | | |
And I go to the initialised session URL
Then I see "Summary"
Then I see the heading "Summary"


Scenario: The configured message is displayed
Expand All @@ -15,7 +15,7 @@ Feature: Initialise session - prepopulate a session
| form | callbackUrl | redirectPath | message | htmlMessage | title |
| initialiseSession | https://61bca17e-fe74-40e0-9c15-a901ad120eca.mock.pstmn.io | /summary | your favourite egg is wrong | | |
And I go to the initialised session URL
Then I see "Summary"
Then I see the heading "Summary"
And I see "your favourite egg is wrong"

Scenario: The configured htmlMessage is displayed
Expand All @@ -24,7 +24,7 @@ Feature: Initialise session - prepopulate a session
| form | callbackUrl | redirectPath | message | htmlMessage | title |
| initialiseSession | https://61bca17e-fe74-40e0-9c15-a901ad120eca.mock.pstmn.io | /summary | | <p>This is not a type of egg</p> | |
And I go to the initialised session URL
Then I see "Summary"
Then I see the heading "Summary"
And I see "This is not a type of egg"
And I don't see "<p>"

Expand All @@ -46,4 +46,4 @@ Feature: Initialise session - prepopulate a session
And I declare and continue
Then I see "Cookies are files saved on your phone"
When I revisit the status page
Then I see "Cookies are files saved on your phone"
Then I see "Cookies are files saved on your phone"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { When } from "@badeball/cypress-cucumber-preprocessor";

When("I see the error {string} for {string}", (error, fieldName) => {
cy.findByText("Fix the following errors");
cy.findByText("There is a problem");
cy.findByRole("link", { name: error });
cy.findByRole("group", { description: `Error: ${error}` });
});
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ export class PageControllerBase {
});

formResult.errors = Object.is(formResult.errors, null)
? { titleText: "Fix the following errors" }
? { titleText: "There is a problem" }
: formResult.errors;
formResult.errors.errorList = reformattedErrors;
}
Expand All @@ -638,7 +638,7 @@ export class PageControllerBase {
});

formResult.errors = Object.is(formResult.errors, null)
? { titleText: "Fix the following errors" }
? { titleText: "There is a problem" }
: formResult.errors;
formResult.errors.errorList = reformattedErrors;
}
Expand Down Expand Up @@ -841,7 +841,7 @@ export class PageControllerBase {
}

get errorSummaryTitle() {
return "Fix the following errors";
return "There is a problem";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function errorListFromValidationResult(
const errorList = errors.details.map(errorListItemToErrorVM);

return {
titleText: "Fix the following errors",
titleText: "There is a problem",
errorList: errorList.filter(
({ text }, index) =>
index === errorList.findIndex((err) => err.text === text)
Expand Down
2 changes: 1 addition & 1 deletion runner/src/server/plugins/engine/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export type FormSubmissionState = {
};

export type FormSubmissionErrors = {
titleText: string; // e.b: "Fix the following errors"
titleText: string; // e.b: "There is a problem"
errorList: {
path: string; // e.g: "firstName"
href: string; // e.g: "#firstName"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<p class="govuk-body">You previously uploaded the file ‘{{component.model.value}}’</p>
{% endif %}
<div class="govuk-error-summary govuk-border-green upload-dialog" aria-labelledby="success-summary-title" role="alert" tabindex="-1">
<h2 class="govuk-!-margin-0 govuk-heading-m" id="success-summary-title">
<p class="govuk-!-margin-0 govuk-heading-m" id="success-summary-title">
Your file was successfully selected
</h2>
</p>
</div>
{% endmacro %}
8 changes: 6 additions & 2 deletions runner/src/server/services/upload/uploadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,14 @@ export class UploadService {
validFiletypesString(customAcceptedTypes?: string[]) {
const acceptedTypes = customAcceptedTypes ?? this.validContentTypes;

const acceptedTypeNames = acceptedTypes
let acceptedTypeNames = acceptedTypes
.map((type) => contentTypeToName[type])
.filter(Boolean);
.filter(Boolean)
.map((type) => type.toUpperCase());

const namesSet = new Set(acceptedTypeNames);
acceptedTypeNames = Array.from(namesSet);

const acceptedTypesNameWithoutLast = acceptedTypeNames
.slice(0, -1)
.join(", ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ suite("Date parts field", () => {
type: "DatePartsField",
};
const errors = {
titleText: "Fix the following errors",
titleText: "There is a problem",
errorList: [
{
path: "approximate__day",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ suite("PageControllerBase", () => {
};

expect(page.getErrors(error)).to.equal({
titleText: "Fix the following errors",
titleText: "There is a problem",
errorList: [
{
path: "approximate",
Expand Down
2 changes: 1 addition & 1 deletion runner/test/cases/server/upload.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ suite("uploads", () => {

const $ = cheerio.load(response.payload);
expect($("[href='#file1']").text().trim()).to.contain(
'The selected file for "Passport photo" must be a jpg, jpeg, png or pdf'
'The selected file for "Passport photo" must be a JPG, JPEG, PNG or PDF'
);
});

Expand Down
Loading