Skip to content

Commit

Permalink
Merge pull request #1528 from bcgov/feature/edx-2339
Browse files Browse the repository at this point in the history
AT: EDX-2340
  • Loading branch information
mightycox authored May 13, 2024
2 parents b5cfbae + 03ceda0 commit b50faff
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('SDC School Collection View', () => {
cy.task<SchoolUserOptions, EdxUserEntity>('setup-schoolUser', { schoolCodes: ['99998'] });
});
});
// after(() => cy.logout());
after(() => cy.logout());
beforeEach(() => cy.login());

it('can load dashboard & click data collection card & process collection', () => {
Expand Down
113 changes: 113 additions & 0 deletions tests-e2e/cypress/e2e/sdc-district-collection/summaryReports.cy.ts
Original file line number Diff line number Diff line change
@@ -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<AppSetupData>('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<DistrictCollectionOptions, SdcCollections>('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');
});

});
});
38 changes: 38 additions & 0 deletions tests-e2e/cypress/services/sdc-collection-api-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
21 changes: 20 additions & 1 deletion tests-e2e/cypress/support/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit b50faff

Please sign in to comment.