From 407e5dc64349bec1c55eb064b99dfd2c9cb34f28 Mon Sep 17 00:00:00 2001 From: alexmcdermid Date: Mon, 19 Aug 2024 11:41:24 -0700 Subject: [PATCH] AT: district ell downloadable reports --- .../summaryReports.cy.ts | 52 +++++++++++++++++++ tests-e2e/cypress/support/selectors.ts | 4 +- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/tests-e2e/cypress/e2e/sdc-district-collection/summaryReports.cy.ts b/tests-e2e/cypress/e2e/sdc-district-collection/summaryReports.cy.ts index 8f8275c5..73a91030 100644 --- a/tests-e2e/cypress/e2e/sdc-district-collection/summaryReports.cy.ts +++ b/tests-e2e/cypress/e2e/sdc-district-collection/summaryReports.cy.ts @@ -41,6 +41,58 @@ describe('SDC District Collection View', () => { }); beforeEach(() => cy.login()); + it('can download Eligible English Language Learning Program Headcount', () => { + cy.intercept('/api/sdc/sdcSchoolCollectionStudent/getDistrictHeadcounts/*?type=ell&compare=false').as('tableLoaded'); + cy.visit('/open-district-collection-details/' + Cypress.env('sdcDistrictCollectionID')); + cy.get(selectors.studentLevelData.stepThree).should('exist').should('have.class', 'v-stepper-item--selected'); + cy.get(selectors.stepThreeTabSlider.englishLanguageLearningButton).should('exist').click(); + cy.get(selectors.ellComponent.summaryButton).should('exist').click(); + + cy.get('#reports').parent().click(); + cy.get(selectors.dropdown.listItem).contains('Eligible English Language Learners Headcount for District').click(); + cy.wait('@tableLoaded'); + cy.get(selectors.ellComponent.headcountReportDis).should('be.visible'); + + cy.get(selectors.studentLevelData.pdfDownloadLink).then(($link) => { + const href = $link.prop('href'); + const downloadPath = 'path/to/download/directory/ellDis.pdf'; + + cy.downloadFile(href, 'path/to/download/directory', 'ellDis.pdf').then(() => { + cy.readFile(downloadPath, 'binary').should((data) => { + expect(data).to.not.be.empty; + const expectedSizeBytes = 244045; + expect(data.length).to.be.closeTo(expectedSizeBytes, 10240); + }); + }); + }); + }); + + it('can download Eligible English Language Learning Program Headcount per School', () => { + cy.intercept('/api/sdc/sdcSchoolCollectionStudent/getDistrictHeadcounts/*?type=ell-per-school&compare=false').as('tableLoaded'); + cy.visit('/open-district-collection-details/' + Cypress.env('sdcDistrictCollectionID')); + cy.get(selectors.studentLevelData.stepThree).should('exist').should('have.class', 'v-stepper-item--selected'); + cy.get(selectors.stepThreeTabSlider.englishLanguageLearningButton).should('exist').click(); + cy.get(selectors.ellComponent.summaryButton).should('exist').click(); + + cy.get('#reports').parent().click(); + cy.get(selectors.dropdown.listItem).contains('Eligible English Language Learners Headcount per school').click(); + cy.wait('@tableLoaded'); + cy.get(selectors.ellComponent.headcountReportPerSchool).should('be.visible'); + + cy.get(selectors.studentLevelData.pdfDownloadLink).then(($link) => { + const href = $link.prop('href'); + const downloadPath = 'path/to/download/directory/ellDisPerSchool.pdf'; + + cy.downloadFile(href, 'path/to/download/directory', 'ellDisPerSchool.pdf').then(() => { + cy.readFile(downloadPath, 'binary').should((data) => { + expect(data).to.not.be.empty; + const expectedSizeBytes = 244045; + expect(data.length).to.be.closeTo(expectedSizeBytes, 10240); + }); + }); + }); + }); + it('can view Eligible Enrolment & Eligible FTE report', () => { cy.visit('/open-district-collection-details/' + Cypress.env('sdcDistrictCollectionID')); cy.get(selectors.studentLevelData.stepThree).should('exist').should('have.class', 'v-stepper-item--selected'); diff --git a/tests-e2e/cypress/support/selectors.ts b/tests-e2e/cypress/support/selectors.ts index 686ee5ae..2f9e43ff 100644 --- a/tests-e2e/cypress/support/selectors.ts +++ b/tests-e2e/cypress/support/selectors.ts @@ -100,7 +100,9 @@ export default { summaryButton: '#engLangSummaryButton', headcountCard: '.ell-headcount-card', headcountHeader: '.ell-headcount-header', - headcountColumnData: '.ell-headcount-column-data' + headcountColumnData: '.ell-headcount-column-data', + headcountReportDis: '#eligELLHeadcountForDistrict', + headcountReportPerSchool: '#eligELLHeadcountPerSchool', }, frenchComponent: { tab: '#frenchTab',