Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

137748 cypress sponsored pupil forecasts #913

Merged
merged 5 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import projectTaskList from "../../pages/projectTaskList";
import projectAssignment from "../../pages/projectAssignment";
import schoolOverview from "../../pages/schoolOverview";
import budget from "../../pages/budget";
import PupilForecast from "../../pages/pupilForecast";

const currentYear = new Date();
const nextYear = new Date();
Expand All @@ -13,21 +14,28 @@ nextYear.setFullYear(new Date().getFullYear() + 1);

const testData = {
projectName: 'Sponsored Cypress Project',
deliveryOfficer: 'Richika Dogra',
assignedOfficerMessage: 'Project is assigned',
pan: '98765',
pfiDescription: 'PFI Description',
distance: '15',
distanceDecription: 'Distance description',
mp: 'Important Politician, Indepentent',
projectAssignment: {
deliveryOfficer: 'Richika Dogra',
assignedOfficerMessage: 'Project is assigned',
},
schoolOverview: {
pan: '98765',
pfiDescription: 'PFI Description',
distance: '15',
distanceDecription: 'Distance description',
mp: 'Important Politician, Indepentent',
},
budget: {
endOfFinanicalYear: currentYear,
forecastedRevenueCurrentYear: 20,
forecastedCapitalCurrentYear: 10,
endOfNextFinancialYear: nextYear,
forecastedRevenueNextYear: 15,
forecastedCapitalNextYear: 12
}
},
pupilForecast: {
additionalInfomation: 'Pupil Forecast Additional Infomation'
}
}

describe('Sponsored conversion', { tags: ['@dev', '@stage'] }, () => {
Expand All @@ -44,11 +52,11 @@ describe('Sponsored conversion', { tags: ['@dev', '@stage'] }, () => {
// ---------------------------

projectTaskList.selectAssignProject();
projectAssignment.assignProject(testData.deliveryOfficer)
projectTaskList.getNotificationMessage().should('contain.text', 'Project is assigned');
projectTaskList.getAssignedUser().should('contain.text', testData.deliveryOfficer);
projectAssignment.assignProject(testData.projectAssignment.deliveryOfficer)
projectTaskList.getNotificationMessage().should('contain.text', testData.projectAssignment.assignedOfficerMessage);
projectTaskList.getAssignedUser().should('contain.text', testData.projectAssignment.deliveryOfficer);
projectList.filterProjectList(testData.projectName);
projectList.getNthProjectDeliveryOfficer().should('contain.text', testData.deliveryOfficer);
projectList.getNthProjectDeliveryOfficer().should('contain.text', testData.projectAssignment.deliveryOfficer);

// -------------------
// - School Overview -
Expand All @@ -57,8 +65,8 @@ describe('Sponsored conversion', { tags: ['@dev', '@stage'] }, () => {
projectList.selectProject(testData.projectName);
projectTaskList.selectSchoolOverview();
//PAN
schoolOverview.changePan(testData.pan);
schoolOverview.getPan().should('contain.text', testData.pan);
schoolOverview.changePan(testData.schoolOverview.pan);
schoolOverview.getPan().should('contain.text', testData.schoolOverview.pan);
//Viability issues
schoolOverview.changeViabilityIssues(true);
schoolOverview.getViabilityIssues().should('contain.text', 'Yes');
Expand All @@ -70,16 +78,16 @@ describe('Sponsored conversion', { tags: ['@dev', '@stage'] }, () => {
schoolOverview.changeFinancialDeficit(false);
schoolOverview.getFinancialDeficit().should('contain.text', 'No');
//PFI + details
schoolOverview.changePFI(true, testData.pfiDescription);
schoolOverview.changePFI(true, testData.schoolOverview.pfiDescription);
schoolOverview.getPFI().should('contain.text', 'Yes');
schoolOverview.getPFIDetails().should('contain.text', testData.pfiDescription);
schoolOverview.getPFIDetails().should('contain.text', testData.schoolOverview.pfiDescription);
//Distance plus details
schoolOverview.changeDistance(testData.distance, testData.distanceDecription);
schoolOverview.getDistance().should('contain.text', testData.distance);
schoolOverview.getDistanceDetails().should('contain.text', testData.distanceDecription);
schoolOverview.changeDistance(testData.schoolOverview.distance, testData.schoolOverview.distanceDecription);
schoolOverview.getDistance().should('contain.text', testData.schoolOverview.distance);
schoolOverview.getDistanceDetails().should('contain.text', testData.schoolOverview.distanceDecription);
//MP
schoolOverview.changeMP(testData.mp);
schoolOverview.getMP().should('contain.text', testData.mp);
schoolOverview.changeMP(testData.schoolOverview.mp);
schoolOverview.getMP().should('contain.text', testData.schoolOverview.mp);
//Complete
schoolOverview.markComplete();
cy.confirmContinueBtn().click();
Expand All @@ -103,5 +111,20 @@ describe('Sponsored conversion', { tags: ['@dev', '@stage'] }, () => {
budget.getNextFinancialYear().should('contain.text', testData.budget.endOfNextFinancialYear.getFullYear());
budget.getNextRevenue().should('contain.text', `£${testData.budget.forecastedRevenueNextYear}`);
budget.getNextCapital().should('contain.text', `£${testData.budget.forecastedCapitalNextYear}`);

budget.markComplete();
cy.confirmContinueBtn().click();
projectTaskList.getBudgetStatus().should('contain.text', 'Completed');


// ------------------
// - Pupil Forecast -
// ------------------

projectTaskList.selectPupilForecast();
PupilForecast.enterAditionalInfomation(testData.pupilForecast.additionalInfomation);
PupilForecast.getAdditionalInfomation().should('contain.text', testData.pupilForecast.additionalInfomation);
cy.confirmContinueBtn().click();

})
})
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export default class Budget extends BasePage {
nextFinancialYearRevenueValue: '[id="finance-year-following"]',
nextFinancialYearCapitalInput: '[id="finance-projected-capital"]',
nextFinancialYearCapitalValue: '[id="finance-projected-capital"]',
saveButton: '[class="govuk-button"]'
saveButton: '[class="govuk-button"]',
completeCheckbox: '[id="school-budget-information-complete"]'
};

static path = 'budget';
Expand Down Expand Up @@ -92,4 +93,14 @@ export default class Budget extends BasePage {
cy.checkPath(this.path);
return cy.get(this.selectors.nextFinancialYearCapitalValue);
}

static markComplete() {
cy.checkPath(this.path);
cy.get(this.selectors.completeCheckbox).check();
}

static markIncomplete() {
cy.checkPath(this.path);
cy.get(this.selectors.completeCheckbox).uncheck();
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export default class ProjectTaskList extends BasePage {
notificationMessage: '[id="notification-message"]',
schoolOverviewLink: 'a[href*="/school-overview"]',
schoolOverviewStatus: '[id="school-overview-status"]',
budgetLink: 'a[href*="/budget"]'
budgetLink: 'a[href*="/budget"]',
budgetStatus: '[id="school-budget-information-status"]',
pupilForecastLink: 'a[href*="/pupil-forecast"]',
}

static path = 'task-list';
Expand Down Expand Up @@ -45,4 +47,13 @@ export default class ProjectTaskList extends BasePage {
cy.get(this.selectors.budgetLink).click()
}

static getBudgetStatus() {
cy.checkPath(this.path);
return cy.get(this.selectors.budgetStatus);
}

static selectPupilForecast() {
cy.checkPath(this.path);
cy.get(this.selectors.pupilForecastLink).click()
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// <reference types ='Cypress'/>

import BasePage from "./BasePage";

export default class PupilForecast extends BasePage {
static selectors = {
changeAdditionalInfoLink: '[data-test="change-school-pupil-forecasts-additional-information"]',
additionalInfo: '[id="additional-information"]',
saveButton: '[class="govuk-button"]'
};

static path = 'pupil-forecasts';

static enterAditionalInfomation(additionalInformation = 'Pupil Forecast additional infomation') {
cy.checkPath(this.path);
cy.get(this.selectors.changeAdditionalInfoLink).click();
cy.get(this.selectors.additionalInfo).clear().type(additionalInformation);
cy.get(this.selectors.saveButton).click();
};

static getAdditionalInfomation() {
cy.checkPath(this.path);
return cy.get(this.selectors.additionalInfo);
};

};