Skip to content

Commit

Permalink
Merge pull request #243 from DFE-Digital/feature/country-static-pages
Browse files Browse the repository at this point in the history
New Scotland, Wales and NI advice pages
  • Loading branch information
DanielClarkeEducation authored Jul 18, 2024
2 parents a6f0085 + 9fd14b0 commit 52f4167
Show file tree
Hide file tree
Showing 12 changed files with 430 additions and 11 deletions.
15 changes: 15 additions & 0 deletions src/Dfe.EarlyYearsQualification.Content/Constants/AdvicePages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,19 @@ public static class AdvicePages
/// Entry ID for the "Level 2 qualifications started between 1 September 2014 and 31 August 2019" advice page.
/// </summary>
public const string QualificationsStartedBetweenSept2014AndAug2019 = "5orvwKkqUUggkzP0rlAX23";

/// <summary>
/// Entry ID for the "Qualifications achieved in Northern Ireland" advice page.
/// </summary>
public const string QualificationsAchievedInNorthernIreland = "6PQgouvhAqW3IPonOcTsex";

/// <summary>
/// Entry ID for the "Qualifications achieved in Scotland" advice page.
/// </summary>
public const string QualificationsAchievedInScotland = "3deQYTynsM9iLnJ5fgFqk";

/// <summary>
/// Entry ID for the "Qualifications achieved in Northern Ireland" advice page.
/// </summary>
public const string QualificationsAchievedInWales = "1Xu4FPcZDxFb5yDCI6lLCj";
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ await Task.FromResult(CreateAdvicePage("Qualifications achieved outside the Unit
await
Task.FromResult(CreateAdvicePage("Level 2 qualifications started between 1 September 2014 and 31 August 2019",
body, "/questions/what-level-is-the-qualification")),

AdvicePages.QualificationsAchievedInScotland =>
await Task.FromResult(CreateAdvicePage("Qualifications achieved in Scotland",
body, "/questions/where-was-the-qualification-awarded")),

AdvicePages.QualificationsAchievedInWales =>
await Task.FromResult(CreateAdvicePage("Qualifications achieved in Wales",
body, "/questions/where-was-the-qualification-awarded")),

AdvicePages.QualificationsAchievedInNorthernIreland =>
await Task.FromResult(CreateAdvicePage("Qualifications achieved in Northern Ireland",
body, "/questions/where-was-the-qualification-awarded")),
_ => null
};
}
Expand Down Expand Up @@ -318,6 +330,18 @@ private static RadioQuestionPage CreateWhereWasTheQualificationAwardedPage()
Label = "England", Value = "england"
},
new()
{
Label = "Scotland", Value = "scotland"
},
new()
{
Label = "Wales", Value = "wales"
},
new()
{
Label = "Northern Ireland", Value = "northern-ireland"
},
new()
{
Label = "Outside the United Kingdom",
Value = "outside-uk"
Expand Down
14 changes: 12 additions & 2 deletions src/Dfe.EarlyYearsQualification.Web/Constants/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@ public static class Options
public const string England = "england";

/// <summary>
/// Option for Scotland, Wales and Northern Ireland.
/// Option for Scotland
/// </summary>
public const string ScotlandWalesNi = "scotland-wales-ni";
public const string Scotland = "scotland";

/// <summary>
/// Option for Wales
/// </summary>
public const string Wales = "wales";

/// <summary>
/// Option for Northern Ireland
/// </summary>
public const string NorthernIreland = "northern-ireland";

/// <summary>
/// Option for Not Sure.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@ public async Task<IActionResult> QualificationsStartedBetweenSept2014AndAug2019(
{
return await GetView(AdvicePages.QualificationsStartedBetweenSept2014AndAug2019);
}

[HttpGet("qualifications-achieved-in-northern-ireland")]
public async Task<IActionResult> QualificationsAchievedInNorthernIreland()
{
return await GetView(AdvicePages.QualificationsAchievedInNorthernIreland);
}

[HttpGet("qualifications-achieved-in-scotland")]
public async Task<IActionResult> QualificationsAchievedInScotland()
{
return await GetView(AdvicePages.QualificationsAchievedInScotland);
}

[HttpGet("qualifications-achieved-in-wales")]
public async Task<IActionResult> QualificationsAchievedInWales()
{
return await GetView(AdvicePages.QualificationsAchievedInWales);
}

private async Task<IActionResult> GetView(string advicePageId)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,16 @@ public async Task<IActionResult> WhereWasTheQualificationAwarded(RadioQuestionMo
return View("Radio", model);
}

if (model.Option == Options.OutsideOfTheUnitedKingdom)
switch (model.Option)
{
return RedirectToAction("QualificationOutsideTheUnitedKingdom", "Advice");
case Options.OutsideOfTheUnitedKingdom:
return RedirectToAction("QualificationOutsideTheUnitedKingdom", "Advice");
case Options.Scotland:
return RedirectToAction("QualificationsAchievedInScotland", "Advice");
case Options.Wales:
return RedirectToAction("QualificationsAchievedInWales", "Advice");
case Options.NorthernIreland:
return RedirectToAction("QualificationsAchievedInNorthernIreland", "Advice");
}

userJourneyCookieService.SetWhereWasQualificationAwarded(model.Option!);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ var config = {
"http://localhost:5000/confirm-qualification/eyq-240",
"http://localhost:5000/qualifications/qualification-details/eyq-240",
"http://localhost:5000/advice/level-2-qualifications-started-between-1-sept-2014-and-31-aug-2019",
"http://localhost:5000/advice/qualification-outside-the-united-kingdom"
"http://localhost:5000/advice/qualification-outside-the-united-kingdom",
"http://localhost:5000/advice/qualifications-achieved-in-scotland",
"http://localhost:5000/advice/qualifications-achieved-in-wales",
"http://localhost:5000/advice/qualifications-achieved-in-northern-ireland"
]
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,60 @@ describe('A spec used to test the various routes through the journey', () => {
})
})

it("should redirect the user when they select qualification was awarded in Scotland", () => {
// home page
cy.get('.govuk-button--start').click();

// where-was-the-qualification-awarded page
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/questions/where-was-the-qualification-awarded');
})

cy.get('#scotland').click();
cy.get('button[id="question-submit"]').click();

// qualifications-achieved-in-scotland
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/advice/qualifications-achieved-in-scotland');
})
})

it("should redirect the user when they select qualification was awarded in Wales", () => {
// home page
cy.get('.govuk-button--start').click();

// where-was-the-qualification-awarded page
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/questions/where-was-the-qualification-awarded');
})

cy.get('#wales').click();
cy.get('button[id="question-submit"]').click();

// qualifications-achieved-in-wales
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/advice/qualifications-achieved-in-wales');
})
})

it("should redirect the user when they select qualification was awarded in Northern Ireland", () => {
// home page
cy.get('.govuk-button--start').click();

// where-was-the-qualification-awarded page
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/questions/where-was-the-qualification-awarded');
})

cy.get('#northern-ireland').click();
cy.get('button[id="question-submit"]').click();

// qualifications-achieved-in-scotland
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/advice/qualifications-achieved-in-northern-ireland');
})
})

it("should redirect the user when they select qualification was awarded in England", () => {
// home page
cy.get('.govuk-button--start').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,38 @@ describe("A spec that tests advice pages", () => {
})

// Mock details found in Dfe.EarlyYearsQualification.Mock.Content.MockContentfulService.
it("Checks the qualification details are on the page", () => {
it("Checks the Qualifications achieved outside the United Kingdom details are on the page", () => {
cy.visit("/advice/qualification-outside-the-united-kingdom");

cy.get("#advice-page-heading").should("contain.text", "Qualifications achieved outside the United Kingdom");
cy.get("#advice-page-body").should("contain.text", "Test Advice Page Body");
})

it("Checks the level 2 between 1 Sept 2014 and 31 Aug 2019 are on the page", () => {
it("Checks the level 2 between 1 Sept 2014 and 31 Aug 2019 details are on the page", () => {
cy.visit("/advice/level-2-qualifications-started-between-1-sept-2014-and-31-aug-2019");

cy.get("#advice-page-heading").should("contain.text", "Level 2 qualifications started between 1 September 2014 and 31 August 2019");
cy.get("#advice-page-body").should("contain.text", "Test Advice Page Body");
})

it("Checks the Qualifications achieved in Scotland details are on the page", () => {
cy.visit("/advice/qualifications-achieved-in-scotland");

cy.get("#advice-page-heading").should("contain.text", "Qualifications achieved in Scotland");
cy.get("#advice-page-body").should("contain.text", "Test Advice Page Body");
})

it("Checks the Qualifications achieved in Wales details are on the page", () => {
cy.visit("/advice/qualifications-achieved-in-wales");

cy.get("#advice-page-heading").should("contain.text", "Qualifications achieved in Wales");
cy.get("#advice-page-body").should("contain.text", "Test Advice Page Body");
})

it("Checks the Qualifications achieved in Northern Ireland details are on the page", () => {
cy.visit("/advice/qualifications-achieved-in-northern-ireland");

cy.get("#advice-page-heading").should("contain.text", "Qualifications achieved in Northern Ireland");
cy.get("#advice-page-body").should("contain.text", "Test Advice Page Body");
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@ export const pagesWithoutForms = [
"/accessibility-statement",
"/advice/qualification-outside-the-united-kingdom",
"/advice/level-2-qualifications-started-between-1-sept-2014-and-31-aug-2019",
"/qualifications/qualification-details/EYQ-240"
"/qualifications/qualification-details/EYQ-240",
"/advice/qualifications-achieved-in-scotland",
"/advice/qualifications-achieved-in-wales",
"/advice/qualifications-achieved-in-northern-ireland",
]
Loading

0 comments on commit 52f4167

Please sign in to comment.