Skip to content

Commit

Permalink
Merge pull request #925 from DFE-Digital/137746-cyrpess-sponsored-per…
Browse files Browse the repository at this point in the history
…formance

137746 cypress sponsored School Performance Information
  • Loading branch information
nwarms authored Sep 29, 2023
2 parents 29052c3 + 697d40a commit 0361035
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'] }, () => {
Expand Down Expand Up @@ -52,7 +53,9 @@ describe('Sponsored conversion', { tags: ['@dev', '@stage'] }, () => {
localAuthority: {
comment: 'Comment',
sharepointLink: 'https://sharepoint.com'
}
},
performanceInfo: 'Additional Information',
keyStages: [4, 5]
}

beforeEach(() => {
Expand Down Expand Up @@ -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();
}
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/// <reference types ='Cypress'/>

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);
};

};
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
}
};

0 comments on commit 0361035

Please sign in to comment.