-
Notifications
You must be signed in to change notification settings - Fork 3
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 #1144 from DFE-Digital/171882/CypressTestsForSchoo…
…lImprovementPlans Cypress Tests for School Improvement Plans
- Loading branch information
Showing
6 changed files
with
247 additions
and
18 deletions.
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
...pareConversions.CypressTests/cypress/e2e/Core-journeys/school_improvement_plan_test.cy.js
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,88 @@ | ||
import projectTaskList from "../../pages/projectTaskList"; | ||
import { schoolImprovementPage } from '../../pages/SchoolImprovementPage'; | ||
import { Logger } from '../../support/logger'; | ||
|
||
describe('School Improvement Plan Tests', () => { | ||
|
||
let projectId; | ||
|
||
beforeEach(() => { | ||
Logger.log("Visit the homepage before each test"); | ||
projectTaskList.getHomePage(); | ||
}); | ||
|
||
it('Creating a conversion project and recording a new interim school improvement plan', () => { | ||
Logger.log("Go to the home page then click create new conversion"); | ||
projectTaskList.clickCreateNewConversionBtn(); | ||
|
||
Logger.log("Click on create new conversion button on the next page"); | ||
projectTaskList.clickCreateNewConversionBtn(); | ||
|
||
Logger.log("Search and select the school, then click continue"); | ||
schoolImprovementPage.searchSchool('Manchester Academy (134224)').clickContinue(); | ||
|
||
Logger.log("Select no and continue on the next 3 pages regarding the school"); | ||
schoolImprovementPage.selectNoAndContinue(); | ||
schoolImprovementPage.selectNoAndContinue(); | ||
schoolImprovementPage.selectNoAndContinue(); | ||
|
||
Logger.log("Verify the selected school details"); | ||
schoolImprovementPage.assertSchoolDetails( | ||
'Manchester Academy', | ||
'134224', | ||
'Manchester', | ||
'Academy' | ||
); | ||
|
||
Logger.log("Click school details are correct, click continue"); | ||
schoolImprovementPage.clickContinue(); | ||
|
||
Logger.log("Search for the created project then select first one on the list"); | ||
schoolImprovementPage.clickOnFirstProject(); | ||
|
||
Logger.log("Capture the projectId dynamically from the URL"); | ||
cy.url().then((url) => { | ||
projectId = url.match(/task-list\/(\d+)/)[1]; | ||
Logger.log(`Project ID: ${projectId}`); | ||
}).then(() => { | ||
Logger.log("Navigate to the section to record interim school improvement plan"); | ||
schoolImprovementPage.navigateToSchoolImprovementSection(); | ||
|
||
Logger.log("Click on 'Add school improvement plan'"); | ||
schoolImprovementPage.clickAddSchoolImprovementPlan(); | ||
|
||
Logger.log("Select who arranged the improvement plan"); | ||
schoolImprovementPage.selectImprovementDetails(); | ||
|
||
Logger.log("Save the who arranged the school improvement plan"); | ||
schoolImprovementPage.saveImprovementDetails(); | ||
|
||
Logger.log("Enter the who is providing the interim school improvement plan details"); | ||
schoolImprovementPage.enterImprovementDetails("Fahad-Cypress Test"); | ||
|
||
Logger.log("Enter the imprvoment plan's start date"); | ||
schoolImprovementPage.enterImprovementEndDate('12', '12', '2023'); | ||
|
||
Logger.log("Entering expected end date of the improvement plan"); | ||
schoolImprovementPage.enterExpectedEndDate('12', '11', '2024'); | ||
|
||
Logger.log("Select the confidence level of the improvement plan"); | ||
schoolImprovementPage.selectHighConfidenceLevel(); | ||
|
||
Logger.log("Entering comments on the interim school improvement plan"); | ||
schoolImprovementPage.enterComments('This is a test comment'); | ||
|
||
Logger.log("Verify the interim school improvement plan details are correct"); | ||
schoolImprovementPage.verifyImprovementDetails("Local Authority", "Fahad-Cypress Test", "12 December 2023", "12 November 2024", "High", "This is a test comment"); | ||
Logger.log("Verify the submitted interim school improvement plan details are saved correctly"); | ||
schoolImprovementPage.verifyTheFinalImprovementDetails("Local Authority", "Fahad-Cypress Test", "12 December 2023", "12 November 2024", "High", "This is a test comment"); | ||
Logger.log("change the details"); | ||
schoolImprovementPage.changeImprovementDetails("Cypress Test Interim schoool plan","Test comment"); | ||
Logger.log("Verify the changed interim school improvement plan details are saved correctly"); | ||
schoolImprovementPage.verifyChangedImprovementDetails("Regional Director, Local Authority", "Cypress Test Interim schoool plan", "12 December 2023", "Unknown", "Medium", "Test comment"); | ||
|
||
Logger.log("Delete the project and verify that it was deleted successfully - Project ID: " + projectId); | ||
schoolImprovementPage.deleteProject(projectId); | ||
}); | ||
}); | ||
}); |
4 changes: 0 additions & 4 deletions
4
Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/fixtures/cypress.env.json
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/fixtures/example.json
This file was deleted.
Oops, something went wrong.
150 changes: 150 additions & 0 deletions
150
...areConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/SchoolImprovementPage.js
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,150 @@ | ||
export class SchoolImprovementPage { | ||
|
||
searchSchool(schoolName) { | ||
cy.get('#SearchQuery').type(schoolName); | ||
cy.get('.autocomplete__input--default').first().click(); | ||
return this; | ||
} | ||
|
||
clickContinue() { | ||
cy.get('[data-id="submit"]').click(); | ||
return this; | ||
} | ||
|
||
selectNoAndContinue() { | ||
cy.get('[data-cy="select-legal-input-no"]').click(); | ||
cy.get('[data-cy="select-common-submitbutton"]').click(); | ||
return this; | ||
} | ||
|
||
assertSchoolDetails(schoolName, urn, localAuthority, schoolType) { | ||
cy.get('[data-cy="school-name"]').should('contain', schoolName); | ||
cy.get('.govuk-summary-list__value').eq(1).should('contain', urn); | ||
cy.get('.govuk-summary-list__value').eq(3).should('contain', localAuthority); | ||
cy.get('.govuk-summary-list__value').eq(5).should('contain', schoolType); | ||
return this; | ||
} | ||
|
||
clickOnFirstProject() { | ||
cy.get('[data-cy="select-projectlist-filter-title"]').type('Manchester Academy'); | ||
cy.get('[data-cy="select-projectlist-filter-apply"]').click(); | ||
cy.get('[data-cy="trust-name-Manchester Academy-0"]').click(); | ||
return this; | ||
} | ||
|
||
navigateToSchoolImprovementSection() { | ||
cy.get('[data-cy="school_improvement_plans_menu"]').click(); | ||
return this; | ||
} | ||
|
||
clickAddSchoolImprovementPlan() { | ||
cy.get('[data-cy="add_school_improvement_plan"]').click(); | ||
return this; | ||
} | ||
|
||
selectImprovementDetails() { | ||
cy.get('#localauthority-checkbox').click(); | ||
return this; | ||
} | ||
|
||
saveImprovementDetails() { | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
|
||
enterImprovementDetails(details) { | ||
cy.get('#PlanProvider').type(details); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
|
||
enterImprovementEndDate(day, month, year) { | ||
cy.get('#plan-start-date-day').clear(); | ||
cy.get('#plan-start-date-day').type(day); | ||
cy.get('#plan-start-date-month').clear(); | ||
cy.get('#plan-start-date-month').type(month); | ||
cy.get('#plan-start-date-year').clear(); | ||
cy.get('#plan-start-date-year').type(year); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
|
||
enterExpectedEndDate(day, month, year) { | ||
cy.get('#Other-radio').click(); | ||
cy.get('#plan-end-date-other-day').clear; | ||
cy.get('#plan-end-date-other-day').type(day); | ||
cy.get('#plan-end-date-other-month').clear(); | ||
cy.get('#plan-end-date-other-month').type(month); | ||
cy.get('#plan-end-date-other-year').clear() | ||
cy.get('#plan-end-date-other-year').type(year); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
selectHighConfidenceLevel() { | ||
cy.get('#High-radio').click(); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
enterComments(comments) { | ||
cy.get('#PlanComments').clear(); | ||
cy.get('#PlanComments').type(comments); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
|
||
verifyImprovementDetails(arrangedBy, providedBy, startDate, endDate, confidenceLevel, comments) { | ||
cy.get('#arranged-by').should('contain', arrangedBy); | ||
cy.get('#provided-by').eq(0).should('contain', providedBy); | ||
cy.get('#start-date').should('contain', startDate); | ||
cy.get('#end-date').should('contain', endDate); | ||
cy.get('#confidence-level').should('contain', confidenceLevel); | ||
cy.get('#comments').should('contain', comments); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
|
||
verifyTheFinalImprovementDetails(arrangedBy, providedBy, startDate, endDate, confidenceLevel, comments) { | ||
cy.get('[data-cy="arranged-by"]').should('contain', arrangedBy); | ||
cy.get('[data-cy="provided-by"]').eq(0).should('contain', providedBy); | ||
cy.get('[data-cy="start-date"]').should('contain', startDate); | ||
cy.get('[data-cy="end-date"]').should('contain', endDate); | ||
cy.get('[data-cy="confidence-leve"]').should('contain', confidenceLevel); | ||
cy.get('[data-cy="comments"]').should('contain', comments); | ||
return this; | ||
} | ||
changeImprovementDetails(providedBy,comments) { | ||
cy.get('#change-arranger-btn').click(); | ||
cy.get('#regionaldirector-checkbox').click(); | ||
cy.get('#submit-btn').click(); | ||
cy.get('#PlanProvider').clear(); | ||
cy.get('#PlanProvider').type(providedBy); | ||
cy.get('#submit-btn').click(); | ||
cy.get('#submit-btn').click(); | ||
cy.get('#Unknown-radio').click(); | ||
cy.get('#submit-btn').click(); | ||
cy.get('#Medium-radio').click(); | ||
cy.get('#submit-btn').click(); | ||
cy.get('#PlanComments').clear(); | ||
cy.get('#PlanComments').type(comments); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
|
||
verifyChangedImprovementDetails(arrangedBy, providedBy, startDate, endDate, confidenceLevel, comments) { | ||
cy.get('#arranged-by').should('contain', arrangedBy); | ||
cy.get('#provided-by').eq(0).should('contain', providedBy); | ||
cy.get('#start-date').should('contain', startDate); | ||
cy.get('#end-date').should('contain', endDate); | ||
cy.get('#confidence-level').should('contain', confidenceLevel); | ||
cy.get('#comments').should('contain', comments); | ||
cy.get('#submit-btn').click(); | ||
return this; | ||
} | ||
deleteProject(projectId) { | ||
cy.callAcademisationApi("DELETE", `/conversion-project/${projectId}/Delete`).then((response) => { | ||
expect(response.status).to.eq(200); | ||
}); | ||
} | ||
} | ||
|
||
export const schoolImprovementPage = new SchoolImprovementPage(); |
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
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