diff --git a/src/Dfe.EarlyYearsQualification.Content/Entities/QualificationListPage.cs b/src/Dfe.EarlyYearsQualification.Content/Entities/QualificationListPage.cs index 66500adc..01f79d72 100644 --- a/src/Dfe.EarlyYearsQualification.Content/Entities/QualificationListPage.cs +++ b/src/Dfe.EarlyYearsQualification.Content/Entities/QualificationListPage.cs @@ -25,4 +25,8 @@ public class QualificationListPage public string SearchCriteriaHeading { get; init; } = string.Empty; public Document? PostSearchCriteriaContent { get; init; } + + public string AnyLevelHeading { get; init; } = string.Empty; + + public string AnyAwardingOrganisationHeading { get; init; } = string.Empty; } \ No newline at end of file diff --git a/src/Dfe.EarlyYearsQualification.Mock/Content/MockContentfulService.cs b/src/Dfe.EarlyYearsQualification.Mock/Content/MockContentfulService.cs index 8d43a093..1b3ca99c 100644 --- a/src/Dfe.EarlyYearsQualification.Mock/Content/MockContentfulService.cs +++ b/src/Dfe.EarlyYearsQualification.Mock/Content/MockContentfulService.cs @@ -221,7 +221,9 @@ public Task> GetQualifications() SingleQualificationFoundText = "qualification found", PreSearchBoxContent = ContentfulContentHelper.Text("Pre search box content"), PostQualificationListContent = ContentfulContentHelper.Text("Post qualification list content"), - PostSearchCriteriaContent = ContentfulContentHelper.Text("Post search criteria content") + PostSearchCriteriaContent = ContentfulContentHelper.Text("Post search criteria content"), + AnyLevelHeading = "Any level", + AnyAwardingOrganisationHeading = "Various awarding organisations" }); } diff --git a/src/Dfe.EarlyYearsQualification.Web/Controllers/QualificationDetailsController.cs b/src/Dfe.EarlyYearsQualification.Web/Controllers/QualificationDetailsController.cs index 6e4bc97f..f3d3942d 100644 --- a/src/Dfe.EarlyYearsQualification.Web/Controllers/QualificationDetailsController.cs +++ b/src/Dfe.EarlyYearsQualification.Web/Controllers/QualificationDetailsController.cs @@ -88,7 +88,7 @@ private async Task MapList(QualificationListPage content { var basicQualificationsModels = GetBasicQualificationsModels(qualifications); - var filterModel = GetFilterModel(); + var filterModel = GetFilterModel(content); return new QualificationListModel { @@ -109,11 +109,13 @@ private async Task MapList(QualificationListPage content }; } - private FilterModel GetFilterModel() + private FilterModel GetFilterModel(QualificationListPage content) { var filterModel = new FilterModel { - Country = userJourneyCookieService.GetWhereWasQualificationAwarded()! + Country = userJourneyCookieService.GetWhereWasQualificationAwarded()!, + Level = content.AnyLevelHeading, + AwardingOrganisation = content.AnyAwardingOrganisationHeading }; var (startDateMonth, startDateYear) = userJourneyCookieService.GetWhenWasQualificationAwarded(); diff --git a/src/Dfe.EarlyYearsQualification.Web/Models/Content/FilterModel.cs b/src/Dfe.EarlyYearsQualification.Web/Models/Content/FilterModel.cs index 1e6b3e4b..43bc4fb6 100644 --- a/src/Dfe.EarlyYearsQualification.Web/Models/Content/FilterModel.cs +++ b/src/Dfe.EarlyYearsQualification.Web/Models/Content/FilterModel.cs @@ -6,7 +6,7 @@ public class FilterModel public string StartDate { get; set; } = string.Empty; - public string Level { get; set; } = "Any level"; + public string Level { get; set; } = string.Empty; - public string AwardingOrganisation { get; set; } = "Any organisation"; + public string AwardingOrganisation { get; set; } = string.Empty; } \ No newline at end of file diff --git a/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/qualification-list-spec.cy.js b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/qualification-list-spec.cy.js index faa2f7fd..6c38970d 100644 --- a/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/qualification-list-spec.cy.js +++ b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/qualification-list-spec.cy.js @@ -2,12 +2,13 @@ describe("A spec used to test the qualification list page", () => { beforeEach(() => { cy.setCookie('auth-secret', Cypress.env('auth_secret')); - // Value is '{"WhereWasQualificationAwarded":"england","WhenWasQualificationAwarded":"6/2022","LevelOfQualification":"3","WhatIsTheAwardingOrganisation":"NCFE"}' encoded - cy.setCookie('user_journey', '%7B%22WhereWasQualificationAwarded%22%3A%22england%22%2C%22WhenWasQualificationAwarded%22%3A%226%2F2022%22%2C%22LevelOfQualification%22%3A%223%22%2C%22WhatIsTheAwardingOrganisation%22%3A%22NCFE%22%7D'); }) // Mock details found in Dfe.EarlyYearsQualification.Mock.Content.MockContentfulService. it("Checks the details are showing on the page", () => { + // Value is '{"WhereWasQualificationAwarded":"england","WhenWasQualificationAwarded":"6/2022","LevelOfQualification":"3","WhatIsTheAwardingOrganisation":"NCFE"}' encoded + cy.setCookie('user_journey', '%7B%22WhereWasQualificationAwarded%22%3A%22england%22%2C%22WhenWasQualificationAwarded%22%3A%226%2F2022%22%2C%22LevelOfQualification%22%3A%223%22%2C%22WhatIsTheAwardingOrganisation%22%3A%22NCFE%22%7D'); + cy.visit("/qualifications"); cy.get("#your-search-header").should("contain.text", "Your search"); @@ -26,4 +27,13 @@ describe("A spec used to test the qualification list page", () => { cy.get(".level").first().should("contain.text", "Level"); cy.get(".awarding-org").first().should("contain.text", "Awarding organisation"); }) + + it("Shows the default headings when any level and no awarding organisation selected", () => { + // Value is '{"WhereWasQualificationAwarded":"england","WhenWasQualificationAwarded":"6/2022","LevelOfQualification":"0","WhatIsTheAwardingOrganisation":""}' encoded + cy.setCookie('user_journey', '%7B%22WhereWasQualificationAwarded%22%3A%22england%22%2C%22WhenWasQualificationAwarded%22%3A%226%2F2022%22%2C%22LevelOfQualification%22%3A%220%22%2C%22WhatIsTheAwardingOrganisation%22%3A%22%22%7D'); + cy.visit("/qualifications"); + + cy.get("#filter-level").should("contain.text", "Any level"); + cy.get("#filter-org").should("contain.text", "Various awarding organisations"); + }) }) \ No newline at end of file