diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/e2e/Core-journeys/sponsored-conversion.cy.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/e2e/Core-journeys/sponsored-conversion.cy.js index 85abf29c9..e57942da0 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/e2e/Core-journeys/sponsored-conversion.cy.js +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/e2e/Core-journeys/sponsored-conversion.cy.js @@ -10,6 +10,7 @@ import ConversionDetails from "../../pages/conversionDetails"; import Rationale from "../../pages/rationale"; import RisksAndIssues from "../../pages/risksAndIssues"; import LocalAuthorityInfomation from "../../pages/localAuthorityInformation"; +import Performance from "../../pages/performance"; describe('Sponsored conversion', { tags: ['@dev', '@stage'] }, () => { @@ -52,7 +53,9 @@ describe('Sponsored conversion', { tags: ['@dev', '@stage'] }, () => { localAuthority: { comment: 'Comment', sharepointLink: 'https://sharepoint.com' - } + }, + performanceInfo: 'Additional Information', + keyStages: [4, 5] } beforeEach(() => { @@ -243,5 +246,23 @@ describe('Sponsored conversion', { tags: ['@dev', '@stage'] }, () => { LocalAuthorityInfomation.markComplete(); cy.confirmContinueBtn().click(); projectTaskList.getLAStatus().should('contain.text', testData.completedText); + + + // -------------------- + // - Performance Info - + // -------------------- + + projectTaskList.selectOfsted(); + Performance.changeOfstedInfo(testData.performanceInfo); + Performance.getOfstedInfo().should('contain.text', testData.performanceInfo); + cy.confirmContinueBtn().click(); + + for(const keyStage of testData.keyStages){ + console.log(keyStage) + projectTaskList.selectKeyStage(keyStage); + Performance.changeKeyStageInfo(keyStage, testData.performanceInfo); + Performance.getKeyStageInfo(keyStage).should('contain.text', testData.performanceInfo); + cy.confirmContinueBtn().click(); + } }) }) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/performance.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/performance.js new file mode 100644 index 000000000..61b6c8340 --- /dev/null +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/performance.js @@ -0,0 +1,43 @@ +/// + +import BasePage from "./BasePage"; + +export default class Performance extends BasePage { + static selectors = { + ofstedInfoLink: '[data-test="change-school-performance-additional-information"]', + ofstedInfoInput: '[id="additional-information"]', + ofstedInfoValue: '[id="additional-information"]', + keyStageLink: (keyStageNumber) => `[data-test="change-key-stage-${keyStageNumber}-additional-information"]`, + keyStageInput: '[id="additional-information"]', + keyStageValue: '[id="additional-information"]', + saveButton: '[class="govuk-button"]' + }; + + static ofstedPath = 'school-performance-ofsted-information'; + static keyStagePath = (keyStageNumber) => `key-stage-${keyStageNumber}-performance-tables`; + + static changeOfstedInfo(additionalInfo) { + cy.checkPath(this.ofstedPath); + cy.get(this.selectors.ofstedInfoLink).click() + cy.get(this.selectors.ofstedInfoInput).clear().type(additionalInfo); + cy.get(this.selectors.saveButton).click(); + }; + + static getOfstedInfo() { + cy.checkPath(this.ofstedPath) + return cy.get(this.selectors.ofstedInfoValue); + }; + + static changeKeyStageInfo(keyStageNumber, additionalInfo) { + cy.checkPath(this.keyStagePath(keyStageNumber)); + cy.get(this.selectors.keyStageLink(keyStageNumber)).click() + cy.get(this.selectors.keyStageInput).clear().type(additionalInfo); + cy.get(this.selectors.saveButton).click(); + }; + + static getKeyStageInfo(keyStageNumber) { + cy.checkPath(this.keyStagePath(keyStageNumber)) + return cy.get(this.selectors.keyStageValue); + }; + +}; diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectTaskList.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectTaskList.js index 1c1939718..f2a740b29 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectTaskList.js +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectTaskList.js @@ -20,7 +20,9 @@ export default class ProjectTaskList extends BasePage { riskAndIssuesLink: 'a[href*="/confirm-risks-issues"]', riskAndIssuesStatus: '[id="risks-and-issues-status"]', LALink: 'a[href*="/confirm-local-authority-information-template-dates"]', - LAStatus: '[id="la-info-template-status"]' + LAStatus: '[id="la-info-template-status"]', + ofstedLink: 'a[href*="/school-performance-ofsted-information"]', + keyStageLink: (keyStageNumber) => `a[href*="/key-stage-${keyStageNumber}-performance-tables"]` } static path = 'task-list'; @@ -104,4 +106,14 @@ export default class ProjectTaskList extends BasePage { cy.checkPath(this.path); return cy.get(this.selectors.LAStatus); } + + static selectOfsted(){ + cy.checkPath(this.path); + cy.get(this.selectors.ofstedLink).click(); + } + + static selectKeyStage(keyStageNumber){ + cy.checkPath(this.path); + cy.get(this.selectors.keyStageLink(keyStageNumber)).click(); + } };