diff --git a/src/Dfe.EarlyYearsQualification.Web/Views/CheckAdditionalRequirements/Index.cshtml b/src/Dfe.EarlyYearsQualification.Web/Views/CheckAdditionalRequirements/Index.cshtml index 35167726..0a305826 100644 --- a/src/Dfe.EarlyYearsQualification.Web/Views/CheckAdditionalRequirements/Index.cshtml +++ b/src/Dfe.EarlyYearsQualification.Web/Views/CheckAdditionalRequirements/Index.cshtml @@ -12,10 +12,10 @@
-

@Model.Heading

+

@Model.Heading

-
+
@Model.QualificationLabel
@@ -23,7 +23,7 @@
-
+
@Model.QualificationLevelLabel
@@ -31,7 +31,7 @@
-
+
@Model.AwardingOrganisationLabel
@@ -49,7 +49,7 @@ @if (Model.HasErrors) { -

+

Error: @Model.ErrorMessage

} @@ -57,21 +57,25 @@ @for (var qi = 0; qi < Model.AdditionalRequirementQuestions.Count; qi++) { var question = Model.AdditionalRequirementQuestions[qi]; + var questionId = $"question_{qi}";
-

@question.Question

+

@question.Question

@if (!string.IsNullOrEmpty(question.HintText)) { -

@question.HintText

+ var hintId = $"{questionId}_hint"; +

@question.HintText

} @if (!string.IsNullOrEmpty(question.DetailsHeading) && !string.IsNullOrEmpty(question.DetailsContent)) { + var detailsHeadingId = $"{questionId}_details_heading"; + var detailsContentId = $"{questionId}_details_content";
- + @question.DetailsHeading -
+
@Html.Raw(question.DetailsContent)
@@ -93,7 +97,7 @@
- + Warning @Model.InformationMessage diff --git a/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/check-additional-questions-spec.cy.js b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/check-additional-questions-spec.cy.js new file mode 100644 index 00000000..ac31c28d --- /dev/null +++ b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/check-additional-questions-spec.cy.js @@ -0,0 +1,36 @@ +describe("A spec that tests the check additional questions page", () => { + beforeEach(() => { + cy.setCookie('auth-secret', Cypress.env('auth_secret')); + }) + + // Mock details found in Dfe.EarlyYearsQualification.Mock.Content.MockContentfulService. + it("Checks the check additional questions details are on the page", () => { + cy.visit("/qualifications/check-additional-questions/eyq-240"); + + cy.get("#heading").should("contain.text", "Check the additional requirements"); + cy.get("#qualification-name-label").should("contain.text", "Qualification"); + cy.get("#qualification-name-value").should("contain.text", "T Level Technical Qualification in Education and Childcare (Specialism - Early Years Educator)"); + cy.get("#qualification-level-label").should("contain.text", "Qualification level"); + cy.get("#awarding-organisation-label").should("contain.text", "Awarding organisation"); + cy.get("#awarding-organisation-value").should("contain.text", "NCFE"); + cy.get("#question_0").should("contain.text", "Test question"); + cy.get("#question_0_hint").should("contain.text", "This is the hint text"); + cy.get("#question_0_details_heading").should("contain.text", "This is the details heading"); + cy.get("#question_0_details_content").should("contain.text", "This is the details content"); + cy.get("Label[for='yes_0_0']").should("contain.text", "Yes"); + cy.get("Label[for='no_0_1']").should("contain.text", "No"); + cy.get("#additional-requirement-warning").should("contain.text", "Your result is dependent on the accuracy of the answers you have provided"); + cy.get("#additional-requirement-button").should("contain.text", "Get result"); + }) + + it("Shows errors if user does not select an option", () => { + cy.visit("/qualifications/check-additional-questions/eyq-240"); + + cy.get("#additional-requirement-button").click(); + + cy.get("#question-choice-error").should("be.visible"); + cy.get("#question-choice-error").should("contain.text", "This is a test error message"); + + cy.get(".govuk-form-group--error").should("be.visible"); + }); +}) \ No newline at end of file