-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #838 from DFE-Digital/test/readiness-to-open-meeting
Readiness to open meeting test
- Loading branch information
Showing
3 changed files
with
277 additions
and
0 deletions.
There are no files selected for viewing
159 changes: 159 additions & 0 deletions
159
...ects.CypressTests/cypress/e2e/tasks/Getting-ready-to-open/readiness-to-open-meeting.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
import { ProjectDetailsRequest } from "cypress/api/domain"; | ||
import projectApi from "cypress/api/projectApi"; | ||
import { RequestBuilder } from "cypress/api/requestBuilder"; | ||
import { Logger } from "cypress/common/logger"; | ||
import summaryPage from "cypress/pages/task-summary-base"; | ||
import taskListPage from "cypress/pages/taskListPage"; | ||
import readinessToOpenMeetingEditPage from "../../../pages/tasks/Getting-ready-to-open/edit-readiness-to-open-meeting-cy"; | ||
|
||
describe("Testing readiness to open meeting task", () => { | ||
|
||
let project: ProjectDetailsRequest; | ||
|
||
beforeEach(() => { | ||
cy.login(); | ||
|
||
project = RequestBuilder.createProjectDetails(); | ||
|
||
projectApi | ||
.post({ | ||
projects: [project], | ||
}) | ||
.then(() => { | ||
cy.visit(`/projects/${project.projectId}/tasks`); | ||
}); | ||
}); | ||
|
||
it("Should be able to set readiness to open meeting", () => { | ||
Logger.log("Select moving to open"); | ||
taskListPage.isTaskStatusIsNotStarted("ReadinessToOpenMeeting") | ||
.selectReadinessToOpenMeetingFromTaskList(); | ||
|
||
summaryPage | ||
.schoolNameIs(project.schoolName) | ||
.titleIs("Readiness to open meeting (ROM)") | ||
.inOrder() | ||
.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() | ||
.summaryShows("Saved the internal ROM report in Workplaces folder").IsEmpty().HasChangeLink() | ||
.summaryShows("Saved the external ROM report in Workplaces folder").IsEmpty().HasChangeLink() | ||
.isNotMarkedAsComplete() | ||
.reviewRiskRating(); | ||
|
||
Logger.log("Go back to task list"); | ||
summaryPage.clickBack(); | ||
|
||
taskListPage.selectReadinessToOpenMeetingFromTaskList(); | ||
summaryPage.clickChange(); | ||
|
||
Logger.log("Readiness to Open Meeting can save null values"); | ||
|
||
readinessToOpenMeetingEditPage | ||
.clickContinue() | ||
|
||
Logger.log("Readiness to Open Meeting can be edited"); | ||
|
||
summaryPage.clickChange(); | ||
|
||
readinessToOpenMeetingEditPage | ||
.selectFormalMeeting() | ||
.dateOfTheFormalMeeting("60", "12", "2050") | ||
.clickContinue() | ||
.errorForFormalMeetingDate("Day must be between 1 and 31") | ||
.dateOfTheFormalMeeting("30", "12", "1999") | ||
.clickContinue() | ||
.errorForFormalMeetingDate("Year must be between 2000 and 2050") | ||
.dateOfTheFormalMeeting("5", "5", "2040") | ||
.checkPrincipalDesignate() | ||
.checkCommissionedAnExternalExpert() | ||
.checkSavedTheInternalRomReport() | ||
.checkSavedTheExternalRomReport() | ||
.clickContinue() | ||
|
||
Logger.log("Should update the task status"); | ||
|
||
summaryPage | ||
.schoolNameIs(project.schoolName) | ||
.titleIs("Readiness to open meeting (ROM)") | ||
.inOrder() | ||
.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() | ||
.summaryShows("Commissioned an external expert to attend any meetings (if applicable)").HasValue("Yes").HasChangeLink() | ||
.summaryShows("Saved the internal ROM report in Workplaces folder").HasValue("Yes").HasChangeLink() | ||
.summaryShows("Saved the external ROM report in Workplaces folder").HasValue("Yes").HasChangeLink() | ||
.isNotMarkedAsComplete() | ||
.clickConfirmAndContinue() | ||
|
||
taskListPage.isTaskStatusInProgress("ReadinessToOpenMeeting"); | ||
|
||
taskListPage.selectReadinessToOpenMeetingFromTaskList(); | ||
|
||
Logger.log("Readiness to Open Meeting can be edited again with No ROM held option"); | ||
|
||
summaryPage.clickChange(); | ||
|
||
readinessToOpenMeetingEditPage | ||
.selectNoRomHeld() | ||
.whyMeetingWasNotHeld() | ||
.uncheckPrincipalDesignate() | ||
.checkCommissionedAnExternalExpert() | ||
.uncheckSavedTheInternalRomReport() | ||
.checkSavedTheExternalRomReport() | ||
.clickContinue() | ||
|
||
Logger.log("Should update the task status"); | ||
|
||
summaryPage | ||
.schoolNameIs(project.schoolName) | ||
.titleIs("Readiness to open meeting (ROM)") | ||
.inOrder() | ||
.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() | ||
.summaryShows("Commissioned an external expert to attend any meetings (if applicable)").HasValue("Yes").HasChangeLink() | ||
.summaryShows("Saved the internal ROM report in Workplaces folder").IsEmpty().HasChangeLink() | ||
.summaryShows("Saved the external ROM report in Workplaces folder").HasValue("Yes").HasChangeLink() | ||
.isNotMarkedAsComplete() | ||
.clickConfirmAndContinue() | ||
|
||
taskListPage.isTaskStatusInProgress("ReadinessToOpenMeeting"); | ||
|
||
taskListPage.selectReadinessToOpenMeetingFromTaskList(); | ||
summaryPage.clickChange(); | ||
|
||
Logger.log("Should be able to select Informal meeting"); | ||
|
||
readinessToOpenMeetingEditPage | ||
.selectInformalMeeting() | ||
.dateOfTheInformalMeeting("60", "12", "2050") | ||
.clickContinue() | ||
.errorForInformalMeetingDate("Day must be between 1 and 31") | ||
.dateOfTheInformalMeeting("30", "12", "1999") | ||
.clickContinue() | ||
.errorForInformalMeetingDate("Year must be between 2000 and 2050") | ||
.dateOfTheInformalMeeting("23", "5", "2030") | ||
.checkPrincipalDesignate() | ||
.checkCommissionedAnExternalExpert() | ||
.checkSavedTheInternalRomReport() | ||
.checkSavedTheExternalRomReport() | ||
.clickContinue() | ||
|
||
summaryPage | ||
.schoolNameIs(project.schoolName) | ||
.titleIs("Readiness to open meeting (ROM)") | ||
.inOrder() | ||
.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() | ||
.summaryShows("Commissioned an external expert to attend any meetings (if applicable)").HasValue("Yes").HasChangeLink() | ||
.summaryShows("Saved the internal ROM report in Workplaces folder").HasValue("Yes").HasChangeLink() | ||
.summaryShows("Saved the external ROM report in Workplaces folder").HasValue("Yes").HasChangeLink() | ||
.isNotMarkedAsComplete() | ||
.MarkAsComplete() | ||
.clickConfirmAndContinue() | ||
|
||
taskListPage.isTaskStatusIsCompleted("ReadinessToOpenMeeting"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
...pressTests/cypress/pages/tasks/Getting-ready-to-open/edit-readiness-to-open-meeting-cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
class ReadinessToOpenMeetingEditPage { | ||
private errorTracking = ""; | ||
|
||
selectFormalMeeting(): this { | ||
cy.getById("formal-meeting-option").click() | ||
return this | ||
} | ||
|
||
selectInformalMeeting(): this { | ||
cy.getById("informal-meeting-option").click() | ||
return this | ||
} | ||
|
||
selectNoRomHeld(): this { | ||
cy.getById("no-rom-held-option").click() | ||
return this | ||
} | ||
|
||
checkPrincipalDesignate(): this { | ||
cy.getById("principal-designate-has-provided-checklist").check() | ||
return this | ||
} | ||
|
||
checkCommissionedAnExternalExpert(): this { | ||
cy.getById("commissioned-external-expert-to-attend-any-meetings").check() | ||
return this | ||
} | ||
|
||
checkSavedTheInternalRomReport(): this { | ||
cy.getById("saved-the-internal-rom-report-workplaces-folder").check() | ||
return this | ||
} | ||
|
||
checkSavedTheExternalRomReport(): this { | ||
cy.getById("saved-the-external-rom-report-workplaces-folder").check() | ||
return this | ||
} | ||
|
||
whyMeetingWasNotHeld(): this { | ||
cy.getById("why-meeting-not-held").type('This is the reason why meeting was not held') | ||
return this | ||
} | ||
|
||
uncheckPrincipalDesignate(): this { | ||
cy.getById("principal-designate-has-provided-checklist").uncheck() | ||
return this | ||
} | ||
|
||
uncheckCommissionedAnExternalExpert(): this { | ||
cy.getById("commissioned-external-expert-to-attend-any-meetings").uncheck() | ||
return this | ||
} | ||
|
||
uncheckSavedTheInternalRomReport(): this { | ||
cy.getById("saved-the-internal-rom-report-workplaces-folder").uncheck() | ||
return this | ||
} | ||
|
||
uncheckSavedTheExternalRomReport(): this { | ||
cy.getById("saved-the-external-rom-report-workplaces-folder").uncheck() | ||
return this | ||
} | ||
|
||
dateOfTheFormalMeeting(day: string, month: string, year: string): this { | ||
const key = "date-of-the-formal-meeting"; | ||
this.setDate(key, day, month, year); | ||
return this | ||
} | ||
|
||
dateOfTheInformalMeeting(day: string, month: string, year: string): this { | ||
const key = "date-of-the-informal-meeting"; | ||
this.setDate(key, day, month, year); | ||
return this | ||
} | ||
|
||
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); | ||
} | ||
clickContinue(): this { | ||
cy.getByTestId("continue").click(); | ||
return this; | ||
} | ||
|
||
errorForFormalMeetingDate(error: string): this { | ||
cy.getById('date-of-the-formal-meeting-error').contains(error) | ||
return this | ||
} | ||
|
||
errorForInformalMeetingDate(error: string): this { | ||
cy.getById('date-of-the-informal-meeting-error').contains(error) | ||
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; | ||
} | ||
|
||
} | ||
|
||
const readinessToOpenMeetingEditPage = new ReadinessToOpenMeetingEditPage(); | ||
export default readinessToOpenMeetingEditPage; |