Skip to content

Commit

Permalink
Fix/EYQB-320: Default headings (#236)
Browse files Browse the repository at this point in the history
* Updated the default wording

* Moved the default headings out into Contentful. Added new e2e test to validate it works
  • Loading branch information
sam-c-dfe authored Jul 10, 2024
1 parent 9a3ea54 commit d23243a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ public Task<List<Qualification>> 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"
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private async Task<QualificationListModel> MapList(QualificationListPage content
{
var basicQualificationsModels = GetBasicQualificationsModels(qualifications);

var filterModel = GetFilterModel();
var filterModel = GetFilterModel(content);

return new QualificationListModel
{
Expand All @@ -109,11 +109,13 @@ private async Task<QualificationListModel> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
})
})

0 comments on commit d23243a

Please sign in to comment.