Skip to content

Commit

Permalink
added a test for checking a trust with minimal information
Browse files Browse the repository at this point in the history
  • Loading branch information
mikestock-nimble committed Jan 23, 2024
1 parent c805049 commit e904092
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import { Logger } from "cypress/common/logger";
import academiesDetailsTable from "cypress/pages/academiesDetailsTable";
import academiesFreeSchoolMealsTable from "cypress/pages/academiesFreeSchoolMealsTable";
import academiesOfstedRatingsTable from "cypress/pages/academiesOfstedRatingsTable";
import academiesPupilNumbersTable from "cypress/pages/academiesPupilNumbersTable";
import searchTrustPage from "cypress/pages/searchTrustPage";
import trustContactsPage from "cypress/pages/trustContactsPage";
import trustDetailsPage from "cypress/pages/trustDetailsPage";
import trustOverviewPage from "cypress/pages/trustOverviewPage";
import trustPage from "cypress/pages/trustPage";

describe("Checking the details of a trust that does not have any information", () => {
beforeEach(() => {
Expand All @@ -16,5 +25,58 @@ describe("Checking the details of a trust that does not have any information", (
});

searchTrustPage.search();

trustPage
.hasName("The empty trust")
.hasType("Single-academy trust");

trustDetailsPage
.hasAddress("")
.hasOpenedOn("")
.hasRegionAndTerritory("")
.hasUid("1313")
.hasTrustReferenceNumber("TR3943")
.hasUkprn("")
.hasCompaniesHouseNumber("");

Logger.log("Checking the contacts page");
trustPage.viewContacts();

trustContactsPage
.hasEmptyContacts();

Logger.log("Checking the overview page");
trustPage.viewOverview();

trustOverviewPage
.hasTotalAcademies("0")
.hasAcademiesInEachAuthority("")
.hasNumberOfPupils("0")
.hasPupilCapacity("0", "0")
.hasOfstedRatingOutstanding("0")
.hasOfstedRatingsGood("0")
.hasOfstedRatingRequiresImprovement("0")
.hasOfstedRatingInadequate("0")
.hasOfstedRatingNotInspectedYet("0");

Logger.log("Checking the academies details");
trustPage.viewAcademies();

academiesDetailsTable.hasNoRows();

Logger.log("Checking the academies ofsted ratings");
trustPage.viewAcademyOfstedRatings();

academiesOfstedRatingsTable.hasNoRows();

Logger.log("Checking the academies pupil numbers");
trustPage.viewAcademyPupilNumbers();

academiesPupilNumbersTable.hasNoRows();

Logger.log("Checking free school meals");
trustPage.viewFreeSchoolMeals();

academiesFreeSchoolMealsTable.hasNoRows();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe("Searching for a trust and checking information", () => {
.hasTrustRelationshipManager("Cindy Bergstrom", "[email protected]")
.hasSfsoLead("Vickie Gulgowski", "[email protected]")
.hasAccountingOfficer("Grant Schroeder", "[email protected]")
.hasChairOfTrustees("Kirk Adams", "[email protected]")
.hasChiefFinancialOfficer("Brandi Bernier", "[email protected]");

cy.excuteAccessibilityTests();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ class AcademiesDetailsTable {
return new AcademiesDetailsRow(el);
});
}

public hasNoRows(): this {
cy.getByTestId("academy-row")
.should("not.exist");

return this;

}
}

class AcademiesDetailsRow {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ class AcademiesFreeSchoolMealsTable {
return new AcademiesFreeSchoolMealsRow(el);
});
}

public hasNoRows(): this {
cy.getByTestId("academy-row")
.should("not.exist");

return this;
}
}

class AcademiesFreeSchoolMealsRow {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ class AcademiesOfstedRatingsTable {
return new AcademiesOfsetRatingsRow(el);
});
}

public hasNoRows(): this {
cy.getByTestId("academy-row")
.should("not.exist");

return this;

}
}

class AcademiesOfsetRatingsRow {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ class AcademiesPupilNumbersTable {
return new AcademiesPupilNumbersRow(el);
});
}

public hasNoRows(): this {
cy.getByTestId("academy-row")
.should("not.exist");

return this;
}
}

class AcademiesPupilNumbersRow {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,27 @@ class TrustContacts {
return this;
}

public hasChairOfTrustees(name: string, email: string): this {
this.assertContact("chair-of-trustees", name, email);

return this;
}

public hasEmptyContacts(): this {
this.assertEmptyContact("trust-relationship-manager");
this.assertEmptyContact("sfso-lead");
this.assertEmptyContact("accounting-officer");
this.assertEmptyContact("chief-financial-officer");
this.assertEmptyContact("chair-of-trustees");

return this;
}

private assertEmptyContact(id: string): void {
cy.getByTestId(id)
.find("p").should("contain.text", "No contact information available");
}

private assertContact(id: string, name: string, email: string): void {
cy.getByTestId(id)
.find("[data-testid='contact-name']").should("contain.text", name);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class TrustDetailsPage {
public hasAddress(value): this {

cy.getByTestId("address").should("contain.text", value);
return this;
}
Expand Down

0 comments on commit e904092

Please sign in to comment.