Skip to content

Commit

Permalink
Merge pull request #884 from DFE-Digital/feature/181754
Browse files Browse the repository at this point in the history
Added ROM YesNo + forecast date to frontend and API tests
  • Loading branch information
sukhybhullar-nimble authored Oct 8, 2024
2 parents a024576 + 3c9cd11 commit b4746e2
Show file tree
Hide file tree
Showing 14 changed files with 13,010 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
using Dfe.ManageFreeSchoolProjects.API.Contracts.Common;

namespace Dfe.ManageFreeSchoolProjects.API.Contracts.Project.Tasks;

public class ReadinessToOpenMeetingTask
{
public YesNo? AROMIsExpectedToHappen { get; set; }

public DateTime? ExpectedDateOfTheMeeting { get; set; }

public TypeOfMeetingHeld TypeOfMeetingHeld { get; set; }

public DateTime? DateOfTheMeeting { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Net;
using System.Threading.Tasks;
using Dfe.ManageFreeSchoolProjects.API.Contracts.Project.Tasks;
using Dfe.ManageFreeSchoolProjects.API.Contracts.Common;
using Dfe.ManageFreeSchoolProjects.API.Tests.Fixtures;
using Dfe.ManageFreeSchoolProjects.API.Tests.Helpers;

Expand All @@ -24,7 +25,9 @@ public async Task Patch_NewROM_Then_NewROMCreated()
{
ReadinessToOpenMeetingTask = new ReadinessToOpenMeetingTask
{
DateOfTheMeeting = new DateTime().Date,
AROMIsExpectedToHappen = YesNo.Yes,
ExpectedDateOfTheMeeting = new DateTime().Date,
DateOfTheMeeting = new DateTime().Date.AddDays(1),
TypeOfMeetingHeld = TypeOfMeetingHeld.InformalMeeting,
WhyMeetingWasNotHeld = null,
PrincipalDesignateHasProvidedTheChecklist = true,
Expand All @@ -37,6 +40,10 @@ public async Task Patch_NewROM_Then_NewROMCreated()
var projectResponse =
await _client.UpdateProjectTask(projectId, request, TaskName.ReadinessToOpenMeeting.ToString());

projectResponse.ReadinessToOpenMeetingTask.AROMIsExpectedToHappen.Should()
.Be(request.ReadinessToOpenMeetingTask.AROMIsExpectedToHappen);
projectResponse.ReadinessToOpenMeetingTask.ExpectedDateOfTheMeeting.Should()
.Be(request.ReadinessToOpenMeetingTask.ExpectedDateOfTheMeeting);
projectResponse.ReadinessToOpenMeetingTask.DateOfTheMeeting.Should()
.Be(request.ReadinessToOpenMeetingTask.DateOfTheMeeting);
projectResponse.ReadinessToOpenMeetingTask.TypeOfMeetingHeld.Should()
Expand Down Expand Up @@ -72,14 +79,17 @@ public async Task Patch_Existing_ROM_Then_ExistingROMUpdated()
{
ReadinessToOpenMeetingTask = new ReadinessToOpenMeetingTask
{
AROMIsExpectedToHappen = YesNo.No,
SavedTheInternalRomReportToWorkplacesFolder = false,
CommissionedAnExternalExpertToAttendAnyMeetingsIfApplicable = false,
SavedTheExternalRomReportToWorkplacesFolder = false
}
};

var updateProjRes = await _client.UpdateProjectTask(projectId, request, TaskName.ReadinessToOpenMeeting.ToString());


updateProjRes.ReadinessToOpenMeetingTask.AROMIsExpectedToHappen.Should().Be(YesNo.No);
updateProjRes.ReadinessToOpenMeetingTask.ExpectedDateOfTheMeeting.Should().BeNull();
updateProjRes.ReadinessToOpenMeetingTask.SavedTheInternalRomReportToWorkplacesFolder.Should().BeFalse();
updateProjRes.ReadinessToOpenMeetingTask.CommissionedAnExternalExpertToAttendAnyMeetingsIfApplicable.Should().BeFalse();
updateProjRes.ReadinessToOpenMeetingTask.SavedTheExternalRomReportToWorkplacesFolder.Should().BeFalse();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Dfe.ManageFreeSchoolProjects.API.Contracts.Project.Tasks;
using Dfe.ManageFreeSchoolProjects.Data.Entities.Existing;
using Dfe.ManageFreeSchoolProjects.Data.Migrations;

namespace Dfe.ManageFreeSchoolProjects.API.UseCases.Project.Tasks.ReadinessToOpenMeeting;

Expand All @@ -12,6 +13,8 @@ public static ReadinessToOpenMeetingTask Build(Milestones milestones)

return new ReadinessToOpenMeetingTask
{
AROMIsExpectedToHappen = milestones.AROMIsExpectedToHappen,
ExpectedDateOfTheMeeting = milestones.FsgPreOpeningMilestonesRomForecastDate,
DateOfTheMeeting = milestones.FsgPreOpeningMilestonesRomActualDateOfCompletion,
TypeOfMeetingHeld = EnumParsers.ParseTypeOfMeetingHeld(milestones.ROMTypeOfMeetingHeld),
WhyMeetingWasNotHeld = milestones.ROMWhyAMeetingWasNotHeld,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ public async Task Update(UpdateTaskServiceParameters parameters)
db = new Data.Entities.Existing.Milestones { Rid = dbKpi.Rid };
context.Add(db);
}


db.AROMIsExpectedToHappen = parameters.Request.ReadinessToOpenMeetingTask.AROMIsExpectedToHappen;

db.FsgPreOpeningMilestonesRomForecastDate = parameters.Request.ReadinessToOpenMeetingTask.ExpectedDateOfTheMeeting;

db.FsgPreOpeningMilestonesRomActualDateOfCompletion =
parameters.Request.ReadinessToOpenMeetingTask.DateOfTheMeeting;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe("Testing readiness to open meeting task", () => {
.schoolNameIs(project.schoolName)
.titleIs("Readiness to open meeting (ROM)")
.inOrder()
.summaryShows("A ROM is expected to happen").IsEmpty().HasChangeLink()
.summaryShows("Type of meeting held").IsEmpty().HasChangeLink()
.summaryShows("Principal designate (PD) has provided the checklist").IsEmpty().HasChangeLink()
.summaryShows("Commissioned an external expert to attend any meetings (if applicable)").IsEmpty().HasChangeLink()
Expand All @@ -56,6 +57,14 @@ describe("Testing readiness to open meeting task", () => {
summaryPage.clickChange();

readinessToOpenMeetingEditPage
.selectAROMIsExpectedToHappenYes()
.expectedDateOfTheMeeting("60", "12", "2050")
.clickContinue()
.errorForExpectedMeetingDate("Day must be between 1 and 31")
.expectedDateOfTheMeeting("30", "12", "1999")
.clickContinue()
.errorForExpectedMeetingDate("Year must be between 2000 and 2050")
.expectedDateOfTheMeeting("5", "6", "2040")
.selectFormalMeeting()
.dateOfTheFormalMeeting("60", "12", "2050")
.clickContinue()
Expand All @@ -76,6 +85,8 @@ describe("Testing readiness to open meeting task", () => {
.schoolNameIs(project.schoolName)
.titleIs("Readiness to open meeting (ROM)")
.inOrder()
.summaryShows("A ROM is expected to happen").HasValue("Yes").HasChangeLink()
.summaryShows("Expected date of the meeting").HasValue("5 June 2040").HasChangeLink()
.summaryShows("Type of meeting held").HasValue("Formal meeting").HasChangeLink()
.summaryShows("Date of the meeting").HasValue("5 May 2040").HasChangeLink()
.summaryShows("Principal designate (PD) has provided the checklist").HasValue("Yes").HasChangeLink()
Expand All @@ -94,6 +105,7 @@ describe("Testing readiness to open meeting task", () => {
summaryPage.clickChange();

readinessToOpenMeetingEditPage
.selectAROMIsExpectedToHappenNo()
.selectNoRomHeld()
.whyMeetingWasNotHeld()
.uncheckPrincipalDesignate()
Expand All @@ -108,6 +120,7 @@ describe("Testing readiness to open meeting task", () => {
.schoolNameIs(project.schoolName)
.titleIs("Readiness to open meeting (ROM)")
.inOrder()
.summaryShows("A ROM is expected to happen").HasValue("No").HasChangeLink()
.summaryShows("Type of meeting held").HasValue("No meeting held").HasChangeLink()
.summaryShows("Why a meeting was not held").HasValue("This is the reason why meeting was not held").HasChangeLink()
.summaryShows("Principal designate (PD) has provided the checklist").IsEmpty().HasChangeLink()
Expand All @@ -125,6 +138,8 @@ describe("Testing readiness to open meeting task", () => {
Logger.log("Should be able to select Informal meeting");

readinessToOpenMeetingEditPage
.selectAROMIsExpectedToHappenYes()
.expectedDateOfTheMeeting("6", "6", "2040")
.selectInformalMeeting()
.dateOfTheInformalMeeting("60", "12", "2050")
.clickContinue()
Expand All @@ -143,6 +158,8 @@ describe("Testing readiness to open meeting task", () => {
.schoolNameIs(project.schoolName)
.titleIs("Readiness to open meeting (ROM)")
.inOrder()
.summaryShows("A ROM is expected to happen").HasValue("Yes").HasChangeLink()
.summaryShows("Expected date of the meeting").HasValue("6 June 2040").HasChangeLink()
.summaryShows("Type of meeting held").HasValue("Informal meeting").HasChangeLink()
.summaryShows("Date of the meeting").HasValue("23 May 2030").HasChangeLink()
.summaryShows("Principal designate (PD) has provided the checklist").HasValue("Yes").HasChangeLink()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
class ReadinessToOpenMeetingEditPage {
private errorTracking = "";

selectAROMIsExpectedToHappenYes(): this {
cy.getById("a-rom-is-expected-to-happen-yes").click()
return this
}

selectAROMIsExpectedToHappenNo(): this {
cy.getById("a-rom-is-expected-to-happen-no").click()
return this
}

selectFormalMeeting(): this {
cy.getById("formal-meeting-option").click()
return this
Expand Down Expand Up @@ -61,6 +71,14 @@ class ReadinessToOpenMeetingEditPage {
return this
}


expectedDateOfTheMeeting(day: string, month: string, year: string): this {
const key = "expected-date-of-the-meeting";
this.setDate(key, day, month, year);
return this
}


dateOfTheFormalMeeting(day: string, month: string, year: string): this {
const key = "date-of-the-formal-meeting";
this.setDate(key, day, month, year);
Expand All @@ -83,6 +101,11 @@ class ReadinessToOpenMeetingEditPage {
return this;
}

errorForExpectedMeetingDate(error: string): this {
cy.getById('expected-date-of-the-meeting-error').contains(error)
return this
}

errorForFormalMeetingDate(error: string): this {
cy.getById('date-of-the-formal-meeting-error').contains(error)
return this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,7 @@ public partial class Milestones
public bool? FsgPreOpeningMilestonesMfadIncludedSignedOffImpactAssessmentFaHealthCheck { get; set; }

public bool? FsgPreOpeningMilestonesMfadIncludedSignedOffImpactAssessmentFaSubmission { get; set; }

public YesNo? AROMIsExpectedToHappen { get; set; }
}
}
Loading

0 comments on commit b4746e2

Please sign in to comment.