diff --git a/tests/Dfe.EarlyYearsQualification.AccessibilityTests/.pa11yci-ubuntu.js b/tests/Dfe.EarlyYearsQualification.AccessibilityTests/.pa11yci-ubuntu.js
index 10acca09..8b93ccf8 100644
--- a/tests/Dfe.EarlyYearsQualification.AccessibilityTests/.pa11yci-ubuntu.js
+++ b/tests/Dfe.EarlyYearsQualification.AccessibilityTests/.pa11yci-ubuntu.js
@@ -26,7 +26,9 @@ var config = {
"http://localhost:5000/advice/qualifications-achieved-in-wales",
"http://localhost:5000/advice/qualifications-achieved-in-northern-ireland",
"http://localhost:5000/advice/qualification-not-on-the-list",
- "http://localhost:5000/advice/qualification-level-7"
+ "http://localhost:5000/advice/qualification-level-7",
+ "http://localhost:5000/advice/level-6-qualification-pre-2014",
+ "http://localhost:5000/advice/level-6-qualification-post-2014"
]
};
diff --git a/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/journey/journey-spec.cy.js b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/journey/journey-spec.cy.js
index 2739094f..6fba4e8b 100644
--- a/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/journey/journey-spec.cy.js
+++ b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/journey/journey-spec.cy.js
@@ -203,6 +203,88 @@ describe('A spec used to test the various routes through the journey', () => {
})
})
+ it("Selecting qualification level 6 started before 1 Sept 2014 should navigate to the level 6 pre 2014 advice page", () => {
+ // 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('#england').click();
+ cy.get('button[id="question-submit"]').click();
+
+ // when-was-the-qualification-started page
+ cy.location().should((loc) => {
+ expect(loc.pathname).to.eq('/questions/when-was-the-qualification-started');
+ })
+
+ cy.get('#date-started-month').type("8");
+ cy.get('#date-started-year').type("2014");
+ cy.get('button[id="question-submit"]').click();
+
+ // what-level-is-the-qualification page
+ cy.location().should((loc) => {
+ expect(loc.pathname).to.eq('/questions/what-level-is-the-qualification');
+ })
+ cy.get('#6').click();
+ cy.get('button[id="question-submit"]').click();
+
+ // level 6 pre 2014 advice page
+ cy.location().should((loc) => {
+ expect(loc.pathname).to.eq('/advice/level-6-qualification-pre-2014');
+ })
+
+ // check back button goes back to the what level is the qualification page
+ cy.get('#back-button').click();
+
+ cy.location().should((loc) => {
+ expect(loc.pathname).to.eq('/questions/what-level-is-the-qualification');
+ })
+ })
+
+ it("Selecting qualification level 6 started after 1 Sept 2014 should navigate to the level 6 post 2014 advice page", () => {
+ // 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('#england').click();
+ cy.get('button[id="question-submit"]').click();
+
+ // when-was-the-qualification-started page
+ cy.location().should((loc) => {
+ expect(loc.pathname).to.eq('/questions/when-was-the-qualification-started');
+ })
+
+ cy.get('#date-started-month').type("8");
+ cy.get('#date-started-year').type("2015");
+ cy.get('button[id="question-submit"]').click();
+
+ // what-level-is-the-qualification page
+ cy.location().should((loc) => {
+ expect(loc.pathname).to.eq('/questions/what-level-is-the-qualification');
+ })
+ cy.get('#6').click();
+ cy.get('button[id="question-submit"]').click();
+
+ // level 6 post 2014 advice page
+ cy.location().should((loc) => {
+ expect(loc.pathname).to.eq('/advice/level-6-qualification-post-2014');
+ })
+
+ // check back button goes back to the what level is the qualification page
+ cy.get('#back-button').click();
+
+ cy.location().should((loc) => {
+ expect(loc.pathname).to.eq('/questions/what-level-is-the-qualification');
+ })
+ })
+
it("Selecting qualification level 7 should navigate to the level 7 advice page", () => {
// home page
cy.get('.govuk-button--start').click();
diff --git a/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/advice-spec.cy.js b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/advice-spec.cy.js
index cb0a6164..e19e882c 100644
--- a/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/advice-spec.cy.js
+++ b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/pages/advice-spec.cy.js
@@ -38,6 +38,20 @@ describe("A spec that tests advice pages", () => {
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");
})
+
+ it("Checks the Level 6 qualification pre 2014 details are on the page", () => {
+ cy.visit("/advice/level-6-qualification-pre-2014");
+
+ cy.get("#advice-page-heading").should("contain.text", "Level 6 qualification pre 2014");
+ cy.get("#advice-page-body").should("contain.text", "Test Advice Page Body");
+ })
+
+ it("Checks the Level 6 qualification post 2014 details are on the page", () => {
+ cy.visit("/advice/level-6-qualification-post-2014");
+
+ cy.get("#advice-page-heading").should("contain.text", "Level 6 qualification post 2014");
+ cy.get("#advice-page-body").should("contain.text", "Test Advice Page Body");
+ })
it("Checks the Qualifications level 7 details are on the page", () => {
cy.visit("/advice/qualification-level-7");
diff --git a/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/shared/urls-to-check.js b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/shared/urls-to-check.js
index c9c96207..ce51a27c 100644
--- a/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/shared/urls-to-check.js
+++ b/tests/Dfe.EarlyYearsQualification.E2ETests/cypress/e2e/shared/urls-to-check.js
@@ -1,8 +1,6 @@
export const pages = [
"/",
"/accessibility-statement",
- "/advice/qualification-outside-the-united-kingdom",
- "/advice/level-2-qualifications-started-between-1-sept-2014-and-31-aug-2019",
"/cookies",
"/questions/where-was-the-qualification-awarded",
"/questions/when-was-the-qualification-started",
@@ -11,7 +9,16 @@ export const pages = [
"/qualifications",
"/confirm-qualification/EYQ-240",
"/qualifications/qualification-details/EYQ-240",
- "/qualifications/check-additional-questions/EYQ-240"
+ "/qualifications/check-additional-questions/EYQ-240",
+ "/advice/qualification-outside-the-united-kingdom",
+ "/advice/level-2-qualifications-started-between-1-sept-2014-and-31-aug-2019",
+ "/advice/qualifications-achieved-in-scotland",
+ "/advice/qualifications-achieved-in-wales",
+ "/advice/qualifications-achieved-in-northern-ireland",
+ "/advice/qualification-not-on-the-list",
+ "/advice/qualification-level-7",
+ "/advice/level-6-qualification-pre-2014",
+ "/advice/level-6-qualification-post-2014"
];
export const pagesWithForms = [
@@ -28,11 +35,14 @@ export const pagesWithForms = [
export const pagesWithoutForms = [
"/",
"/accessibility-statement",
+ "/qualifications/qualification-details/EYQ-240",
"/advice/qualification-outside-the-united-kingdom",
"/advice/level-2-qualifications-started-between-1-sept-2014-and-31-aug-2019",
- "/qualifications/qualification-details/EYQ-240",
"/advice/qualifications-achieved-in-scotland",
"/advice/qualifications-achieved-in-wales",
"/advice/qualifications-achieved-in-northern-ireland",
"/advice/qualification-not-on-the-list",
+ "/advice/qualification-level-7",
+ "/advice/level-6-qualification-pre-2014",
+ "/advice/level-6-qualification-post-2014"
]
\ No newline at end of file
diff --git a/tests/Dfe.EarlyYearsQualification.UnitTests/Controllers/QuestionsControllerTests.cs b/tests/Dfe.EarlyYearsQualification.UnitTests/Controllers/QuestionsControllerTests.cs
index 3bfaf0a7..288e6184 100644
--- a/tests/Dfe.EarlyYearsQualification.UnitTests/Controllers/QuestionsControllerTests.cs
+++ b/tests/Dfe.EarlyYearsQualification.UnitTests/Controllers/QuestionsControllerTests.cs
@@ -679,6 +679,66 @@ public async Task Post_WhatLevelIsTheQualification_Level2WithInDate_ReturnsRedir
resultType!.ActionName.Should().Be("QualificationsStartedBetweenSept2014AndAug2019");
resultType.ControllerName.Should().Be("Advice");
}
+
+ [TestMethod]
+ public async Task Post_WhatLevelIsTheQualification_Level6Pre2014_ReturnsRedirectResponse()
+ {
+ var mockLogger = new Mock
>();
+ var mockContentService = new Mock();
+ var mockRenderer = new Mock();
+ var mockUserJourneyCookieService = new Mock();
+ var mockContentFilterService = new Mock();
+ var mockQuestionModelValidator = new Mock();
+
+ mockUserJourneyCookieService.Setup(x => x.GetWhenWasQualificationAwarded())
+ .Returns((7, 2014));
+ var controller = new QuestionsController(mockLogger.Object, mockContentService.Object, mockRenderer.Object,
+ mockUserJourneyCookieService.Object, mockContentFilterService.Object,
+ mockQuestionModelValidator.Object);
+
+ var result = await controller.WhatLevelIsTheQualification(new RadioQuestionModel
+ {
+ Option = "6"
+ });
+
+ result.Should().NotBeNull();
+
+ var resultType = result as RedirectToActionResult;
+ resultType.Should().NotBeNull();
+
+ resultType!.ActionName.Should().Be("Level6QualificationPre2014");
+ resultType.ControllerName.Should().Be("Advice");
+ }
+
+ [TestMethod]
+ public async Task Post_WhatLevelIsTheQualification_Level6Post2014_ReturnsRedirectResponse()
+ {
+ var mockLogger = new Mock>();
+ var mockContentService = new Mock();
+ var mockRenderer = new Mock();
+ var mockUserJourneyCookieService = new Mock();
+ var mockContentFilterService = new Mock();
+ var mockQuestionModelValidator = new Mock();
+
+ mockUserJourneyCookieService.Setup(x => x.GetWhenWasQualificationAwarded())
+ .Returns((7, 2015));
+ var controller = new QuestionsController(mockLogger.Object, mockContentService.Object, mockRenderer.Object,
+ mockUserJourneyCookieService.Object, mockContentFilterService.Object,
+ mockQuestionModelValidator.Object);
+
+ var result = await controller.WhatLevelIsTheQualification(new RadioQuestionModel
+ {
+ Option = "6"
+ });
+
+ result.Should().NotBeNull();
+
+ var resultType = result as RedirectToActionResult;
+ resultType.Should().NotBeNull();
+
+ resultType!.ActionName.Should().Be("Level6QualificationPost2014");
+ resultType.ControllerName.Should().Be("Advice");
+ }
[TestMethod]
public async Task Post_WhatLevelIsTheQualification_Level7_ReturnsRedirectResponse()
diff --git a/tests/Dfe.EarlyYearsQualification.UnitTests/Mocks/MockContentfulServiceTests.cs b/tests/Dfe.EarlyYearsQualification.UnitTests/Mocks/MockContentfulServiceTests.cs
index 64ab761e..123fbe0a 100644
--- a/tests/Dfe.EarlyYearsQualification.UnitTests/Mocks/MockContentfulServiceTests.cs
+++ b/tests/Dfe.EarlyYearsQualification.UnitTests/Mocks/MockContentfulServiceTests.cs
@@ -110,6 +110,32 @@ public async Task GetAdvicePage_QualificationLevel7_ReturnsExpectedDetails()
result.Body!.Content[0].Should().BeAssignableTo()
.Which.Content.Should().ContainSingle(x => ((Text)x).Value == "Test Advice Page Body");
}
+
+ [TestMethod]
+ public async Task GetAdvicePage_Level6QualificationPre2014_ReturnsExpectedDetails()
+ {
+ var contentfulService = new MockContentfulService();
+
+ var result = await contentfulService.GetAdvicePage(AdvicePages.Level6QualificationPre2014);
+ result.Should().NotBeNull();
+ result.Should().BeAssignableTo();
+ result!.Heading.Should().NotBeNullOrEmpty();
+ result.Body!.Content[0].Should().BeAssignableTo()
+ .Which.Content.Should().ContainSingle(x => ((Text)x).Value == "Test Advice Page Body");
+ }
+
+ [TestMethod]
+ public async Task GetAdvicePage_Level6QualificationPost2014_ReturnsExpectedDetails()
+ {
+ var contentfulService = new MockContentfulService();
+
+ var result = await contentfulService.GetAdvicePage(AdvicePages.Level6QualificationPost2014);
+ result.Should().NotBeNull();
+ result.Should().BeAssignableTo();
+ result!.Heading.Should().NotBeNullOrEmpty();
+ result.Body!.Content[0].Should().BeAssignableTo()
+ .Which.Content.Should().ContainSingle(x => ((Text)x).Value == "Test Advice Page Body");
+ }
[TestMethod]
public async Task GetAdvicePage_UnknownEntryId_ReturnsException()
@@ -292,13 +318,15 @@ public async Task GetRadioQuestionPage_PassInWhatLevelIsTheQualification_Returns
result.AdditionalInformationBody!.Content[0].Should().BeAssignableTo()
.Which.Content.Should().ContainSingle(x => ((Text)x).Value == "This is the additional information body");
result.Options.Should().NotBeNullOrEmpty();
- result.Options.Count.Should().Be(3);
+ result.Options.Count.Should().Be(4);
result.Options[0].Label.Should().Be("Level 2");
result.Options[0].Value.Should().Be("2");
result.Options[1].Label.Should().Be("Level 3");
result.Options[1].Value.Should().Be("3");
- result.Options[2].Label.Should().Be("Level 7");
- result.Options[2].Value.Should().Be("7");
+ result.Options[2].Label.Should().Be("Level 6");
+ result.Options[2].Value.Should().Be("6");
+ result.Options[3].Label.Should().Be("Level 7");
+ result.Options[3].Value.Should().Be("7");
}
[TestMethod]
diff --git a/tests/Dfe.EarlyYearsQualification.UnitTests/Renderers/Heading4RendererTests.cs b/tests/Dfe.EarlyYearsQualification.UnitTests/Renderers/Heading4RendererTests.cs
index f171f65c..fd2ce0a0 100644
--- a/tests/Dfe.EarlyYearsQualification.UnitTests/Renderers/Heading4RendererTests.cs
+++ b/tests/Dfe.EarlyYearsQualification.UnitTests/Renderers/Heading4RendererTests.cs
@@ -42,6 +42,6 @@ public void Heading4Renderer_RendersHeading()
var result = new Heading4Renderer().RenderAsync(heading).Result;
- result.Should().Be("Heading text
");
+ result.Should().Be("Heading text
");
}
}
\ No newline at end of file