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 31dece585..c959255e8 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
@@ -6,10 +6,15 @@ import projectAssignment from "../../pages/projectAssignment";
import schoolOverview from "../../pages/schoolOverview";
import budget from "../../pages/budget";
import PupilForecast from "../../pages/pupilForecast";
+import ConversionDetails from "../../pages/conversionDetails";
-const currentYear = new Date();
-const nextYear = new Date();
-nextYear.setFullYear(new Date().getFullYear() + 1);
+const currentDate = new Date();
+const nextYearDate = new Date();
+nextYearDate.setFullYear(currentDate.getFullYear() + 1);
+const oneMonthAgoDate = new Date();
+oneMonthAgoDate.setMonth(currentDate.getMonth() - 1);
+const nextMonthDate = new Date();
+nextMonthDate.setMonth(currentDate.getMonth() + 1);
const testData = {
@@ -23,18 +28,18 @@ const testData = {
pfiDescription: 'PFI Description',
distance: '15',
distanceDecription: 'Distance description',
- mp: 'Important Politician, Indepentent',
+ mp: 'Important Politician, Independent',
},
budget: {
- endOfFinanicalYear: currentYear,
+ endOfFinanicalYear: currentDate,
forecastedRevenueCurrentYear: 20,
forecastedCapitalCurrentYear: 10,
- endOfNextFinancialYear: nextYear,
+ endOfNextFinancialYear: nextYearDate,
forecastedRevenueNextYear: 15,
forecastedCapitalNextYear: 12
},
pupilForecast: {
- additionalInfomation: 'Pupil Forecast Additional Infomation'
+ additionalInfomation: 'Pupil Forecast Additional Information'
}
}
@@ -126,5 +131,61 @@ describe('Sponsored conversion', { tags: ['@dev', '@stage'] }, () => {
PupilForecast.getAdditionalInfomation().should('contain.text', testData.pupilForecast.additionalInfomation);
cy.confirmContinueBtn().click();
+ // ----------------------
+ // - Conversion Details -
+ // ----------------------
+
+ projectTaskList.selectConversionDetails();
+
+ // Form 7
+ ConversionDetails.setForm7Receivied('Yes');
+ ConversionDetails.getForm7Receivied().should('contain.text', 'Yes');
+ ConversionDetails.setForm7Date(oneMonthAgoDate);
+ ConversionDetails.getForm7Date().should('contain.text', oneMonthAgoDate.getDate());
+ ConversionDetails.getForm7Date().should('contain.text', oneMonthAgoDate.toLocaleString('default', { month: 'long' }));
+ ConversionDetails.getForm7Date().should('contain.text', oneMonthAgoDate.getFullYear());
+
+ // DAO
+ ConversionDetails.setDAODate(oneMonthAgoDate);
+ ConversionDetails.getDAODate().should('contain.text', oneMonthAgoDate.getDate());
+ ConversionDetails.getDAODate().should('contain.text', oneMonthAgoDate.toLocaleString('default', { month: 'long' }));
+ ConversionDetails.getDAODate().should('contain.text', oneMonthAgoDate.getFullYear());
+
+ // Funding
+ ConversionDetails.setFundingType('Full');
+ ConversionDetails.getFundingType().should('contain.text', 'Full');
+ ConversionDetails.setFundingAmount(false, 100000);
+ ConversionDetails.getFundingAmount().should('contain.text', '£100,000');
+ ConversionDetails.setFundingReason();
+ ConversionDetails.getFundingReason().should('contain.text', 'Funding Reason');
+
+ //EIG
+ ConversionDetails.setEIG(true);
+ ConversionDetails.getEIG().should('contain.text', 'Yes');
+
+ // Dates
+ ConversionDetails.setAdvisoryBoardDate(nextMonthDate);
+ ConversionDetails.getAdvisoryBoardDate().should('contain.text', nextMonthDate.getDate());
+ ConversionDetails.getAdvisoryBoardDate().should('contain.text', nextMonthDate.toLocaleString('default', { month: 'long' }));
+ ConversionDetails.getAdvisoryBoardDate().should('contain.text', nextMonthDate.getFullYear());
+ ConversionDetails.setProposedAcademyOpening(nextYearDate.toLocaleString('default', {month: '2-digit'}), nextYearDate.getFullYear());
+ ConversionDetails.getProposedAcademyOpening().should('contain.text', 1);
+ ConversionDetails.getProposedAcademyOpening().should('contain.text', nextYearDate.toLocaleString('default', { month: 'long' }));
+ ConversionDetails.getProposedAcademyOpening().should('contain.text', nextYearDate.getFullYear());
+ ConversionDetails.setPreviousAdvisoryBoardDate(true, oneMonthAgoDate);
+ ConversionDetails.getPreviousAdvisoryBoardDate().should('contain.text', oneMonthAgoDate.getDate());
+ ConversionDetails.getPreviousAdvisoryBoardDate().should('contain.text', oneMonthAgoDate.toLocaleString('default', { month: 'long' }));
+ ConversionDetails.getPreviousAdvisoryBoardDate().should('contain.text', oneMonthAgoDate.getFullYear());
+
+ // Author
+ ConversionDetails.setAuthor();
+ ConversionDetails.getAuthor().should('contain.text', 'Nicholas Warms');
+ ConversionDetails.setClearedBy();
+ ConversionDetails.getClearedBy().should('contain.text', 'Nicholas Warms');
+
+ // Complete
+ ConversionDetails.markComplete();
+ cy.confirmContinueBtn().click();
+ projectTaskList.getConversionDetailsStatus().should('contain.text', 'Completed');
})
})
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/conversionDetails.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/conversionDetails.js
new file mode 100644
index 000000000..e3f382b1b
--- /dev/null
+++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/conversionDetails.js
@@ -0,0 +1,234 @@
+///
+
+import BasePage from "./BasePage";
+
+const today = new Date();
+
+export default class ConversionDetails extends BasePage {
+ static selectors = {
+ saveButton: '[class="govuk-button"]',
+ form7ReceivedLink: '[data-test="change-form-7-received"]',
+ form7ReveicedValue: '[id="form-7-received"]',
+ form7DateLink: '[data-test="change-form-7-received-date"]',
+ form7DateInput: 'form-7-received-date',
+ form7DateValue: '[id="form-7-received-date"]',
+ DAOLink: '[data-test="change-dao-pack-sent-date"]',
+ DAODateInput: 'dao-pack-sent-date',
+ DAOValue: '[id="dao-pack-sent-date"]',
+ fundingTypeLink: '[data-test="change-grant-funding-type"]',
+ fundingTypeValue: '[id="grant-funding-type"]',
+ fundingAmountLink: '[data-test="change-grant-funding-amount"]',
+ fundingAmountValue: '[id="grant-funding-amount"]',
+ fundingAmountDefaultYesRadio: '[name="conversion-support-grant-amount-changed"][data-cy="select-radio-yes"]',
+ fundingAmountDefaultNoRadio: '[name="conversion-support-grant-amount-changed"][data-cy="select-radio-no"]',
+ fundingAmountInput: '[id="conversion-support-grant-amount"]',
+ fundingAmountReasonInput: '[id="conversion-support-grant-change-reason"]',
+ fundingAmountReasonValue: '[id="grant-funding-reason"]',
+ fundingAmountReasonLink: '[data-test="change-grant-funding-reason"]',
+ EIGLink: '[data-test="change-grant-funding-environmental-improvement-grant"]',
+ EIGValue: '[id="grant-funding-environmental-improvement-grant"]',
+ EIGYesRadio: '[name="conversion-support-grant-environmental-improvement-grant"][data-cy="select-radio-yes" i]',
+ EIGNoRadio: '[name="conversion-support-grant-environmental-improvement-grant"][data-cy="select-radio-no" i]',
+ advisoryBoardDateLink: '[data-test="change-advisory-board-date"]',
+ advisoryBoardDateValue: '[id="advisory-board-date"]',
+ advisoryBoardDateInput: 'head-teacher-board-date',
+ proposedOpeningLink: '[data-test="change-proposed-academy-opening-date"]',
+ proposedOpeningValue: '[id="proposed-academy-opening-date"]',
+ proposedOpeningRadioButton: (month, year) => `input[data-cy="select-radio-01/${month}/${year} 00:00:00"]`,
+ previousAdvisoryBoardLink: '[data-test="change-previous-advisory-board"]',
+ previousAdvisoryBoardValue: '[id="previous-advisory-board"]',
+ previousAdvisoryBoardDateInput: 'previous-head-teacher-board-date',
+ authorLink: '[data-test="change-author"]',
+ authorValue: '[id="author"]',
+ authorInput: '[id="author"]',
+ clearedByLink: '[data-test="change-cleared-by"]',
+ clearedByValue: '[id="cleared-by"]',
+ clearedByInput: '[id="cleared-by"]',
+ completeCheckbox: '[id="school-and-trust-information-complete"]'
+ };
+
+ static path = 'conversion-details';
+
+ static setForm7Receivied(status = 'Yes') {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.form7ReceivedLink).click()
+ cy.RadioBtn(status).check();
+ cy.get(this.selectors.saveButton).click();
+ };
+
+ static getForm7Receivied() {
+ cy.checkPath(this.path);
+ return cy.get(this.selectors.form7ReveicedValue);
+ }
+
+ static setForm7Date(date = today) {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.form7DateLink).click();
+ cy.enterDate(this.selectors.form7DateInput, date.getDate(), date.getMonth() + 1, date.getFullYear());
+ cy.get(this.selectors.saveButton).click();
+ }
+
+ static getForm7Date() {
+ cy.checkPath(this.path);
+ return cy.get(this.selectors.form7DateValue);
+ }
+
+ // DAO
+
+ static setDAODate(date = today) {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.DAOLink).click();
+ cy.enterDate(this.selectors.DAODateInput, date.getDate(), date.getMonth() + 1, date.getFullYear());
+ cy.get(this.selectors.saveButton).click();
+ }
+
+ static getDAODate() {
+ cy.checkPath(this.path);
+ return cy.get(this.selectors.DAOValue);
+ }
+
+ // Funding
+
+ static setFundingType(type = 'Full') {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.fundingTypeLink).click();
+ cy.RadioBtn(type).check();
+ //Save button twice to get back to the details page
+ cy.get(this.selectors.saveButton).click();
+ cy.get(this.selectors.saveButton).click();
+ }
+
+ static getFundingType() {
+ cy.checkPath(this.path);
+ return cy.get(this.selectors.fundingTypeValue);
+ }
+
+ static setFundingAmount(useDefaultAmount = false, amount = 20000) {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.fundingAmountLink).click();
+ if (useDefaultAmount) {
+ cy.get(this.selectors.fundingAmountDefaultYesRadio).click();
+ } else {
+ cy.get(this.selectors.fundingAmountDefaultNoRadio).click();
+ cy.get(this.selectors.fundingAmountInput).clear().type(amount);
+ }
+ cy.get(this.selectors.saveButton).click();
+ }
+
+ static getFundingAmount() {
+ cy.checkPath(this.path);
+ return cy.get(this.selectors.fundingAmountValue);
+ }
+
+ static setFundingReason(reason = 'Funding Reason') {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.fundingAmountLink).click();
+ cy.get(this.selectors.fundingAmountReasonInput).clear().type(reason);
+ cy.get(this.selectors.saveButton).click();
+ }
+
+ static getFundingReason() {
+ cy.checkPath(this.path);
+ return cy.get(this.selectors.fundingAmountReasonValue);
+ }
+
+ static setEIG(value = true) {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.EIGLink).click();
+ if (value) {
+ cy.get(this.selectors.EIGYesRadio).check();
+ } else {
+ cy.get(this.selectors.EIGNoRadio).check();
+ }
+ cy.get(this.selectors.saveButton).click();
+ }
+
+ static getEIG() {
+ cy.checkPath(this.path);
+ return cy.get(this.selectors.EIGValue);
+ }
+
+ // Dates
+
+ static setAdvisoryBoardDate(date = today) {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.advisoryBoardDateLink).click();
+ cy.enterDate(this.selectors.advisoryBoardDateInput, date.getDate(), date.getMonth() + 1, date.getFullYear());
+ cy.get(this.selectors.saveButton).click();
+ }
+
+ static getAdvisoryBoardDate() {
+ cy.checkPath(this.path);
+ return cy.get(this.selectors.advisoryBoardDateValue);
+ }
+
+ static setProposedAcademyOpening(month, year) {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.proposedOpeningLink).click();
+ cy.get(this.selectors.proposedOpeningRadioButton(month, year)).check()
+ cy.get(this.selectors.saveButton).click();
+ }
+
+ static getProposedAcademyOpening() {
+ cy.checkPath(this.path);
+ return cy.get(this.selectors.proposedOpeningValue);
+ }
+
+ static setPreviousAdvisoryBoardDate(previousBoard = true, date = today) {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.previousAdvisoryBoardLink).click();
+ if (previousBoard) {
+ cy.YesRadioBtn().check();
+ cy.get(this.selectors.saveButton).click();
+ cy.enterDate(this.selectors.previousAdvisoryBoardDateInput, date.getDate(), date.getMonth() + 1, date.getFullYear());
+
+ } else {
+ cy.NoRadioBtn().check();
+ }
+ cy.get(this.selectors.saveButton).click();
+ }
+
+ static getPreviousAdvisoryBoardDate() {
+ cy.checkPath(this.path);
+ return cy.get(this.selectors.previousAdvisoryBoardValue);
+ }
+
+ // People
+
+ static setAuthor(author = 'Nicholas Warms') {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.authorLink).click();
+ cy.get(this.selectors.authorInput).clear().type(author);
+ cy.get(this.selectors.saveButton).click();
+ }
+
+ static getAuthor() {
+ cy.checkPath(this.path);
+ return cy.get(this.selectors.authorValue);
+ }
+
+ static setClearedBy(clearedBy = 'Nicholas Warms') {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.clearedByLink).click();
+ cy.get(this.selectors.clearedByInput).clear().type(clearedBy);
+ cy.get(this.selectors.saveButton).click();
+ }
+
+ static getClearedBy() {
+ cy.checkPath(this.path);
+ return cy.get(this.selectors.clearedByValue);
+ }
+
+ // Complete
+
+ static markComplete() {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.completeCheckbox).check();
+ }
+
+ static markIncomplete() {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.completeCheckbox).uncheck();
+ }
+
+};
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectTaskList.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectTaskList.js
index 8dc370c67..fef78e3e2 100644
--- a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectTaskList.js
+++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/pages/projectTaskList.js
@@ -13,6 +13,9 @@ export default class ProjectTaskList extends BasePage {
budgetLink: 'a[href*="/budget"]',
budgetStatus: '[id="school-budget-information-status"]',
pupilForecastLink: 'a[href*="/pupil-forecast"]',
+ conversionDetailsLink: 'a[href*="/conversion-details"]',
+ conversionDetailsStatus: '[id="school-and-trust-information-status"]',
+
}
static path = 'task-list';
@@ -56,4 +59,14 @@ export default class ProjectTaskList extends BasePage {
cy.checkPath(this.path);
cy.get(this.selectors.pupilForecastLink).click()
}
+
+ static selectConversionDetails() {
+ cy.checkPath(this.path);
+ cy.get(this.selectors.conversionDetailsLink).click()
+ }
+
+ static getConversionDetailsStatus() {
+ cy.checkPath(this.path);
+ return cy.get(this.selectors.conversionDetailsStatus);
+ }
};
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/support/commands.js b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/support/commands.js
index 2ef6f032a..3b9c77ed3 100644
--- a/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/support/commands.js
+++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.CypressTests/cypress/support/commands.js
@@ -79,6 +79,13 @@ Cypress.Commands.add('generateProjectTempBtn', () => {
cy.get('[id="generate-project-template-button"]')
});
+Cypress.Commands.add('enterDate', (idSelector, day, month, year) => {
+ cy.get(`[id*="${idSelector}-day"]`).should('be.visible');
+ cy.get(`[id*="${idSelector}-day"]`).clear().type(day);
+ cy.get(`[id*="${idSelector}-month"]`).clear().type(month);
+ cy.get(`[id*="${idSelector}-year"]`).clear().type(year);
+})
+
//--LA Info Page
// Submit Date 'Sent' (LA Info Page)
@@ -256,6 +263,11 @@ Cypress.Commands.add('YesRadioBtn', () => {
cy.get('[data-cy="select-radio-yes" i]')
})
+// Any radio button
+Cypress.Commands.add('RadioBtn', (label) => {
+ cy.get(`[data-cy="select-radio-${label}" i]`)
+})
+
// Approved Changed Condition
Cypress.Commands.add('ChangeConditionsLink', () => {
cy.get('[id="change-conditions-set-btn"]')
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml
index 3fc5a8ac0..b6503154c 100644
--- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml
+++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Components/SchoolAndTrustInformation/default.cshtml
@@ -24,7 +24,7 @@
-
+
diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/Sponsored/GrantDetails.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/Sponsored/GrantDetails.cshtml
index a19b8635d..014f79c5b 100644
--- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/Sponsored/GrantDetails.cshtml
+++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/TaskList/SchoolAndTrustInformation/Sponsored/GrantDetails.cshtml
@@ -101,6 +101,7 @@
id="@value"
name="conversion-support-grant-environmental-improvement-grant"
value="@value"
+ data-cy="select-radio-@value"
@(value == Model.Project.ConversionSupportGrantEnvironmentalImprovementGrant ? "checked" : "") />