Skip to content

Commit

Permalink
Merge pull request #648 from DFE-Digital/ofsted-page-download-automation
Browse files Browse the repository at this point in the history
Ofsted page add download test to automation
  • Loading branch information
nwarms authored Dec 2, 2024
2 parents ccb41be + 2ffe364 commit 3648f53
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import ofstedPage from "../../../pages/trusts/ofstedPage";
import dataDownload from "../../../pages/trusts/dataDownload";

describe("Testing the Ofsted page and its subpages ", () => {

describe("Testing the Ofsted current ratings page ", () => {
beforeEach(() => {
cy.login();
cy.visit('/trusts/ofsted/current-ratings?uid=5143');

cy.task('checkForFiles', 'cypress/downloads').then((files) => {
if (files) {
cy.task('clearDownloads', 'cypress/downloads');
}
});
});

it("Checks the correct Ofsted current ratings subpage header is present", () => {
Expand Down Expand Up @@ -46,12 +53,26 @@ describe("Testing the Ofsted page and its subpages ", () => {
.checkCurrentRatingsBeforeOrAfterJoiningJudgementsPresent();
});

it('should export academies data as an xlsx and verify it has downloaded and has content', () => {
ofstedPage
.clickDownloadButton();
dataDownload
.checkFileDownloaded()
.checkFileHasContent()
.deleteDownloadedFile();
});
});

describe("Testing the Ofsted previous ratings page ", () => {
beforeEach(() => {
cy.login();
cy.visit('/trusts/ofsted/previous-ratings?uid=5143');

cy.task('checkForFiles', 'cypress/downloads').then((files) => {
if (files) {
cy.task('clearDownloads', 'cypress/downloads');
}
});
});

it("Checks the correct Ofsted Previous ratings subpage header is present", () => {
Expand Down Expand Up @@ -92,12 +113,26 @@ describe("Testing the Ofsted page and its subpages ", () => {
.checkPreviousRatingsBeforeOrAfterJoiningJudgementsPresent();
});

it('should export academies data as an xlsx and verify it has downloaded and has content', () => {
ofstedPage
.clickDownloadButton();
dataDownload
.checkFileDownloaded()
.checkFileHasContent()
.deleteDownloadedFile();
});
});

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

cy.task('checkForFiles', 'cypress/downloads').then((files) => {
if (files) {
cy.task('clearDownloads', 'cypress/downloads');
}
});
});

it("Checks the correct Ofsted safeguarding and concerns subpage header is present", () => {
Expand Down Expand Up @@ -132,14 +167,28 @@ describe("Testing the Ofsted page and its subpages ", () => {
.checkSafeguardingConcernsBeforeOrAfterJoiningJudgementsPresent();
});

it('should export academies data as an xlsx and verify it has downloaded and has content', () => {
ofstedPage
.clickDownloadButton();
dataDownload
.checkFileDownloaded()
.checkFileHasContent()
.deleteDownloadedFile();
});
});

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

// Clear the downloads folder before running each test
cy.task('checkForFiles', 'cypress/downloads').then((files) => {
if (files) {
cy.task('clearDownloads', 'cypress/downloads');
}
});
});

it("Checks the correct Ofsted important dates sub page header is present", () => {
ofstedPage
Expand Down Expand Up @@ -171,5 +220,13 @@ describe("Testing the Ofsted page and its subpages ", () => {
.checkDateOfPreviousInspectionPresent();
});

it('should export academies data as an xlsx and verify it has downloaded and has content', () => {
ofstedPage
.clickDownloadButton();
dataDownload
.checkFileDownloaded()
.checkFileHasContent()
.deleteDownloadedFile();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class OfstedPage {

elements = {
subpageHeader: () => cy.get('[data-testid="subpage-header"]'),
downloadButton: () => cy.get('[data-testid="download-all-ofsted-data-button"]'),
currentRatings: {
Section: () => cy.get('[data-testid="ofsted-current-ratings-table"]'),
SchoolName: () => this.elements.currentRatings.Section().find('[data-testid="ofsted-current-ratings-school-name"]'),
Expand Down Expand Up @@ -420,6 +421,10 @@ class OfstedPage {
return this;
}

public clickDownloadButton(): this {
this.elements.downloadButton().click();
return this;
}
}

const ofstedPage = new OfstedPage();
Expand Down

0 comments on commit 3648f53

Please sign in to comment.