From 03ceda0e61c6a380964bb3a2e6ae5d478258d718 Mon Sep 17 00:00:00 2001 From: Avisha Sodhi <38086281+SodhiA1@users.noreply.github.com> Date: Mon, 13 May 2024 15:31:35 -0700 Subject: [PATCH] AT: EDX-2340 --- .../stepThreeSummaryReports.cy.ts | 2 +- .../summaryReports.cy.ts | 113 ++++++++++++++++++ .../services/sdc-collection-api-service.ts | 38 ++++++ tests-e2e/cypress/support/selectors.ts | 21 +++- 4 files changed, 172 insertions(+), 2 deletions(-) create mode 100644 tests-e2e/cypress/e2e/sdc-district-collection/summaryReports.cy.ts diff --git a/tests-e2e/cypress/e2e/sdc-collection/stepThreeSummaryReports.cy.ts b/tests-e2e/cypress/e2e/sdc-collection/stepThreeSummaryReports.cy.ts index 54db6469d..b37de620f 100644 --- a/tests-e2e/cypress/e2e/sdc-collection/stepThreeSummaryReports.cy.ts +++ b/tests-e2e/cypress/e2e/sdc-collection/stepThreeSummaryReports.cy.ts @@ -22,7 +22,7 @@ describe('SDC School Collection View', () => { cy.task('setup-schoolUser', { schoolCodes: ['99998'] }); }); }); - // after(() => cy.logout()); + after(() => cy.logout()); beforeEach(() => cy.login()); it('can load dashboard & click data collection card & process collection', () => { diff --git a/tests-e2e/cypress/e2e/sdc-district-collection/summaryReports.cy.ts b/tests-e2e/cypress/e2e/sdc-district-collection/summaryReports.cy.ts new file mode 100644 index 000000000..220f90572 --- /dev/null +++ b/tests-e2e/cypress/e2e/sdc-district-collection/summaryReports.cy.ts @@ -0,0 +1,113 @@ +import selectors from '../../support/selectors'; +import { AppSetupData } from '../../../cypress.config'; +import { DistrictCollectionOptions } from 'tests-e2e/cypress/services/sdc-collection-api-service'; + +describe('SDC District Collection View', () => { + context('As an EDX District User', () => { + before(() => { + cy.logout(); + cy.task('districtDataLoad', { + schoolOptions: [ + { + includeTombstoneValues: true, + includeSchoolAddress: true, + includeSchoolContact: true, + schoolStatus: 'Open', + withPrimaryActivationCode: true, + isIndependentSchool: false, + schoolCode: '99990' + }, + { + includeTombstoneValues: true, + includeSchoolAddress: true, + includeSchoolContact: true, + schoolStatus: 'Open', + withPrimaryActivationCode: true, + isIndependentSchool: false, + schoolCode: '99991' + } + ] + }).then(res => { + cy.task('setup-district-collections', { + schools: res.schools, + district: res.district, + loadWithStudentAndValidations: false, + seedData: 'sdcDistrictCollectionSummarySeedData' + }).then(response => { + Cypress.env('sdcDistrictCollectionID', response?.sdcDistrictCollection?.sdcDistrictCollectionID); + }); + cy.task('setup-districtUser', { districtRoles: ['DISTRICT_SDC'], districtCodes: ['998'] }); + }); + }); + beforeEach(() => cy.login()); + + 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'); + cy.get(selectors.studentLevelData.stepThreeStudentsFound).contains('Students Found: 10'); + + //check summary headcounts + cy.get(selectors.fteComponent.summaryButton).click(); + cy.get(selectors.fteComponent.headcountCard).should('have.length', 2); + cy.get(selectors.fteComponent.headcountCard).eq(0).find(selectors.fteComponent.headcountColumnData).should('have.length', 4); + cy.get(selectors.fteComponent.headcountCard).eq(0).find(selectors.fteComponent.headcountHeader).should('contain.text', 'Student Headcount'); + cy.get(selectors.fteComponent.headcountCard).eq(0).find(selectors.fteComponent.headcountColumnData).eq(0).children('div').should('contain.text', 'Preschool Aged'); + cy.get(selectors.fteComponent.headcountCard).eq(0).find(selectors.fteComponent.headcountColumnData).eq(0).children('div:nth-child(2)').children('span').should('contain.text', '0'); + cy.get(selectors.fteComponent.headcountCard).eq(0).find(selectors.fteComponent.headcountColumnData).eq(1).children('div').should('contain.text', 'School Aged'); + cy.get(selectors.fteComponent.headcountCard).eq(0).find(selectors.fteComponent.headcountColumnData).eq(1).children('div:nth-child(2)').children('span').should('contain.text', '10'); + cy.get(selectors.fteComponent.headcountCard).eq(0).find(selectors.fteComponent.headcountColumnData).eq(2).children('div').should('contain.text', 'Adult'); + cy.get(selectors.fteComponent.headcountCard).eq(0).find(selectors.fteComponent.headcountColumnData).eq(2).children('div:nth-child(2)').children('span').should('contain.text', '0'); + cy.get(selectors.fteComponent.headcountCard).eq(0).find(selectors.fteComponent.headcountColumnData).eq(3).children('div').should('contain.text', 'All Students'); + cy.get(selectors.fteComponent.headcountCard).eq(0).find(selectors.fteComponent.headcountColumnData).eq(3).children('div:nth-child(2)').children('span').should('contain.text', '10'); + cy.get(selectors.fteComponent.headcountCard).eq(1).find(selectors.fteComponent.headcountHeader).should('contain.text', 'Grade Headcount'); + cy.get(selectors.fteComponent.headcountCard).eq(1).find(selectors.fteComponent.headcountColumnData).should('have.length', 2); + cy.get(selectors.fteComponent.headcountCard).eq(1).find(selectors.fteComponent.headcountColumnData).eq(0).children('div').should('contain.text', '09'); + cy.get(selectors.fteComponent.headcountCard).eq(1).find(selectors.fteComponent.headcountColumnData).eq(0).children('div:nth-child(2)').children('span').should('contain.text', '6'); + cy.get(selectors.fteComponent.headcountCard).eq(1).find(selectors.fteComponent.headcountColumnData).eq(1).children('div').should('contain.text', '10'); + cy.get(selectors.fteComponent.headcountCard).eq(1).find(selectors.fteComponent.headcountColumnData).eq(1).children('div:nth-child(2)').children('span').should('contain.text', '4'); + + // check summary table + cy.get(selectors.fteComponent.table).should('exist').contains(1); + cy.get(selectors.fteComponent.table).eq(0).find(selectors.fteComponent.tableWrapper); + cy.get(selectors.fteComponent.tableWrapper).contains('School Aged'); + cy.get(selectors.fteComponent.tableWrapper).contains('Adult'); + cy.get(selectors.fteComponent.tableWrapper).contains('All Students'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.districtUnderSchoolAgedHeadcount).should('contain.text', '0'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.districtUnderSchoolAgedEligibleFTE).should('contain.text', '0'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.districtUnderSchoolAgedTotal).should('contain.text', '0'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.districtSchoolAgedHeadcount).should('contain.text', '10'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.districtSchoolAgedEligibleFTE).should('contain.text', '10'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.districtSchoolAgedTotal).should('contain.text', '9.1000'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.districtAdultHeadcount).should('contain.text', '0'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.districtAdultEligibleFTE).should('contain.text', '0'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.districtAdultTotal).should('contain.text', '0'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.districtAllHeadcount).should('contain.text', '10'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.districtAllEligibleFTE).should('contain.text', '10'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.districtAllTotal).should('contain.text', '9.1000'); + }); + + it('can view Grade Enrolment & FTE per School report', () => { + 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.studentLevelData.stepThreeStudentsFound).contains('Students Found: 10'); + cy.get(selectors.fteComponent.summaryButton).click(); + + cy.get(selectors.fteComponent.availableReports).parent().click(); + cy.get(selectors.dropdown.listItem).contains('Grade Enrolment & FTE per School').click(); + + // check summary table + cy.get(selectors.fteComponent.table).should('exist').contains(1); + cy.get(selectors.fteComponent.table).eq(0).find(selectors.fteComponent.tableWrapper); + cy.get(selectors.fteComponent.tableWrapper).contains('99899990 - EDX Automation Testing School'); + cy.get(selectors.fteComponent.tableWrapper).contains('99899991 - EDX Automation Testing School'); + cy.get(selectors.fteComponent.tableWrapper).contains('All Schools'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.school1Headcount).should('contain.text', '5'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.school1FTETotal).should('contain.text', '4.5500'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.school2Headcount).should('contain.text', '5'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.school2FTETotal).should('contain.text', '4.5500'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.allSchoolHeadcount).should('contain.text', '10'); + cy.get(selectors.fteComponent.tableWrapper).find(selectors.fteComponent.allSchoolFTETotal).should('contain.text', '9.1'); + }); + + }); +}); diff --git a/tests-e2e/cypress/services/sdc-collection-api-service.ts b/tests-e2e/cypress/services/sdc-collection-api-service.ts index bee10880d..ebeb8614a 100644 --- a/tests-e2e/cypress/services/sdc-collection-api-service.ts +++ b/tests-e2e/cypress/services/sdc-collection-api-service.ts @@ -772,6 +772,44 @@ export class SdcCollectionApiService { } })); break; + case 'sdcDistrictCollectionSummarySeedData': + sdcDistrictCollection.sdcDistrictCollectionStatusCode = 'REVIEWED'; + + sdcSchoolCollections.forEach(x => x.students.map((student, index) => { + if(index % 2 === 0) { + student.enrolledGradeCode = '09'; + student.localID = '67890'; + student.enrolledProgramCodes = '082917'; + student.studentPen = '101932770'; + student.nativeAncestryInd = 'Y'; + student.bandCode = '0547'; + student.numberOfCourses = '0700'; + student.assignedStudentId = 'ce4bec97-b986-4815-a9f8-6bdfe8578dcf'; + student.isGraduated = 'false'; + student.specialEducationCategoryCode = 'A'; + student.localID = 'student1'; + student.penMatchResult = 'DM'; + student.fte = 1; + } else { + student.enrolledGradeCode = '10'; + student.enrolledProgramCodes = '1141'; + student.careerProgramCode = 'XA'; + student.studentPen = '102866365'; + student.nativeAncestryInd = 'Y'; + student.bandCode = '0653'; + student.numberOfCourses = '0700'; + student.specialEducationCategoryCode = 'G'; + student.assignedPen = '101930550'; + student.penMatchResult = 'MATCH'; + student.localID = 'student3'; + student.fte = .775; + } + + student.isSchoolAged = 'true'; + student.isAdult = 'false'; + student.legalLastName = 'LEGALLAST'; + })); + break; default: break; } diff --git a/tests-e2e/cypress/support/selectors.ts b/tests-e2e/cypress/support/selectors.ts index 59bb0731c..6d9172da5 100644 --- a/tests-e2e/cypress/support/selectors.ts +++ b/tests-e2e/cypress/support/selectors.ts @@ -137,7 +137,26 @@ export default { adultTotal: ':nth-child(12) > :nth-child(19) > .zero-cell', allHeadcount: ':nth-child(14) > :nth-child(19) > div > span', allEligibleFTE: ':nth-child(15) > :nth-child(19) > div > span', - allTotal: ':nth-child(16) > :nth-child(19) > div > span' + allTotal: ':nth-child(16) > :nth-child(19) > div > span', + districtUnderSchoolAgedHeadcount: ':nth-child(2) > :nth-child(20) > .zero-cell', + districtUnderSchoolAgedEligibleFTE : ':nth-child(3) > :nth-child(20) > .zero-cell', + districtUnderSchoolAgedTotal: ':nth-child(4) > :nth-child(20) > .zero-cell', + districtSchoolAgedHeadcount: ':nth-child(6) > :nth-child(20) > div > span', + districtSchoolAgedEligibleFTE : ':nth-child(7) > :nth-child(20) > div > span', + districtSchoolAgedTotal: ':nth-child(8) > :nth-child(20) > div > span', + districtAdultHeadcount: ':nth-child(10) > :nth-child(20) > .zero-cell', + districtAdultEligibleFTE: ':nth-child(11) > :nth-child(20) > .zero-cell', + districtAdultTotal: ':nth-child(12) > :nth-child(20) > .zero-cell', + districtAllHeadcount: ':nth-child(14) > :nth-child(20) > div > span', + districtAllEligibleFTE: ':nth-child(15) > :nth-child(20) > div > span', + districtAllTotal: ':nth-child(16) > :nth-child(20) > div > span', + school1Headcount: ':nth-child(2) > :nth-child(20) > div > span', + school1FTETotal: ':nth-child(3) > :nth-child(20) > div > span', + school2Headcount: ':nth-child(5) > :nth-child(20) > div > span', + school2FTETotal: ':nth-child(6) > :nth-child(20) > div > span', + allSchoolHeadcount: ':nth-child(8) > :nth-child(20) > div > span', + allSchoolFTETotal: ':nth-child(9) > :nth-child(20) > div > span', + availableReports: '#reports' }, hamburgerMenu: { administrationMenuOption: '#AdministrationMenuBtn',