Skip to content

Commit

Permalink
Merge pull request #647 from DFE-Digital/ofsted-pages-automation-safe…
Browse files Browse the repository at this point in the history
…guarding-concerns

Create ofsted pages - add safeguarding automation tests
  • Loading branch information
CMurrell148 authored Dec 2, 2024
2 parents b437c11 + c85a4cb commit ccb41be
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</div>
</details>
<table class="govuk-table" data-module="moj-sortable-table">
<caption class="govuk-table__caption govuk-table__caption--m">Safeguarding and concerns</caption>
<caption class="govuk-table__caption govuk-table__caption--m" data-testid="subpage-header">Safeguarding and concerns</caption>
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th scope="col" class="govuk-table__header govuk-body" aria-sort="ascending" data-testid="ofsted-safeguarding-and-concerns-name-header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,46 @@ describe("Testing the Ofsted page and its subpages ", () => {

});

describe("Testing the Ofsted Safeguarding and concerns page", () => {
beforeEach(() => {
cy.login();
cy.visit('/trusts/ofsted/safeguarding-and-concerns?uid=5143');
});

it("Checks the correct Ofsted safeguarding and concerns subpage header is present", () => {
ofstedPage
.checkOfstedSafeguardingConcernsPageHeaderPresent();
});

it("Checks the correct Ofsted safeguarding and concerns headers are present", () => {
ofstedPage
.checkOfstedSafeguardingConcernsTableHeadersPresent();
});

it("Checks the Ofsted page safeguarding and concerns sorting", () => {
ofstedPage
.checkOfstedSafeguardingConcernsSorting();
});

it("Checks that a trusts safeguarding and concerns correct judgement types are present", () => {
ofstedPage
.checkSafeguardingConcernsEffectiveSafeguardingJudgementsPresent()
.checkSafeguardingConcernsCategoryOfConcernJudgementsPresent()
.checkSafeguardingConcernsCategoryOfConcernJudgementsPresent()
.checkSafeguardingConcernsBeforeOrAfterJoiningJudgementsPresent();
});

it("Checks that a different trusts safeguarding and concerns correct judgement types are present", () => {
cy.visit('/trusts/ofsted/safeguarding-and-concerns?uid=5712');
ofstedPage
.checkSafeguardingConcernsEffectiveSafeguardingJudgementsPresent()
.checkSafeguardingConcernsCategoryOfConcernJudgementsPresent()
.checkSafeguardingConcernsCategoryOfConcernJudgementsPresent()
.checkSafeguardingConcernsBeforeOrAfterJoiningJudgementsPresent();
});

});

describe("Testing the Ofsted important dates page ", () => {
beforeEach(() => {
cy.login();
Expand All @@ -104,7 +144,7 @@ describe("Testing the Ofsted page and its subpages ", () => {
it("Checks the correct Ofsted important dates sub page header is present", () => {
ofstedPage
.checkOfstedImportantDatesPageHeaderPresent();
})
});

it("Checks the correct Ofsted important dates table headers are present", () => {
ofstedPage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class OfstedPage {
// Resolves to a date ({2 digits} {month} {4 digits}) or "No data" string
// Tech debt - We are allowing Sep and Sept due to different cultures set on remote vs local builds
dateRegex = /^\d{1,2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec) \d{4}$|^No data$/;
previousAndCurrentRatingsMatch = /Good|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected|Insufficient evidence/;

elements = {
subpageHeader: () => cy.get('[data-testid="subpage-header"]'),
Expand Down Expand Up @@ -46,6 +47,17 @@ class OfstedPage {
beforeOrAfterJoiningHeader: () => this.elements.previousRatings.Section().find('[data-testid="ofsted-previous-ratings-before-or-after-joining-header"]'),
beforeOrAfterJoining: () => this.elements.previousRatings.Section().find('[data-testid="ofsted-previous-ratings-before-or-after-joining"]'),
},
safeguardingAndConcerns: {
Section: () => cy.get('[data-testid="ofsted-safeguarding-and-concerns-name-table"]'),
SchoolNameHeader: () => this.elements.safeguardingAndConcerns.Section().find('[data-testid="ofsted-safeguarding-and-concerns-name-header"]'),
SchoolName: () => this.elements.safeguardingAndConcerns.Section().find('[data-testid="ofsted-safeguarding-and-concerns-school-name"]'),
effectiveSafeguardingHeader: () => this.elements.safeguardingAndConcerns.Section().find('[data-testid="ofsted-safeguarding-and-concerns-effective-safeguarding-header"]'),
effectiveSafeguarding: () => this.elements.safeguardingAndConcerns.Section().find('[data-testid="ofsted-safeguarding-and-concerns-effective-safeguarding"]'),
categoryOfConcernHeader: () => this.elements.safeguardingAndConcerns.Section().find('[data-testid="ofsted-safeguarding-and-concerns-category-of-concern-header"]'),
categoryOfConcern: () => this.elements.safeguardingAndConcerns.Section().find('[data-testid="category-of-concern"]'),
beforeOrAfterJoiningHeader: () => this.elements.safeguardingAndConcerns.Section().find('[data-testid="ofsted-safeguarding-and-concerns-before-or-after-joining-header"]'),
beforeOrAfterJoining: () => this.elements.safeguardingAndConcerns.Section().find('[data-testid="ofsted-safeguarding-before-or-after-joining"]'),
},
importantDates: {
Section: () => cy.get('[data-testid="ofsted-important-dates-school-name-table"]'),
SchoolName: () => this.elements.importantDates.Section().find('[data-testid="ofsted-important-dates-school-name"]'),
Expand Down Expand Up @@ -119,47 +131,47 @@ class OfstedPage {
public checkCurrentRatingsQualityOfEducationJudgementsPresent(): this {
this.elements.currentRatings.qualityOfEducation().each((element) => {
const text = element.text();
expect(text).to.match(/Good|Outstanding|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected/);
expect(text).to.match(this.previousAndCurrentRatingsMatch);
});
return this;
}

public checkCurrentRatingsBehaviourAndAttitudesJudgementsPresent(): this {
this.elements.currentRatings.behaviourAndAttitudes().each((element) => {
const text = element.text();
expect(text).to.match(/Good|Outstanding|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected/);
expect(text).to.match(this.previousAndCurrentRatingsMatch);
});
return this;
}

public checkCurrentRatingsPesronalDevelopmentJudgementsPresent(): this {
this.elements.currentRatings.personalDevelopment().each((element) => {
const text = element.text();
expect(text).to.match(/Good|Outstanding|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected/);
expect(text).to.match(this.previousAndCurrentRatingsMatch);
});
return this;
}

public checkCurrentRatingsLeadershipAndManagementJudgementsPresent(): this {
this.elements.currentRatings.leadershipAndManagement().each((element) => {
const text = element.text();
expect(text).to.match(/Good|Outstanding|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected|Does not apply/);
expect(text).to.match(this.previousAndCurrentRatingsMatch);
});
return this;
}

public checkCurrentRatingsEarlyYearsProvisionJudgementsPresent(): this {
this.elements.currentRatings.earlyYearsProvision().each((element) => {
const text = element.text();
expect(text).to.match(/Good|Outstanding|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected|Does not apply/);
expect(text).to.match(this.previousAndCurrentRatingsMatch);
});
return this;
}

public checkCurrentRatingsSixthFormProvisionJudgementsPresent(): this {
this.elements.currentRatings.sixthFormProvision().each((element) => {
const text = element.text();
expect(text).to.match(/Good|Outstanding|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected|Does not apply/);
expect(text).to.match(this.previousAndCurrentRatingsMatch);
});
return this;
}
Expand Down Expand Up @@ -235,47 +247,47 @@ class OfstedPage {
public checkPreviousRatingsQualityOfEducationJudgementsPresent(): this {
this.elements.previousRatings.qualityOfEducation().each((element) => {
const text = element.text();
expect(text).to.match(/Good|Outstanding|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected/);
expect(text).to.match(this.previousAndCurrentRatingsMatch);
});
return this;
}

public checkPreviousRatingsBehaviourAndAttitudesJudgementsPresent(): this {
this.elements.previousRatings.behaviourAndAttitudes().each((element) => {
const text = element.text();
expect(text).to.match(/Good|Outstanding|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected/);
expect(text).to.match(this.previousAndCurrentRatingsMatch);
});
return this;
}

public checkPreviousRatingsPesronalDevelopmentJudgementsPresent(): this {
this.elements.previousRatings.personalDevelopment().each((element) => {
const text = element.text();
expect(text).to.match(/Good|Outstanding|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected/);
expect(text).to.match(this.previousAndCurrentRatingsMatch);
});
return this;
}

public checkPreviousRatingsLeadershipAndManagementJudgementsPresent(): this {
this.elements.previousRatings.leadershipAndManagement().each((element) => {
const text = element.text();
expect(text).to.match(/Good|Outstanding|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected|Does not apply/);
expect(text).to.match(this.previousAndCurrentRatingsMatch);
});
return this;
}

public checkPreviousRatingsEarlyYearsProvisionJudgementsPresent(): this {
this.elements.previousRatings.earlyYearsProvision().each((element) => {
const text = element.text();
expect(text).to.match(/Good|Outstanding|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected|Does not apply/);
expect(text).to.match(this.previousAndCurrentRatingsMatch);
});
return this;
}

public checkPreviousRatingsSixthFormProvisionJudgementsPresent(): this {
this.elements.previousRatings.sixthFormProvision().each((element) => {
const text = element.text();
expect(text).to.match(/Good|Outstanding|No judgement|Outstanding|Requires improvement|Inadequate|Not yet inspected|Does not apply/);
expect(text).to.match(this.previousAndCurrentRatingsMatch);
});
return this;
}
Expand All @@ -288,6 +300,65 @@ class OfstedPage {
return this;
}

//Safeguarding and Concerns///

public checkOfstedSafeguardingConcernsPageHeaderPresent(): this {
this.elements.subpageHeader().should('contain', 'Safeguarding and concerns');
return this;
}

public checkOfstedSafeguardingConcernsTableHeadersPresent(): this {
this.elements.safeguardingAndConcerns.SchoolNameHeader().should('be.visible');
this.elements.safeguardingAndConcerns.effectiveSafeguardingHeader().should('be.visible');
this.elements.safeguardingAndConcerns.categoryOfConcern().should('be.visible');
this.elements.safeguardingAndConcerns.beforeOrAfterJoining().should('be.visible');
return this;
}

public checkOfstedSafeguardingConcernsSorting(): this {
TableUtility.checkStringSorting(
this.elements.safeguardingAndConcerns.SchoolName,
this.elements.safeguardingAndConcerns.SchoolNameHeader
);
TableUtility.checkStringSorting(
this.elements.safeguardingAndConcerns.effectiveSafeguarding,
this.elements.safeguardingAndConcerns.effectiveSafeguardingHeader
);
TableUtility.checkStringSorting(
this.elements.safeguardingAndConcerns.categoryOfConcern,
this.elements.safeguardingAndConcerns.categoryOfConcernHeader
);
TableUtility.checkStringSorting(
this.elements.safeguardingAndConcerns.beforeOrAfterJoining,
this.elements.safeguardingAndConcerns.beforeOrAfterJoiningHeader
);
return this;
}

public checkSafeguardingConcernsEffectiveSafeguardingJudgementsPresent(): this {
this.elements.safeguardingAndConcerns.effectiveSafeguarding().each((element) => {
const text = element.text();
expect(text).to.match(/Yes|No|Not recorded/);
});
return this;
}

public checkSafeguardingConcernsCategoryOfConcernJudgementsPresent(): this {
this.elements.safeguardingAndConcerns.categoryOfConcern().each((element) => {
const text = element.text();
expect(text).to.match(/Not yet inspected|Special measures|Serious weakness|Notice to improve|Not yet inspected|Does not apply/);
});
return this;
}

public checkSafeguardingConcernsBeforeOrAfterJoiningJudgementsPresent(): this {
this.elements.safeguardingAndConcerns.beforeOrAfterJoining().each((element) => {
const text = element.text();
expect(text).to.match(/Before|After|Not yet inspected/);
});
return this;
}

// Important Dates

public checkOfstedImportantDatesPageHeaderPresent(): this {
Expand Down

0 comments on commit ccb41be

Please sign in to comment.