From 63473c90faa679e24d45504298522164b7b608b9 Mon Sep 17 00:00:00 2001
From: jack-nimbleapproach
<128064239+jack-nimbleapproach@users.noreply.github.com>
Date: Wed, 9 Oct 2024 15:23:29 +0100
Subject: [PATCH] Updated wording impact assessment and improved cypress tests
(#893)
* Updated wording impact assessment and improved cypress tests]
* Release notes
* Removed booleans literals
---
.../impact-assessment.cy.ts | 133 +++++++++++++++++-
.../edit-impact-assessment-cy.ts | 46 +++++-
.../EditImpactAssessmentTask.cshtml | 7 +-
.../EditImpactAssessmentTask.cshtml.cs | 1 -
.../ViewImpactAssessmentTask.cshtml | 6 +-
release-notes.md | 1 +
6 files changed, 188 insertions(+), 6 deletions(-)
diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/e2e/tasks/Getting-ready-to-open/impact-assessment.cy.ts b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/e2e/tasks/Getting-ready-to-open/impact-assessment.cy.ts
index 1886bd4fa..8a42e4bab 100644
--- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/e2e/tasks/Getting-ready-to-open/impact-assessment.cy.ts
+++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/e2e/tasks/Getting-ready-to-open/impact-assessment.cy.ts
@@ -6,7 +6,7 @@ import summaryPage from "cypress/pages/task-summary-base";
import taskListPage from "cypress/pages/taskListPage";
import impactAssessmentEditPage from "../../../pages/tasks/Getting-ready-to-open/edit-impact-assessment-cy";
-describe("Testing the impact assessment task", () => {
+describe("Testing the impact assessment task - presumption route", () => {
let project: ProjectDetailsRequest;
@@ -34,6 +34,103 @@ describe("Testing the impact assessment task", () => {
.titleIs("Impact assessment")
.inOrder()
.summaryShows("Conducted the impact assessment").IsEmpty().HasChangeLink()
+ .summaryShows("Saved the signed-off impact assessment in Workplaces folder").IsEmpty().HasChangeLink()
+ .isNotMarkedAsComplete();
+
+ Logger.log("Go back to task list");
+ summaryPage.clickBack();
+
+ taskListPage.selectImpactAssessmentFromTaskList();
+ summaryPage.clickChange();
+
+ Logger.log("Impact assessment can save null values");
+
+ impactAssessmentEditPage
+ .clickContinue()
+
+ summaryPage
+ .schoolNameIs(project.schoolName)
+ .titleIs("Impact assessment")
+ .inOrder()
+ .summaryShows("Conducted the impact assessment").IsEmpty().HasChangeLink()
+ .summaryShows("Saved the signed-off impact assessment in Workplaces folder").IsEmpty().HasChangeLink()
+ .isNotMarkedAsComplete()
+ .clickChange();
+
+ cy.executeAccessibilityTests();
+
+ Logger.log("Impact assessment can be edited");
+
+ impactAssessmentEditPage
+ .checkImpactAssessmentDone()
+ .checkSavedToWorkplaces()
+ .clickContinue()
+
+ Logger.log("Should update the task status");
+
+ summaryPage
+ .schoolNameIs(project.schoolName)
+ .titleIs("Impact assessment")
+ .inOrder()
+ .summaryShows("Conducted the impact assessment").HasValue("Yes").HasChangeLink()
+ .summaryShows("Saved the signed-off impact assessment in Workplaces folder").HasValue("Yes").HasChangeLink()
+ .isNotMarkedAsComplete()
+ .clickConfirmAndContinue()
+
+ taskListPage.isTaskStatusInProgress("ImpactAssessment");
+
+ taskListPage.selectImpactAssessmentFromTaskList();
+ summaryPage.clickChange();
+
+ impactAssessmentEditPage
+ .uncheckImpactAssessmentDone()
+ .uncheckSavedToWorkplaces()
+ .clickContinue()
+
+ summaryPage
+ .schoolNameIs(project.schoolName)
+ .titleIs("Impact assessment")
+ .inOrder()
+ .summaryShows("Conducted the impact assessment").IsEmpty().HasChangeLink()
+ .summaryShows("Saved the signed-off impact assessment in Workplaces folder").IsEmpty().HasChangeLink()
+ .isNotMarkedAsComplete()
+ .MarkAsComplete()
+ .clickConfirmAndContinue()
+
+ taskListPage.isTaskStatusIsCompleted("ImpactAssessment");
+ });
+});
+
+describe("Testing the impact assessment task - central route", () => {
+
+ let project: ProjectDetailsRequest;
+
+ beforeEach(() => {
+ cy.login();
+
+ project = RequestBuilder.createProjectDetailsCentralRoute();
+
+ projectApi
+ .post({
+ projects: [project],
+ })
+ .then(() => {
+ cy.visit(`/projects/${project.projectId}/tasks`);
+ });
+ });
+
+ it("Should include section 9 letter wording for saved in workplaces label", () => {
+ Logger.log("Select impact assessment");
+ taskListPage.isTaskStatusIsNotStarted("ImpactAssessment")
+ .selectImpactAssessmentFromTaskList();
+
+ summaryPage
+ .schoolNameIs(project.schoolName)
+ .titleIs("Impact assessment")
+ .inOrder()
+ .summaryShows("Sent the section 9 letter to local authority").HasValue("No").HasChangeLink()
+ .summaryShows("Date sent").IsEmpty().HasChangeLink()
+ .summaryShows("Conducted the impact assessment").IsEmpty().HasChangeLink()
.summaryShows("Saved the section 9 letter and signed-off impact assessment in Workplaces folder").IsEmpty().HasChangeLink()
.isNotMarkedAsComplete();
@@ -52,6 +149,8 @@ describe("Testing the impact assessment task", () => {
.schoolNameIs(project.schoolName)
.titleIs("Impact assessment")
.inOrder()
+ .summaryShows("Sent the section 9 letter to local authority").HasValue("No").HasChangeLink()
+ .summaryShows("Date sent").IsEmpty().HasChangeLink()
.summaryShows("Conducted the impact assessment").IsEmpty().HasChangeLink()
.summaryShows("Saved the section 9 letter and signed-off impact assessment in Workplaces folder").IsEmpty().HasChangeLink()
.isNotMarkedAsComplete()
@@ -72,6 +171,8 @@ describe("Testing the impact assessment task", () => {
.schoolNameIs(project.schoolName)
.titleIs("Impact assessment")
.inOrder()
+ .summaryShows("Sent the section 9 letter to local authority").HasValue("No").HasChangeLink()
+ .summaryShows("Date sent").IsEmpty().HasChangeLink()
.summaryShows("Conducted the impact assessment").HasValue("Yes").HasChangeLink()
.summaryShows("Saved the section 9 letter and signed-off impact assessment in Workplaces folder").HasValue("Yes").HasChangeLink()
.isNotMarkedAsComplete()
@@ -80,9 +181,37 @@ describe("Testing the impact assessment task", () => {
taskListPage.isTaskStatusInProgress("ImpactAssessment");
taskListPage.selectImpactAssessmentFromTaskList();
+
summaryPage.clickChange();
impactAssessmentEditPage
+ .checkSentSection9()
+ .withDateSent("2","ds","2050")
+ .clickContinue()
+ .errorDateSent().showsError("Enter a date in the correct format")
+ .withDateSent("2","2","2090")
+ .clickContinue()
+ .errorDateSent().showsError("Year must be between 2000 and 2050")
+ .withDateSent("2","2","1999")
+ .clickContinue()
+ .errorDateSent().showsError("Year must be between 2000 and 2050")
+ .withDateSent("2","2","2049")
+ .clickContinue()
+
+ summaryPage
+ .schoolNameIs(project.schoolName)
+ .titleIs("Impact assessment")
+ .inOrder()
+ .summaryShows("Sent the section 9 letter to local authority").HasValue("Yes").HasChangeLink()
+ .summaryShows("Date sent").HasValue("2 February 2049").HasChangeLink()
+ .summaryShows("Conducted the impact assessment").HasValue("Yes").HasChangeLink()
+ .summaryShows("Saved the section 9 letter and signed-off impact assessment in Workplaces folder").HasValue("Yes").HasChangeLink()
+ .isNotMarkedAsComplete()
+ .clickChange();
+
+ impactAssessmentEditPage
+ .uncheckSentSection9()
+ .withDateSent("", "", "")
.uncheckImpactAssessmentDone()
.uncheckSavedToWorkplaces()
.clickContinue()
@@ -91,6 +220,8 @@ describe("Testing the impact assessment task", () => {
.schoolNameIs(project.schoolName)
.titleIs("Impact assessment")
.inOrder()
+ .summaryShows("Sent the section 9 letter to local authority").HasValue("No").HasChangeLink()
+ .summaryShows("Date sent").IsEmpty().HasChangeLink()
.summaryShows("Conducted the impact assessment").IsEmpty().HasChangeLink()
.summaryShows("Saved the section 9 letter and signed-off impact assessment in Workplaces folder").IsEmpty().HasChangeLink()
.isNotMarkedAsComplete()
diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/pages/tasks/Getting-ready-to-open/edit-impact-assessment-cy.ts b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/pages/tasks/Getting-ready-to-open/edit-impact-assessment-cy.ts
index 0828db087..4e976edf3 100644
--- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/pages/tasks/Getting-ready-to-open/edit-impact-assessment-cy.ts
+++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects.CypressTests/cypress/pages/tasks/Getting-ready-to-open/edit-impact-assessment-cy.ts
@@ -1,6 +1,10 @@
class ImpactAssessmentEditPage {
-
-
+ private errorTracking = "";
+ private setDate(key: string, day: string, month: string, year: string) {
+ cy.get('#' + `${key}-day`).typeFast(day);
+ cy.get('#' + `${key}-month`).typeFast(month);
+ cy.get('#' + `${key}-year`).typeFast(year);
+ }
checkImpactAssessmentDone(): this {
cy.getById("impact-assessment-done").check()
@@ -21,6 +25,44 @@ class ImpactAssessmentEditPage {
cy.getById("saved-to-workplaces").uncheck()
return this
}
+
+ checkSentSection9(): this {
+ cy.getById("sent-section9-letter-to-local-authority").check()
+ return this
+ }
+
+ uncheckSentSection9(): this {
+ cy.getById("sent-section9-letter-to-local-authority").uncheck()
+ return this
+ }
+
+ withDateSent(day: string, month: string, year: string): this {
+ const key = "date-sent";
+ this.setDate(key, day, month, year);
+ return this
+ }
+
+ errorDateSent(): this {
+ this.errorTracking = "date-sent";
+ return this;
+ }
+
+ showsError(error: string)
+ {
+ cy.get(`#${this.errorTracking}-error-link`)
+ .should("contain.text", error);
+
+ cy.get(`#${this.errorTracking}-error-link`)
+ .invoke('attr', 'href')
+ .then((href) => {
+ cy.get(href as string).should("exist");
+ });
+
+ cy.get(`#${this.errorTracking}-error`)
+ .should("contain.text", error);
+ return this;
+ }
+
clickContinue() : this {
cy.getByTestId("continue").click();
return this;
diff --git a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/Tasks/ImpactAssessment/EditImpactAssessmentTask.cshtml b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/Tasks/ImpactAssessment/EditImpactAssessmentTask.cshtml
index 660f68ab4..0d2e8edcc 100644
--- a/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/Tasks/ImpactAssessment/EditImpactAssessmentTask.cshtml
+++ b/Dfe.ManageFreeSchoolProjects/Dfe.ManageFreeSchoolProjects/Pages/Project/Tasks/ImpactAssessment/EditImpactAssessmentTask.cshtml
@@ -5,6 +5,11 @@
ViewData["Title"] = $"Edit Impact assessment - {Model.SchoolName}";
var backlink = string.Format(RouteConstants.ViewImpactAssessmentTask, Model.ProjectId);
+
+ var SavedInWorkplacesFolderLabel = Model.IsPresumptionRoute
+ ? "Saved the signed-off impact assessment in Workplaces folder"
+ : "Saved the section 9 letter and signed-off impact assessment in Workplaces folder";
+
}
@section BeforeMain {
@@ -59,7 +64,7 @@
id="impact-assessment-done"
add-margin=false />
-