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

137752 cypress sponsored risks and issues #923

Merged
merged 2 commits into from
Sep 28, 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 @@ -8,6 +8,7 @@ import budget from "../../pages/budget";
import PupilForecast from "../../pages/pupilForecast";
import ConversionDetails from "../../pages/conversionDetails";
import Rationale from "../../pages/rationale";
import RisksAndIssues from "../../pages/risksAndIssues";

const currentDate = new Date();
const nextYearDate = new Date();
Expand Down Expand Up @@ -42,7 +43,8 @@ const testData = {
pupilForecast: {
additionalInfomation: 'Pupil Forecast Additional Information'
},
rationale: 'This is why this school should become an academy'
rationale: 'This is why this school should become an academy',
risksAndIssues: 'Here are the risks and issues for this conversion',
}

describe('Sponsored conversion', { tags: ['@dev', '@stage'] }, () => {
Expand Down Expand Up @@ -200,5 +202,16 @@ describe('Sponsored conversion', { tags: ['@dev', '@stage'] }, () => {
Rationale.markComplete();
cy.confirmContinueBtn().click();
projectTaskList.getRationaleStatus().should('contain.text', 'Completed');

// --------------------
// - Risks and issues -
// --------------------

projectTaskList.selectRisksAndIssues();
RisksAndIssues.changeRisksAndIssues(testData.risksAndIssues);
RisksAndIssues.getRisksAndIssues().should('contain.text', testData.risksAndIssues);
RisksAndIssues.markComplete();
cy.confirmContinueBtn().click();
projectTaskList.getRisksAndIssuesStatus().should('contain.text', 'Completed');
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export default class ProjectTaskList extends BasePage {
conversionDetailsLink: 'a[href*="/conversion-details"]',
conversionDetailsStatus: '[id="school-and-trust-information-status"]',
rationaleLink: 'a[href*="/confirm-project-trust-rationale"]',
rationaleStatus: '[id="rationale-status"]'
rationaleStatus: '[id="rationale-status"]',
riskAndIssuesLink: 'a[href*="/confirm-risks-issues"]',
riskAndIssuesStatus: '[id="risks-and-issues-status"]'
}

static path = 'task-list';
Expand Down Expand Up @@ -80,4 +82,14 @@ export default class ProjectTaskList extends BasePage {
cy.checkPath(this.path);
return cy.get(this.selectors.rationaleStatus);
}

static selectRisksAndIssues() {
cy.checkPath(this.path);
cy.get(this.selectors.riskAndIssuesLink).click();
}

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

import BasePage from "./BasePage";

export default class RisksAndIssues extends BasePage {
static selectors = {
rationaleLink: '[data-test="change-risks-and-issues"]',
rationaleInput: '[id="risks-and-issues"]',
rationaleValue: '[id="risks-and-issues"]',
saveButton: '[class="govuk-button"]',
completeCheckbox: '[id="risks-and-issues-complete"]'
};

static path = 'confirm-risks-issues';

static changeRisksAndIssues(rationale) {
cy.checkPath(this.path);
cy.get(this.selectors.rationaleLink).click()
cy.get(this.selectors.rationaleInput).clear().type(rationale);
cy.get(this.selectors.saveButton).click();
};

static getRisksAndIssues() {
cy.checkPath(this.path)
return cy.get(this.selectors.rationaleValue);
};

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

static markIncomplete() {
cy.checkPath(this.path);
cy.get(this.selectors.completeCheckbox).uncheck();
}
};