[Study programme] Update tests

This commit is contained in:
Riku Rauhala
2025-02-27 14:14:16 +02:00
parent 2109cfcf87
commit ae83dc3563
32 changed files with 311 additions and 349 deletions
+12 -12
View File
@@ -410,19 +410,19 @@ describe('Course Statistics tests', () => {
describe('Students tab', () => {
describe('Info boxes', () => {
it('Student statistics table', () => {
cy.cs('StudentStatisticsInfoBoxButton').click()
cy.cs('StudentStatisticsInfoBoxContent').contains('Table - Students')
cy.cs('StudentStatistics-info-box-button').click()
cy.cs('StudentStatistics-info-box-content').contains('Table - Students')
})
it('Pass rate', () => {
cy.cs('PassRateStudentsInfoBoxButton').click()
cy.cs('PassRateStudentsInfoBoxContent').contains('Pass rate - Students')
cy.cs('PassRateStudents-info-box-button').click()
cy.cs('PassRateStudents-info-box-content').contains('Pass rate - Students')
})
it('Grade distribution', () => {
toggleShowGrades()
cy.cs('GradeDistributionInfoBoxButton').click()
cy.cs('GradeDistributionInfoBoxContent').contains('Grade distribution')
cy.cs('GradeDistribution-info-box-button').click()
cy.cs('GradeDistribution-info-box-content').contains('Grade distribution')
})
})
@@ -516,19 +516,19 @@ describe('Course Statistics tests', () => {
describe('Info boxes', () => {
it('Attempt statistics table', () => {
cy.cs('AttemptStatisticsInfoBoxButton').click()
cy.cs('AttemptStatisticsInfoBoxContent').contains('Table - Attempts')
cy.cs('AttemptStatistics-info-box-button').click()
cy.cs('AttemptStatistics-info-box-content').contains('Table - Attempts')
})
it('Pass rate', () => {
cy.cs('PassRateAttemptsInfoBoxButton').click()
cy.cs('PassRateAttemptsInfoBoxContent').contains('Pass rate - Attempts')
cy.cs('PassRateAttempts-info-box-button').click()
cy.cs('PassRateAttempts-info-box-content').contains('Pass rate - Attempts')
})
it('Grade distribution', () => {
toggleShowGrades()
cy.cs('GradeDistributionInfoBoxButton').click()
cy.cs('GradeDistributionInfoBoxContent').contains('Grade distribution')
cy.cs('GradeDistribution-info-box-button').click()
cy.cs('GradeDistribution-info-box-content').contains('Grade distribution')
})
})
+66 -66
View File
@@ -56,10 +56,10 @@ describe('Faculty statistics', () => {
})
it('Correct tabs are shown', () => {
cy.get('[data-cy="FacultyTabs"]').should('contain', 'Basic information')
cy.get('[data-cy="FacultyTabs"]').should('contain', 'Students by starting year')
cy.get('[data-cy="FacultyTabs"]').should('contain', 'Graduation times')
cy.get('[data-cy="FacultyTabs"]').should('contain', 'Update statistics')
cy.cs('faculty-tabs').should('contain', 'Basic information')
cy.cs('faculty-tabs').should('contain', 'Students by starting year')
cy.cs('faculty-tabs').should('contain', 'Graduation times')
cy.cs('faculty-tabs').should('contain', 'Update statistics')
})
})
@@ -71,66 +71,66 @@ describe('Faculty statistics', () => {
describe('Info boxes', () => {
it('Students of the faculty', () => {
cy.get('[data-cy=StudentsOfTheFacultyInfoBoxButton]').click()
cy.get('[data-cy=StudentsOfTheFacultyInfoBoxContent]').contains('Taulukon luvut on')
cy.cs('students-of-the-faculty-info-box-button').click()
cy.cs('students-of-the-faculty-info-box-content').contains('Taulukon luvut on')
})
it('Graduated of the faculty', () => {
cy.get('[data-cy=GraduatedOfTheFacultyInfoBoxButton]').click()
cy.get('[data-cy=GraduatedOfTheFacultyInfoBoxContent]').contains('Sisältää kyseisenä')
cy.cs('graduated-of-the-faculty-info-box-button').click()
cy.cs('graduated-of-the-faculty-info-box-content').contains('Sisältää kyseisenä')
})
it('Thesis writers of the faculty', () => {
cy.get('[data-cy=ThesisWritersOfTheFacultyInfoBoxButton]').click()
cy.get('[data-cy=ThesisWritersOfTheFacultyInfoBoxContent]').contains('Sisältää kyseisenä')
cy.cs('thesis-writers-of-the-faculty-info-box-button').click()
cy.cs('thesis-writers-of-the-faculty-info-box-content').contains('Sisältää kyseisenä')
})
it('Credits produced by the faculty', () => {
cy.get('[data-cy=CreditsProducedByTheFacultyInfoBoxButton]').click()
cy.get('[data-cy=CreditsProducedByTheFacultyInfoBoxContent]').contains('Sisältää opintopisteet')
cy.cs('credits-produced-by-the-faculty-info-box-button').click()
cy.cs('credits-produced-by-the-faculty-info-box-content').contains('Sisältää opintopisteet')
})
})
it('All graphs and tables are shown', () => {
cy.get('[data-cy="StudentsOfTheFacultyGraph"]').should('be.visible')
cy.get('[data-cy="StudentsOfTheFacultyInteractiveDataTable"]').should('be.visible')
cy.get('[data-cy="GraduatedOfTheFacultyGraph"]').should('be.visible')
cy.get('[data-cy="GraduatedOfTheFacultyInteractiveDataTable"]').should('be.visible')
cy.get('[data-cy="ThesisWritersOfTheFacultyGraph"]').should('be.visible')
cy.get('[data-cy="ThesisWritersOfTheFacultyInteractiveDataTable"]').should('be.visible')
cy.get('[data-cy="CreditsProducedByTheFacultyGraph"]').should('be.visible')
cy.get('[data-cy="CreditsProducedByTheFacultyInteractiveDataTable"]').should('be.visible')
cy.cs('students-of-the-faculty-line-graph-section').should('be.visible')
cy.cs('students-of-the-faculty-interactive-data-table').should('be.visible')
cy.cs('graduated-of-the-faculty-line-graph-section').should('be.visible')
cy.cs('graduated-of-the-faculty-interactive-data-table').should('be.visible')
cy.cs('thesis-writers-of-the-faculty-line-graph-section').should('be.visible')
cy.cs('thesis-writers-of-the-faculty-interactive-data-table').should('be.visible')
cy.cs('credits-produced-by-the-faculty-stacked-bar-chart-section').should('be.visible')
cy.cs('credits-produced-by-the-faculty-interactive-data-table').should('be.visible')
})
it('Correct tabs are shown', () => {
cy.get('[data-cy="FacultyTabs"]').should('contain', 'Basic information')
cy.get('[data-cy="FacultyTabs"]').should('contain', 'Students by starting year')
cy.get('[data-cy="FacultyTabs"]').should('contain', 'Graduation times')
cy.get('[data-cy="FacultyTabs"]').should('not.contain', 'Update statistics')
cy.cs('faculty-tabs').should('contain', 'Basic information')
cy.cs('faculty-tabs').should('contain', 'Students by starting year')
cy.cs('faculty-tabs').should('contain', 'Graduation times')
cy.cs('faculty-tabs').should('not.contain', 'Update statistics')
})
it('Toggle years works', () => {
cy.get('[data-cy="CreditsProducedByTheFacultyInteractiveDataTable"]').should('contain', '2022')
cy.get('[data-cy="ThesisWritersOfTheFacultyInteractiveDataTable"]').should('contain', '2022')
cy.get('[data-cy="StudentsOfTheFacultyInteractiveDataTable"]').should('contain', '2022')
cy.get('[data-cy="GraduatedOfTheFacultyInteractiveDataTable"]').should('contain', '2022')
cy.get('[data-cy="YearToggle"]').click()
cy.get('[data-cy="CreditsProducedByTheFacultyInteractiveDataTable"]').should('contain', '2022 - 2023')
cy.get('[data-cy="ThesisWritersOfTheFacultyInteractiveDataTable"]').should('contain', '2022 - 2023')
cy.get('[data-cy="StudentsOfTheFacultyInteractiveDataTable"]').should('contain', '2022 - 2023')
cy.get('[data-cy="GraduatedOfTheFacultyInteractiveDataTable"]').should('contain', '2022 - 2023')
cy.cs('credits-produced-by-the-faculty-interactive-data-table').should('contain', '2022')
cy.cs('thesis-writers-of-the-faculty-interactive-data-table').should('contain', '2022')
cy.cs('students-of-the-faculty-interactive-data-table').should('contain', '2022')
cy.cs('graduated-of-the-faculty-interactive-data-table').should('contain', '2022')
cy.cs('year-toggle').click()
cy.cs('credits-produced-by-the-faculty-interactive-data-table').should('contain', '2022 - 2023')
cy.cs('thesis-writers-of-the-faculty-interactive-data-table').should('contain', '2022 - 2023')
cy.cs('students-of-the-faculty-interactive-data-table').should('contain', '2022 - 2023')
cy.cs('graduated-of-the-faculty-interactive-data-table').should('contain', '2022 - 2023')
})
it('Toggle programmes works', () => {
cy.get('[data-cy="FacultyProgrammesShownInfo"]').should('not.exist')
cy.get('[data-cy="ProgrammeToggle"]').click()
cy.get('[data-cy="FacultyProgrammesShownInfo"]').should('be.visible')
cy.cs('faculty-programmes-shown-info').should('not.exist')
cy.cs('programme-toggle').click()
cy.cs('faculty-programmes-shown-info').should('be.visible')
})
it('Toggle study rights works', () => {
cy.get('[data-cy="FacultyExcludeSpecialsInfo"]').should('not.exist')
cy.get('[data-cy="StudentToggle"]').click()
cy.get('[data-cy="FacultyExcludeSpecialsInfo"]').should('be.visible')
cy.cs('faculty-exclude-specials-info').should('not.exist')
cy.cs('study-right-toggle').click()
cy.cs('faculty-exclude-specials-info').should('be.visible')
})
it.skip('Data can be exported to Excel files', { retries: 2 }, () => {
@@ -142,7 +142,7 @@ describe('Faculty statistics', () => {
'CreditsProducedByTheFaculty',
]
sections.forEach(section => {
cy.get(`[data-cy="${section}Graph"]`).within(() => {
cy.cs(`${section}Graph`).within(() => {
cy.get('[aria-label="View chart menu, Chart"]').click({ force: true })
cy.contains('li.highcharts-menu-item', 'Download XLS').click()
const downloadedFile = `oodikone_${section}_H50_${timestamp}.xls`
@@ -161,14 +161,14 @@ describe('Faculty statistics', () => {
})
it('Export button', { retries: 2 }, () => {
cy.get('[data-cy=FacultyStudentTableExportButton]').should('be.visible').and('not.be.disabled').click()
cy.cs('faculty-student-table-export-button').should('be.visible').and('not.be.disabled').click()
const downloadedFile = `oodikone_H50_programme_stats_${timestamp}.xlsx`
cy.readFile(path.join(downloadsFolder, downloadedFile))
})
it('Info box', () => {
cy.get('[data-cy=FacultyStudentTableInfoBoxButton]').click()
cy.get('[data-cy=FacultyStudentTableInfoBoxContent]').contains('Opiskelijat, joiden')
cy.cs('faculty-student-table-info-box-button').click()
cy.cs('faculty-student-table-info-box-content').contains('Opiskelijat, joiden')
})
it.skip('Study right toggle', () => {
@@ -192,10 +192,10 @@ describe('Faculty statistics', () => {
})
it('Percentage toggle works', () => {
cy.get('[data-cy="FacultyStudentStatsTable"]').should('be.visible')
cy.get('[data-cy="FacultyStudentStatsTable"]').should('not.contain', '92.3 %')
cy.get('[data-cy="HidePercentagesToggle"]').click()
cy.get('[data-cy="FacultyStudentStatsTable"]').should('contain', '92.3 %')
cy.cs('faculty-student-stats-table').should('be.visible')
cy.cs('faculty-student-stats-table').should('not.contain', '92.3 %')
cy.cs('percentage-toggle').click()
cy.cs('faculty-student-stats-table').should('contain', '92.3 %')
})
})
@@ -208,33 +208,33 @@ describe('Faculty statistics', () => {
it.skip('Export button', { retries: 2 }, () => {
// TODO: Fix this test
cy.get('[data-cy=FacultyProgressExportButton]').should('be.visible').and('not.be.disabled').click()
cy.cs('FacultyProgress-export-button').should('be.visible').and('not.be.disabled').click()
const downloadedFile = `oodikone_H50_progress_tab_${timestamp}.xlsx`
cy.readFile(path.join(downloadsFolder, downloadedFile))
})
it.skip('Info boxes', () => {
cy.get('[data-cy=FacultyProgressInfoBoxButton]').click()
cy.get('[data-cy=FacultyProgressInfoBoxContent]').contains('Kuvaa tiedekuntaan')
cy.cs('FacultyProgress-info-box-button').click()
cy.cs('FacultyProgress-info-box-content').contains('Kuvaa tiedekuntaan')
// TODO: Click open the accordion first
cy.get('[data-cy=BachelorMastersProgressInfoBoxButton]').click()
cy.get('[data-cy=BachelorMastersProgressInfoBoxContent]').contains('The starting year is the')
cy.cs('BachelorMastersProgress-info-box-button').click()
cy.cs('BachelorMastersProgress-info-box-content').contains('The starting year is the')
})
it.skip('Progress bar charts exist', () => {
// TODO: Click open the accordion first
cy.get('[data-cy="FacultyBachelorsProgressBarChart"]').should('be.visible')
cy.get('[data-cy="FacultyBachelorMastersProgressBarChart"]').should('be.visible')
cy.get('[data-cy="FacultyMastersProgressBarChart"]').should('be.visible')
cy.get('[data-cy="FacultyBachelorsProgressBarChart"]').should('be.visible')
cy.cs('FacultyBachelorsProgressBarChart').should('be.visible')
cy.cs('FacultyBachelorMastersProgressBarChart').should('be.visible')
cy.cs('FacultyMastersProgressBarChart').should('be.visible')
cy.cs('FacultyBachelorsProgressBarChart').should('be.visible')
})
it.skip('Progress tables exist', () => {
// TODO: Click open the accordion first
cy.get('[data-cy="FacultyBachelorsProgressTable"]').should('be.visible')
cy.get('[data-cy="FacultyBachelorMasterProgressTable"]').should('be.visible')
cy.get('[data-cy="FacultyMastersProgressTable"]').should('be.visible')
cy.get('[data-cy="FacultyBachelorsProgressTable"]').should('be.visible')
cy.cs('FacultyBachelorsProgressTable').should('be.visible')
cy.cs('FacultyBachelorMasterProgressTable').should('be.visible')
cy.cs('FacultyMastersProgressTable').should('be.visible')
cy.cs('FacultyBachelorsProgressTable').should('be.visible')
})
it.skip('Graduated toggle', () => {
@@ -255,14 +255,14 @@ describe('Faculty statistics', () => {
it.skip('Export button', { retries: 2 }, () => {
// TODO: Fix this test
cy.get('[data-cy=AverageGraduationTimesExportButton]').should('be.visible').and('not.be.disabled').click()
cy.cs('average-graduation-times-export-button').should('be.visible').and('not.be.disabled').click()
const downloadedFile = `oodikone_H50_graduation_times_${timestamp}.xlsx`
cy.readFile(path.join(downloadsFolder, downloadedFile))
})
it('Info boxes', () => {
cy.get('[data-cy=AverageGraduationTimesInfoBoxButton]').click()
cy.get('[data-cy=AverageGraduationTimesInfoBoxContent]').contains('Opiskelijoiden keskimääräiset')
cy.cs('average-graduation-times-info-box-button').click()
cy.cs('average-graduation-times-info-box-content').contains('Opiskelijoiden keskimääräiset')
})
it.skip('Study times toggle', () => {
@@ -278,10 +278,10 @@ describe('Faculty statistics', () => {
})
it('Graphs are visible', () => {
cy.get('[data-cy="bachelorGraduationTimes"]').should('be.visible')
cy.cs('bachelor-graduation-times-section').should('be.visible')
// ! No test data for bachelor + master
cy.get('[data-cy="masterGraduationTimes"]').should('be.visible')
cy.get('[data-cy="doctorGraduationTimes"]').should('be.visible')
cy.cs('master-graduation-times-section').should('be.visible')
cy.cs('doctor-graduation-times-section').should('be.visible')
})
})
})
+69 -71
View File
@@ -45,11 +45,11 @@ describe('Study programme overview', () => {
// If the backend breaks for one of the sections, the section header is not rendered and this will fail
it('Basic information tab loads', () => {
cy.get('[data-cy=Section-studentsOfTheStudyProgramme]')
cy.get('[data-cy=Section-creditsProducedByTheStudyProgramme]')
cy.get('[data-cy=Section-graduatedAndThesisWritersOfTheProgramme]')
cy.get('[data-cy=Section-programmesBeforeOrAfter]')
cy.get('[data-cy=Section-averageGraduationTimes]')
cy.cs('students-of-the-study-programme-section')
cy.cs('credits-produced-by-the-study-programme-section')
cy.cs('graduated-and-thesis-writers-of-the-programme-section')
cy.cs('programmes-before-or-after-section')
cy.cs('average-graduation-times-section')
})
it('Basic information contains correct students', () => {
@@ -66,7 +66,7 @@ describe('Study programme overview', () => {
[2017, 41, 47, 0, 0, 0],
]
cy.checkTableStats(tableContents, 'StudentsOfTheStudyProgramme')
cy.checkTableStats(tableContents, 'students-of-the-study-programme')
})
it('Basic information contains correct credits', () => {
@@ -82,11 +82,11 @@ describe('Study programme overview', () => {
[2017, 1211, 1211, 0, 0, 189],
]
cy.checkTableStats(tableContents, 'CreditsProducedByTheStudyProgramme')
cy.checkTableStats(tableContents, 'credits-produced-by-the-study-programme')
})
it("Toggling 'Show special categories' on displays additional information", () => {
cy.contains('Show special categories').click()
cy.cs('special-categories-toggle').click()
const years = getEmptyYears()
const tableContents = [
...years.map(year => [year, 0, 0, 0, 0, 0, 0, 0]),
@@ -99,7 +99,7 @@ describe('Study programme overview', () => {
[2017, 1211, 1211, 0, 0, 0, 0, 189],
]
cy.checkTableStats(tableContents, 'CreditsProducedByTheStudyProgramme')
cy.checkTableStats(tableContents, 'credits-produced-by-the-study-programme')
})
it('Basic information contains correct thesis writers and graduates', () => {
@@ -116,11 +116,11 @@ describe('Study programme overview', () => {
[2017, 0, 1],
]
cy.checkTableStats(tableContents, 'GraduatedAndThesisWritersOfTheProgramme')
cy.checkTableStats(tableContents, 'graduated-and-graduations-of-the-programme')
})
it('Special study rights can be excluded and basic data changes accordingly', () => {
cy.get('[data-cy=StudentToggle]').click()
cy.cs('study-right-toggle').click()
const years = getEmptyYears()
const studentTableContents = [
// [Year, Started studying, Accepted, Graduated]
@@ -134,7 +134,7 @@ describe('Study programme overview', () => {
[2017, 41, 47, 0],
]
cy.checkTableStats(studentTableContents, 'StudentsOfTheStudyProgramme')
cy.checkTableStats(studentTableContents, 'students-of-the-study-programme')
const graduatedTableContents = [
// [Year, Graduated, Wrote thesis]
@@ -148,11 +148,11 @@ describe('Study programme overview', () => {
[2017, 0, 1],
]
cy.checkTableStats(graduatedTableContents, 'GraduatedAndThesisWritersOfTheProgramme')
cy.checkTableStats(graduatedTableContents, 'graduated-and-graduations-of-the-programme')
})
it('Year can be changed to academic year, and data changes accordingly', () => {
cy.get('[data-cy=YearToggle]').click({ force: true })
cy.cs('year-toggle').click()
const isAcademicYear = true
const years = getEmptyYears(isAcademicYear)
const studentTableContents = [
@@ -166,7 +166,7 @@ describe('Study programme overview', () => {
['2018 - 2019', 40, 45, 0, 0, 0],
['2017 - 2018', 41, 47, 0, 0, 0],
]
cy.checkTableStats(studentTableContents, 'StudentsOfTheStudyProgramme')
cy.checkTableStats(studentTableContents, 'students-of-the-study-programme')
const creditTableContents = [
...years.map(year => [year, 0, 0, 0, 0, 0]),
@@ -179,33 +179,33 @@ describe('Study programme overview', () => {
['2017 - 2018', 2350, 2345, 0, 5, 26],
]
cy.checkTableStats(creditTableContents, 'CreditsProducedByTheStudyProgramme')
cy.get('[data-cy=YearToggle]').click()
cy.checkTableStats(creditTableContents, 'credits-produced-by-the-study-programme')
cy.cs('year-toggle').click()
})
it('Basic information graphs render', () => {
cy.get('[data-cy=Graph-StudentsOfTheStudyProgramme')
cy.cs('students-of-the-study-programme-line-graph-section')
.should('contain', 'Started studying')
.should('contain', 'Accepted')
.should('contain', 'Graduated')
.should('contain', 'Transferred away')
.should('contain', 'Transferred to')
cy.get('[data-cy=Graph-CreditsProducedByTheStudyProgramme')
cy.cs('credits-produced-by-the-study-programme-stacked-bar-chart-section')
.should('contain', 'Degree students')
.should('contain', 'Transferred')
.should('contain', 5796)
.should('contain', 428)
cy.get('[data-cy=Graph-GraduatedAndThesisWritersOfTheProgramme')
cy.cs('graduated-and-thesis-writers-of-the-programme-bar-chart-section')
.should('contain', 'Graduated students')
.should('contain', 'Wrote thesis')
.should('contain', 47)
.should('contain', 76)
cy.get('[data-cy=graduation-times-graph-breakdownBachelor]')
cy.get('[data-cy=GraduationTimeToggle]').click()
cy.get('[data-cy=graduation-times-graphBachelor]').within(() => {
cy.cs('bachelor-breakdown-bar-chart-section')
cy.cs('graduation-time-toggle').click()
cy.cs('bachelor-median-time-bar-chart-section').within(() => {
cy.contains('Graduation year')
cy.contains('2022')
cy.contains('48 graduated').trigger('mouseover')
@@ -216,7 +216,7 @@ describe('Study programme overview', () => {
cy.contains('14 graduated over year late')
})
cy.get('[data-cy=Graph-ProgrammesBeforeOrAfter')
cy.cs('programmes-before-or-after-stacked-bar-chart-section')
.should('contain', 'Tietojenkäsittelytieteen maisteriohjelma')
.should('contain', 'Datatieteen maisteriohjelma')
.should('contain', 'Matematiikan ja tilastotieteen maisteriohjelma')
@@ -231,11 +231,11 @@ describe('Study programme overview', () => {
cy.init('/study-programme')
cy.contains('a', 'Matematiikan ja tilastotieteen maisteriohjelma').click({ force: true })
cy.get('[data-cy=graduation-times-graph-breakdownMaster]')
cy.get('[data-cy=graduation-times-graph-breakdownBachelor]')
cy.cs('bachelor-breakdown-bar-chart-section')
cy.cs('master-breakdown-bar-chart-section')
cy.get('[data-cy=GraduationTimeToggle]').click()
cy.get('[data-cy=graduation-times-graphMaster]').within(() => {
cy.cs('graduation-time-toggle').click()
cy.cs('master-median-time-bar-chart-section').within(() => {
cy.contains('Master study right')
cy.contains('Graduation year')
cy.contains('2021')
@@ -247,7 +247,7 @@ describe('Study programme overview', () => {
cy.contains('0 graduated over year late')
})
cy.get('[data-cy=graduation-times-graphBachelor]').within(() => {
cy.cs('bachelor-median-time-bar-chart-section').within(() => {
cy.contains('Bachelor + master study right')
cy.contains('Graduation year')
cy.contains('2023')
@@ -270,9 +270,9 @@ describe('Study programme overview', () => {
// If the backend breaks for one of the sections, the section header is not rendered and this will fail
it('Study tracks and class statistics', () => {
cy.get('[data-cy=Section-studyTrackOverview]')
cy.get('[data-cy=Section-studyTrackProgress]')
cy.get('[data-cy=Section-averageGraduationTimesStudyTracks]')
cy.cs('Section-studyTrackOverview')
cy.cs('Section-studyTrackProgress')
cy.cs('Section-averageGraduationTimesStudyTracks')
})
it('Students of the study programme are shown correctly', () => {
@@ -288,11 +288,11 @@ describe('Study programme overview', () => {
['Total', 229, 197, 0, 0, 95, 134, 147, 82, 0, 224, 12],
]
cy.checkTableStats(tableContents, 'StudyTrackOverview')
cy.checkTableStats(tableContents, 'study-tracks-and-class-statistics')
})
it('Years in the students table can be expanded and study track data will be shown', () => {
cy.get('[data-cy=Table-StudyTrackOverview]').within(() => {
cy.cs('study-tracks-and-class-statistics-data-table').within(() => {
cy.get('tbody tr.header-row')
.eq(3)
.within(() => {
@@ -327,7 +327,7 @@ describe('Study programme overview', () => {
})
it('Links to class statistics page work', () => {
cy.get('[data-cy=Table-StudyTrackOverview]').within(() => {
cy.cs('study-tracks-and-class-statistics-data-table').within(() => {
cy.get('tbody tr.header-row')
.eq(1)
.within(() => {
@@ -340,7 +340,7 @@ describe('Study programme overview', () => {
})
it('Links to class statistics page with all years combined work', { retries: 2 }, () => {
cy.get('[data-cy=Table-StudyTrackOverview]').within(() => {
cy.cs('study-tracks-and-class-statistics-data-table').within(() => {
cy.get('td.total-row-cell a').click()
})
@@ -349,7 +349,7 @@ describe('Study programme overview', () => {
})
it('Links to class statistics page with study track info included work', () => {
cy.get('[data-cy=Table-StudyTrackOverview]').within(() => {
cy.cs('study-tracks-and-class-statistics-data-table').within(() => {
cy.get('tbody tr.header-row')
.eq(3)
.within(() => {
@@ -382,20 +382,20 @@ describe('Study programme overview', () => {
['Total', 229, 28, 18, 24, 21, 10, 14, 114],
]
cy.checkTableStats(tableContents, 'StudyTrackProgress')
cy.checkTableStats(tableContents, 'study-track-progress-basic')
})
it('Study track overview graphs render', () => {
cy.get('[data-cy=Graph-StudyTrackProgress]')
cy.cs('study-track-progress-bar-chart')
.should('contain', 'Less than 30 credits')
.should('contain', '30–60 credits')
.should('contain', 'At least 180 credits')
.should('contain', '49.8%') // The percentage for total, at least 180 credits, to check that the graph renders
cy.get('[data-cy=Graph-StudyTrackProgress]').contains('49.8%').trigger('mouseover', { force: true })
cy.cs('study-track-progress-bar-chart').contains('49.8%').trigger('mouseover', { force: true })
cy.contains('At least 180 credits: 114')
cy.get("[data-cy='Section-KH50_001']").within(() => {
cy.cs('KH50_001-section').within(() => {
cy.contains('Start year')
cy.contains('2020 - 2021')
cy.get('[aria-label="2020 - 2021, 15. On time."]').trigger('mouseover')
@@ -410,9 +410,9 @@ describe('Study programme overview', () => {
cy.contains('On time: 14')
})
cy.get('[data-cy=GraduationTimeToggle]').click()
cy.cs('graduation-time-toggle').click()
cy.get("[data-cy='Section-KH50_001']").within(() => {
cy.cs('KH50_001-section').within(() => {
cy.contains('Start year')
cy.contains('2020 - 2021')
cy.contains('19 graduated').trigger('mouseover')
@@ -431,9 +431,7 @@ describe('Study programme overview', () => {
})
it('Students of the study track are shown correctly', () => {
cy.get("[data-cy='Section-studyTrackOverview']").contains(
'Students of the study track MAT-MAT by starting year'
)
cy.cs('Section-studyTrackOverview').contains('Students of the study track MAT-MAT by starting year')
const tableContents = [
// [Year, All, Started studying, Present, Absent, Inactive, Graduated, Men, Women, Other/Unknown, Finland, Other]
['2022 - 2023', 3, 3, 0, 0, 1, 2, 2, 1, 0, 3, 0],
@@ -444,11 +442,11 @@ describe('Study programme overview', () => {
['2017 - 2018', 28, 24, 0, 0, 1, 27, 15, 13, 0, 28, 0],
['Total', 89, 73, 0, 0, 6, 83, 48, 41, 0, 88, 4],
]
cy.checkTableStats(tableContents, 'StudyTrackOverview')
cy.checkTableStats(tableContents, 'study-tracks-and-class-statistics')
})
it('Links to class statistics page with study track info included work', () => {
cy.get('[data-cy=Table-StudyTrackOverview]').within(() => {
cy.cs('study-tracks-and-class-statistics-data-table').within(() => {
cy.get('tbody tr.regular-row')
.eq(2)
.within(() => {
@@ -470,7 +468,7 @@ describe('Study programme overview', () => {
)
})
it('Average graduation times are displayed correctly', () => {
it.skip('Average graduation times are displayed correctly', () => {
cy.get("[data-cy='Section-averageGraduationTimesStudyTracks']")
cy.get("[data-cy='graduation-times-graph-breakdownBachelor']").within(() => {
cy.contains('Start year')
@@ -479,8 +477,8 @@ describe('Study programme overview', () => {
cy.contains('Graduated On time: 9 students')
})
cy.get('[data-cy=GraduationTimeToggle]').click()
cy.get("[data-cy='graduation-times-graphBachelor']").within(() => {
cy.cs('graduation-time-toggle').click()
cy.cs('bachelor-median-time-bar-chart').within(() => {
cy.contains('Start year')
cy.contains('2020 - 2021')
cy.contains('12 graduated').trigger('mouseover')
@@ -502,8 +500,8 @@ describe('Study programme overview', () => {
})
it('content loads', () => {
cy.get('[data-cy=CoursesYearFilter]')
cy.get('[data-cy=CourseTabs]')
cy.cs('CoursesYearFilter')
cy.cs('CourseTabs')
})
it('time range selection works', () => {
@@ -516,8 +514,8 @@ describe('Study programme overview', () => {
cy.get('td').eq(2).contains('75')
})
})
cy.get('[data-cy=fromYear]').click().contains('2018').click()
cy.get('[data-cy=toYear').click().contains('2019').click()
cy.cs('fromYear').click().contains('2018').click()
cy.cs('toYear').click().contains('2019').click()
cy.get('[data-cy=CoursesSortableTable] tbody').within(() => {
cy.get('tr')
@@ -531,9 +529,9 @@ describe('Study programme overview', () => {
})
it("'Calendar year/Academic year' toggle works", () => {
cy.get('[data-cy=calendarAcademicYearToggle]').click()
cy.get('[data-cy=fromYear]').contains('2017-2018')
cy.get('[data-cy=toYear').contains('2023-2024')
cy.cs('calendarAcademicYearToggle').click()
cy.cs('fromYear').contains('2017-2018')
cy.cs('toYear').contains('2023-2024')
cy.get('[data-cy=CoursesSortableTable] tbody').within(() => {
cy.get('tr')
.eq(0)
@@ -546,14 +544,14 @@ describe('Study programme overview', () => {
})
it('contains correct courses in alphabetical order', () => {
cy.get('[data-cy=CoursesSortableTable]').within(() => {
cy.cs('CoursesSortableTable').within(() => {
cy.get('tr').eq(1).contains('Advanced calculus')
cy.get('tr').eq(-1).contains('Äidinkielen opinnot')
})
})
it('different sorting options work', () => {
cy.get('[data-cy=CoursesSortableTable]').within(() => {
cy.cs('CoursesSortableTable').within(() => {
// Course code
cy.get('th').eq(0).click()
cy.get('tr')
@@ -632,7 +630,7 @@ describe('Study programme overview', () => {
})
})
cy.get('[data-cy=creditsStudentsToggle]').click()
cy.cs('creditsStudentsToggle').click()
cy.get('[data-cy=CoursesSortableTable] thead tr')
.eq(0)
@@ -690,7 +688,7 @@ describe('Study programme overview', () => {
it('content loads', () => {
cy.contains('h3', 'Select curriculum to edit:')
cy.get('[data-cy=curriculum-picker]').contains('2023–2026')
cy.cs('curriculum-picker').contains('2023–2026')
cy.contains('Change visibility of degree courses and select criteria for academic years')
cy.contains('form', 'First year (12 months) last set: 0')
cy.get('table').within(() => {
@@ -805,21 +803,21 @@ describe('Study programme overview', () => {
})
it('can access basic information', () => {
cy.contains('Basic information').click()
cy.cs('basic-information-tab').click()
cy.get('[data-cy=Section-studentsOfTheStudyProgramme]')
cy.get('[data-cy=Section-creditsProducedByTheStudyProgramme]')
cy.get('[data-cy=Section-graduatedAndThesisWritersOfTheProgramme]')
cy.get('[data-cy=Section-programmesBeforeOrAfter]')
cy.get('[data-cy=Section-averageGraduationTimes]')
cy.cs('students-of-the-study-programme-section')
cy.cs('credits-produced-by-the-study-programme-section')
cy.cs('graduated-and-thesis-writers-of-the-programme-section')
cy.cs('average-graduation-times-section')
cy.cs('programmes-before-or-after-section')
})
it('can access study tracks', () => {
cy.cs('study-tracks-and-class-statistics-tab').click()
cy.get('[data-cy=Section-studyTrackOverview]')
cy.get('[data-cy=Section-studyTrackProgress]')
cy.get('[data-cy=Section-averageGraduationTimesStudyTracks]')
cy.cs('Section-studyTrackOverview')
cy.cs('Section-studyTrackProgress')
cy.cs('Section-averageGraduationTimesStudyTracks')
})
it("doesn't see other tabs", () => {
+8 -6
View File
@@ -66,10 +66,10 @@ describe('University view', () => {
})
it('info boxes contain correct information', () => {
cy.get('[data-cy=FacultyProgressInfoBoxButton]').click()
cy.get('[data-cy=FacultyProgressInfoBoxContent]').contains('Kuvaa tiedekuntaan kuuluvien')
cy.get('[data-cy=FacultyBachelorMastersProgressInfoBoxButton]').click()
cy.get('[data-cy=FacultyBachelorMastersProgressInfoBoxContent]').contains('The starting year is the')
cy.get('[data-cy=FacultyProgress-info-box-button]').click()
cy.get('[data-cy=FacultyProgress-info-box-content]').contains('Kuvaa tiedekuntaan kuuluvien')
cy.get('[data-cy=FacultyBachelorMastersProgress-info-box-button]').click()
cy.get('[data-cy=FacultyBachelorMastersProgress-info-box-content]').contains('The starting year is the')
})
})
@@ -88,8 +88,10 @@ describe('University view', () => {
})
it('info boxes contain correct information', () => {
cy.get('[data-cy=AverageGraduationTimesInfoBoxButton]').click()
cy.get('[data-cy=AverageGraduationTimesInfoBoxContent]').contains('Opiskelijoiden keskimääräiset valmistumisajat')
cy.get('[data-cy=AverageGraduationTimes-info-box-button]').click()
cy.get('[data-cy=AverageGraduationTimes-info-box-content]').contains(
'Opiskelijoiden keskimääräiset valmistumisajat'
)
})
})
})
+1 -1
View File
@@ -128,7 +128,7 @@ Cypress.Commands.add('selectFromDropdown', { prevSubject: true }, (s, index) =>
})
Cypress.Commands.add('checkTableStats', (correctStats, tableName) => {
cy.get(`[data-cy=Table-${tableName}] tbody`).within(() => {
cy.get(`[data-cy=${tableName}-data-table] tbody`).within(() => {
correctStats.forEach((values, trIndex) => {
cy.get('tr')
.filter(':visible')
@@ -88,5 +88,5 @@ facultyToolTips.studentsOfTheFaculty =
.replace('Transferred away', 'Transferred out of programme')
.replace('Transferred to', 'Transferred into programme')
facultyToolTips.graduatedToggle = studyProgrammeToolTips.graduatedToggle
facultyToolTips.studentToggle = studyProgrammeToolTips.studentToggle
facultyToolTips.studyRightToggle = studyProgrammeToolTips.studyRightToggle
facultyToolTips.yearToggle = studyProgrammeToolTips.yearToggle
@@ -3,7 +3,7 @@ export const studyProgrammeToolTips: Record<string, string> = {
**Calendar year**: Näyttää tilastot kalenterivuosille jaoteltuna (esim. 1.1.–31.12.2024)
**Academic year**: Näyttää tilastot lukuvuosille jaoteltuna (esim. 1.8.2023–31.7.2024)
`,
studentToggle: `
studyRightToggle: `
**All study rights**: Valinnassa ovat mukana vaihto-opiskelijat, erillisoikeudella opiskelevat ja ohjelmaan siirtyneet opiskelijat sekä ohjelmasta pois siirtyneet opiskelijat.
**Special study rights excluded**: Valinnasta ja kaikista luvuista on poissuljettu kaikki edellä mainitut erikoisryhmät.
`,
@@ -138,7 +138,7 @@ export const GraduationTimes = ({
}
return (
<div className={`graduation-times-${level}`} data-cy={`Section-${level}`}>
<div className={`graduation-times-${level}`} data-cy={`${level}-section`}>
<Divider horizontal>{title}</Divider>
{!showMedian ? (
<BreakdownDisplay
@@ -4,6 +4,8 @@ import exportData from 'highcharts/modules/export-data'
import exporting from 'highcharts/modules/exporting'
import ReactHighcharts from 'react-highcharts'
import { Section } from '@/components/material/Section'
exporting(ReactHighcharts.Highcharts)
exportData(ReactHighcharts.Highcharts)
accessibility(ReactHighcharts.Highcharts)
@@ -91,8 +93,8 @@ export const BreakdownBarChart = ({ data, title, byStartYear = false }) => {
}
return (
<div data-cy={`graduation-times-graph-breakdown${title.split(' ')[0]}`}>
<Section cypress={`${title.split(' ')[0].toLowerCase()}-breakdown-bar-chart`}>
<ReactHighcharts config={config} />
</div>
</Section>
)
}
@@ -68,7 +68,7 @@ export const FacultyBarChart = ({
}
return (
<Section cypress={`${cypress}BarChart`}>
<Section cypress={`${cypress}-bar-chart`}>
<ReactHighcharts config={config} />
</Section>
)
@@ -67,7 +67,12 @@ export const GraduationTimes = ({
const dataIsLoaded = classSizes && data && names && goal && levelProgrammeData
return (
<Section cypress={`${level}GraduationTimes`} isError={isError} isLoading={isLoading && !dataIsLoaded} title={title}>
<Section
cypress={`${level}-graduation-times`}
isError={isError}
isLoading={isLoading && !dataIsLoaded}
title={title}
>
{showMedian && dataIsLoaded && (
<MedianDisplay
classSizes={classSizes}
@@ -26,17 +26,17 @@ export const InfoBox = ({
<CustomWidthTooltip
arrow
title={
<Typography component="div" data-cy={`${cypress}InfoBoxContent`} sx={{ padding: 1 }} variant="body2">
<Typography component="div" data-cy={`${cypress}-info-box-content`} sx={{ padding: 1 }} variant="body2">
<ReactMarkdown>{formatContent(content)}</ReactMarkdown>
</Typography>
}
>
{mini ? (
<IconButton data-cy={`${cypress}InfoBoxButton`} sx={{ padding: 0 }}>
<IconButton data-cy={`${cypress}-info-box-button`} sx={{ padding: 0 }}>
<HelpOutlineIcon fontSize="small" />
</IconButton>
) : (
<Button color="info" data-cy={`${cypress}InfoBoxButton`} startIcon={<HelpOutlineIcon />} variant="contained">
<Button color="info" data-cy={`${cypress}-info-box-button`} startIcon={<HelpOutlineIcon />} variant="contained">
Info
</Button>
)}
@@ -56,7 +56,7 @@ export const LineGraph = ({
}
return (
<Section cypress={`${cypress}Graph`}>
<Section cypress={`${cypress}-line-graph`}>
<ReactHighcharts config={config} />
</Section>
)
@@ -5,6 +5,8 @@ import exportData from 'highcharts/modules/export-data'
import exporting from 'highcharts/modules/exporting'
import ReactHighcharts from 'react-highcharts'
import { Section } from '@/components/material/Section'
exporting(ReactHighcharts.Highcharts)
exportData(ReactHighcharts.Highcharts)
accessibility(ReactHighcharts.Highcharts)
@@ -164,8 +166,8 @@ export const MedianTimeBarChart = ({
}
return (
<div data-cy={`${title.split(' ')[0]}-median-time-bar-chart`}>
<Section cypress={`${title.split(' ')[0].toLowerCase()}-median-time-bar-chart`}>
<ReactHighcharts config={config} />
</div>
</Section>
)
}
@@ -12,7 +12,7 @@ export const ExportButton = ({
}) => {
return (
<Button
data-cy={`${cypress}ExportButton`}
data-cy={`${cypress}-export-button`}
disabled={disabled}
onClick={onClick}
startIcon={<DownloadIcon />}
@@ -23,7 +23,7 @@ export const Section = ({
title?: string
}) => {
return (
<Paper data-cy={cypress} sx={{ padding: 2 }} variant="outlined">
<Paper data-cy={`${cypress}-section`} sx={{ padding: 2 }} variant="outlined">
<Stack alignItems="center" direction="row" justifyContent="space-between" sx={{ paddingBottom: 1 }}>
<Typography component="h2" variant="h5">
{title}
@@ -112,7 +112,7 @@ export const InteractiveDataTable = ({
return (
<TableContainer>
<StyledTable data-cy={`${cypress}InteractiveDataTable`} showCellBorders size="small">
<StyledTable data-cy={`${cypress}-interactive-data-table`} showCellBorders size="small">
<TableHead>
<TableRow>
{titles.map((title, index) => (
@@ -197,7 +197,7 @@ export const BasicInformationTab = ({
<Section>
<ToggleContainer>
<Toggle
cypress="YearToggle"
cypress="year-toggle"
disabled={isFetchingOrLoading || hasErrors}
firstLabel="Calendar year"
infoBoxContent={facultyToolTips.yearToggle}
@@ -206,7 +206,7 @@ export const BasicInformationTab = ({
value={academicYear}
/>
<Toggle
cypress="ProgrammeToggle"
cypress="programme-toggle"
disabled={isFetchingOrLoading || hasErrors}
firstLabel="New study programmes"
infoBoxContent={facultyToolTips.programmeToggle}
@@ -215,22 +215,22 @@ export const BasicInformationTab = ({
value={studyProgrammes}
/>
<Toggle
cypress="StudentToggle"
cypress="study-right-toggle"
disabled={isFetchingOrLoading || hasErrors}
firstLabel="All study rights"
infoBoxContent={facultyToolTips.studentToggle}
infoBoxContent={facultyToolTips.studyRightToggle}
secondLabel="Special study rights excluded"
setValue={setSpecialGroups}
value={specialGroups}
/>
{studyProgrammeFilter === 'ALL_PROGRAMMES' && (
<Alert data-cy="FacultyProgrammesShownInfo" severity="info" sx={{ width: '100%' }}>
<Alert data-cy="faculty-programmes-shown-info" severity="info" sx={{ width: '100%' }}>
Please note that the data is complete only for current Bachelor's, Master's and Doctoral programmes.
Especially, credits and thesis writers contain only data for current programmes.
</Alert>
)}
{special === 'SPECIAL_EXCLUDED' && (
<Alert data-cy="FacultyExcludeSpecialsInfo" severity="info" sx={{ width: '100%' }}>
<Alert data-cy="faculty-exclude-specials-info" severity="info" sx={{ width: '100%' }}>
Please note that excluding the special study rights does not affect the "Credits produced by the faculty"
view.
</Alert>
@@ -238,7 +238,7 @@ export const BasicInformationTab = ({
</ToggleContainer>
</Section>
<Section
cypress="StudentsOfTheFaculty"
cypress="students-of-the-faculty"
infoBoxContent={facultyToolTips.studentsOfTheFaculty}
isError={basicsIsError}
isLoading={basicsIsLoading}
@@ -247,13 +247,13 @@ export const BasicInformationTab = ({
{basics.isSuccess && basics.data && (
<Stack gap={2}>
<LineGraph
cypress="StudentsOfTheFaculty"
exportFileName={`oodikone_StudentsOfTheFaculty_${faculty?.code}_${getTimestamp()}`}
cypress="students-of-the-faculty"
exportFileName={`oodikone_students-of-the-faculty_${faculty?.code}_${getTimestamp()}`}
graphStats={basics.data.studentInfo.graphStats}
years={basics.data.years}
/>
<InteractiveDataTable
cypress="StudentsOfTheFaculty"
cypress="students-of-the-faculty"
dataProgrammeStats={basics.data.studentInfo.programmeTableStats}
dataStats={basics.data.studentInfo.tableStats}
plotLinePlaces={basicStatsPlotLinePlaces}
@@ -267,7 +267,7 @@ export const BasicInformationTab = ({
)}
</Section>
<Section
cypress="GraduatedOfTheFaculty"
cypress="graduated-of-the-faculty"
infoBoxContent={facultyToolTips.graduatedOfTheFaculty}
isError={basicsIsError}
isLoading={basicsIsLoading}
@@ -276,13 +276,13 @@ export const BasicInformationTab = ({
{basics.isSuccess && basics.data && (
<Stack gap={2}>
<LineGraph
cypress="GraduatedOfTheFaculty"
exportFileName={`oodikone_GraduatedOfTheFaculty_${faculty?.code}_${getTimestamp()}`}
cypress="graduated-of-the-faculty"
exportFileName={`oodikon"graduated-of-the-faculty"_${faculty?.code}_${getTimestamp()}`}
graphStats={basics.data.graduationInfo.graphStats}
years={basics.data.years}
/>
<InteractiveDataTable
cypress="GraduatedOfTheFaculty"
cypress="graduated-of-the-faculty"
dataProgrammeStats={basics.data.graduationInfo.programmeTableStats}
dataStats={basics.data.graduationInfo.tableStats}
plotLinePlaces={basicStatsPlotLinePlaces}
@@ -295,7 +295,7 @@ export const BasicInformationTab = ({
)}
</Section>
<Section
cypress="ThesisWritersOfTheFaculty"
cypress="thesis-writers-of-the-faculty"
infoBoxContent={facultyToolTips.thesisWritersOfTheFaculty}
isError={thesisWritersIsError}
isLoading={thesisWritersIsLoading}
@@ -304,13 +304,13 @@ export const BasicInformationTab = ({
{thesisWriters.isSuccess && thesisWriters.data && (
<Stack gap={2}>
<LineGraph
cypress="ThesisWritersOfTheFaculty"
cypress="thesis-writers-of-the-faculty"
exportFileName={`oodikone_ThesisWritersOfTheFaculty_${faculty?.code}_${getTimestamp()}`}
graphStats={thesisWriters.data.graphStats}
years={thesisWriters.data.years}
/>
<InteractiveDataTable
cypress="ThesisWritersOfTheFaculty"
cypress="thesis-writers-of-the-faculty"
dataProgrammeStats={thesisWriters.data.programmeTableStats}
dataStats={thesisWriters.data.tableStats}
plotLinePlaces={thesisWriterStatsPlotLinePlaces}
@@ -323,7 +323,7 @@ export const BasicInformationTab = ({
)}
</Section>
<Section
cypress="CreditsProducedByTheFaculty"
cypress="credits-produced-by-the-faculty"
infoBoxContent={facultyToolTips.creditsProducedByTheFaculty}
isError={creditsIsError}
isLoading={creditsIsLoading}
@@ -339,13 +339,13 @@ export const BasicInformationTab = ({
{credits.isSuccess && credits.data && (
<Stack gap={2}>
<StackedBarChart
cypress="CreditsProducedByTheFaculty"
cypress="credits-produced-by-the-faculty"
data={graphStats?.data}
exportFileName={`oodikone_CreditsProducedByTheFaculty_${faculty?.code}_${getTimestamp()}`}
exportFileName={`oodikone_credits-produced-by-the-faculty_${faculty?.code}_${getTimestamp()}`}
labels={graphStats?.years}
/>
<InteractiveDataTable
cypress="CreditsProducedByTheFaculty"
cypress="credits-produced-by-the-faculty"
dataProgrammeStats={programmeStats}
dataStats={tableStats?.data}
plotLinePlaces={creditStatsPlotLinePlaces}
@@ -103,14 +103,14 @@ export const GraduationTimesTab = ({
return (
<Stack gap={2}>
<Section
cypress="AverageGraduationTimes"
cypress="average-graduation-times"
exportOnClick={() => exportToExcel(graduationStats.data, programmeNames)}
infoBoxContent={facultyToolTips.averageGraduationTimes}
title="Average graduation times by education level"
>
<ToggleContainer>
<Toggle
cypress="GraduationTimeToggle"
cypress="graduation-time-toggle"
disabled={isError || isLoading}
firstLabel="Breakdown"
secondLabel="Median study times"
@@ -118,7 +118,7 @@ export const GraduationTimesTab = ({
value={showMedian}
/>
<Toggle
cypress="GroupByToggle"
cypress="group-by-toggle"
disabled={isError || isLoading}
firstLabel="Group by: Graduation year"
secondLabel="Starting year"
@@ -126,7 +126,7 @@ export const GraduationTimesTab = ({
value={groupByStartYear}
/>
<Toggle
cypress="ProgrammeToggle"
cypress="programme-toggle"
disabled={isError || isLoading}
firstLabel="New study programmes"
infoBoxContent={facultyToolTips.programmeToggle}
@@ -110,7 +110,6 @@ export const FacultyStudentDataTable = ({
titles: string[]
years: string[]
}) => {
const cypress = 'FacultyStudentStatsTable'
const [yearsVisible, setVisible] = useState(new Array<boolean>(years.length).fill(false))
const { getTextIn } = useLanguage()
const toggleVisibility = (yearIndex: number) => {
@@ -123,7 +122,7 @@ export const FacultyStudentDataTable = ({
return (
<TableContainer>
<StyledTable data-cy={cypress} showCellBorders sx={{ '& td': { whiteSpace: 'nowrap' } }}>
<StyledTable data-cy="faculty-student-stats-table" showCellBorders sx={{ '& td': { whiteSpace: 'nowrap' } }}>
<TableHead>
<TableRow key="FirstHeader">
<TableCell colSpan={!showPercentages ? 3 : 4} />
@@ -159,16 +158,11 @@ export const FacultyStudentDataTable = ({
<TableCell key={`${year}-faculty-cell}`}>
<Box
alignItems="center"
data-cy={`Button-${cypress}-${yearIndex}`}
display="flex"
justifyContent="center"
key={`${year}-studentsTableButton}`}
>
<IconButton
data-cy={`${cypress}${yearIndex}`}
onClick={() => toggleVisibility(yearIndex)}
size="small"
>
<IconButton onClick={() => toggleVisibility(yearIndex)} size="small">
{yearsVisible[yearIndex] ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />}
</IconButton>
<Typography variant="body2">{value}</Typography>
@@ -92,16 +92,16 @@ export const StudentsByStartingYearTab = ({
<Section>
<ToggleContainer>
<Toggle
cypress="StudentToggle"
cypress="study-right-toggle"
disabled={isError || isLoading}
firstLabel="All study rights"
infoBoxContent={facultyToolTips.studentToggle}
infoBoxContent={facultyToolTips.studyRightToggle}
secondLabel="Special study rights excluded"
setValue={setSpecialGroups}
value={specialGroups}
/>
<Toggle
cypress="GraduatedToggle"
cypress="graduated-toggle"
disabled={isError || isLoading}
firstLabel="Graduated included"
infoBoxContent={facultyToolTips.graduatedToggle}
@@ -112,7 +112,7 @@ export const StudentsByStartingYearTab = ({
</ToggleContainer>
</Section>
<Section
cypress="FacultyStudentTable"
cypress="faculty-student-table"
exportOnClick={() =>
exportStudentTable(
studentStats?.data,
@@ -130,7 +130,7 @@ export const StudentsByStartingYearTab = ({
<Stack gap={2}>
<ToggleContainer>
<Toggle
cypress="HidePercentagesToggle"
cypress="percentage-toggle"
disabled={isError || isLoading}
firstLabel="Hide percentages"
secondLabel="Show percentages"
@@ -41,11 +41,11 @@ export const Faculties = () => {
<Container data-cy="FacultySegmentContainer" maxWidth="lg">
<PageTitle subtitle={facultyCode} title={facultyName} />
<Stack gap={2}>
<Tabs data-cy="FacultyTabs" onChange={(_event, newTab) => setTab(newTab)} value={tab}>
<Tab data-cy="BasicInformationTab" label="Basic information" />
<Tab data-cy="StudentsByStartingYearTab" label="Students by starting year" />
<Tab data-cy="GraduationTimesTab" label="Graduation times" />
{isAdmin && <Tab data-cy="UpdateStatisticsTab" label="Update statistics" />}
<Tabs data-cy="faculty-tabs" onChange={(_event, newTab) => setTab(newTab)} value={tab}>
<Tab label="Basic information" />
<Tab label="Students by starting year" />
<Tab label="Graduation times" />
{isAdmin && <Tab label="Update statistics" />}
</Tabs>
{tab === 0 && (
<BasicInformationTab
@@ -1,48 +0,0 @@
import accessibility from 'highcharts/modules/accessibility'
import exportData from 'highcharts/modules/export-data'
import exporting from 'highcharts/modules/exporting'
import ReactHighcharts from 'react-highcharts'
exporting(ReactHighcharts.Highcharts)
exportData(ReactHighcharts.Highcharts)
accessibility(ReactHighcharts.Highcharts)
const colors = ['#003E65', '#1392c2', '#036415']
export const BarChart = ({ cypress, data }) => {
const dataWithColors = data?.graphStats?.map((series, index) => ({ ...series, color: colors[index] }))
const config = {
series: dataWithColors,
xAxis: {
categories: data?.years,
},
chart: {
type: 'column',
height: '450px',
},
exporting: {
filename: `oodikone_graduations_and_thesis_of_studyprogramme_${data?.id}`,
},
plotOptions: {
column: {
dataLabels: {
enabled: true,
},
},
},
yAxis: {
allowDecimals: false,
min: 0,
reversed: false,
title: '',
},
}
if (!data) return null
return (
<div className="graph-container" data-cy={`Graph-${cypress}`}>
<ReactHighcharts config={config} />
</div>
)
}
@@ -0,0 +1,61 @@
import accessibility from 'highcharts/modules/accessibility'
import exportData from 'highcharts/modules/export-data'
import exporting from 'highcharts/modules/exporting'
import ReactHighcharts from 'react-highcharts'
import { Section } from '@/components/material/Section'
import { GraphStat } from '@/types/graphStat'
exporting(ReactHighcharts.Highcharts)
exportData(ReactHighcharts.Highcharts)
accessibility(ReactHighcharts.Highcharts)
// TODO: Move to theme
const colors = ['#003E65', '#1392c2', '#036415']
export const BarChart = ({ id, graphStats, years }: { id: string; graphStats: GraphStat[]; years: number[] }) => {
if (!graphStats || !id || !years) {
return null
}
const dataWithColors = graphStats.map((series, index) => ({
...series,
color: colors[index],
type: 'column' as const,
}))
const config: Highcharts.Options = {
series: dataWithColors,
xAxis: {
categories: years.map(year => year.toString()),
},
chart: {
type: 'column' as const,
height: '450px',
},
exporting: {
filename: `oodikone_graduations_and_thesis_of_study_programme_${id}`,
},
plotOptions: {
column: {
dataLabels: {
enabled: true,
},
},
},
yAxis: {
allowDecimals: false,
min: 0,
reversed: false,
title: {
text: '',
},
},
}
return (
<Section cypress="graduated-and-thesis-writers-of-the-programme-bar-chart">
<ReactHighcharts config={config} />
</Section>
)
}
@@ -1,58 +0,0 @@
/* eslint-disable react/no-this-in-sfc */
import accessibility from 'highcharts/modules/accessibility'
import exportData from 'highcharts/modules/export-data'
import exporting from 'highcharts/modules/exporting'
import ReactHighcharts from 'react-highcharts'
exporting(ReactHighcharts.Highcharts)
exportData(ReactHighcharts.Highcharts)
accessibility(ReactHighcharts.Highcharts)
const colors = ['#7cb5ec', '#90ed7d', '#434348', '#f7a35c', '#FFF000', '#2b908f', '#f45b5b', '#91e8e1']
export const StackedBarChart = ({ cypress, data, labels, wideTable, exportFileName = 'chart' }) => {
const dataWithColors = data?.map((series, index) => ({ ...series, color: colors[index] }))
const config = {
series: dataWithColors,
xAxis: {
categories: labels,
allowDecimals: false,
},
chart: {
type: 'column',
height: '450px',
},
exporting: {
filename: exportFileName,
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
formatter() {
if (Number.isInteger(this.y)) return `${this.y}`
return `${this.y.toFixed(1)}`
},
},
},
},
tooltip: {
pointFormat: '<b>{series.name}: {point.percentage:.1f} %</b>',
},
yAxis: {
allowDecimals: false,
min: 0,
reversed: false,
title: '',
},
}
if (!data) return null
return (
<div className={`graph-container${wideTable ? '-narrow' : ''}`} data-cy={`Graph-${cypress}`}>
<ReactHighcharts config={config} />
</div>
)
}
@@ -4,14 +4,14 @@ import { useState } from 'react'
import { isDefaultServiceProvider } from '@/common'
import { studyProgrammeToolTips } from '@/common/InfoToolTips'
import { useLanguage } from '@/components/LanguagePicker/useLanguage'
import { BreakdownBarChart } from '@/components/material/BreakdownBarChart'
import { DataTable } from '@/components/material/DataTable'
import { LineGraph } from '@/components/material/LineGraph'
import { MedianTimeBarChart } from '@/components/material/MedianTimeBarChart'
import { Section } from '@/components/material/Section'
import { StackedBarChart } from '@/components/material/StackedBarChart'
import { Toggle } from '@/components/material/Toggle'
import { ToggleContainer } from '@/components/material/ToggleContainer'
import { BreakdownBarChart } from '@/pages/StudyProgramme/BreakdownBarChart'
import { MedianTimeBarChart } from '@/pages/StudyProgramme/MedianTimeBarChart'
import { useGetBasicStatsQuery, useGetCreditStatsQuery, useGetGraduationStatsQuery } from '@/redux/studyProgramme'
import { makeGraphData, makeTableStats } from '@/util/creditsProduced'
import { getGraduationGraphTitle, isNewProgramme } from '@/util/studyProgramme'
@@ -99,10 +99,10 @@ export const BasicInformationTab = ({
value={academicYear}
/>
<Toggle
cypress="study-rights-toggle"
cypress="study-right-toggle"
disabled={isFetchingOrLoading || hasErrors}
firstLabel="All study rights"
infoBoxContent={studyProgrammeToolTips.studentToggle}
infoBoxContent={studyProgrammeToolTips.studyRightToggle}
secondLabel="Special study rights excluded"
setValue={setSpecialGroupsExcluded}
value={specialGroupsExcluded}
@@ -111,7 +111,7 @@ export const BasicInformationTab = ({
</Section>
<Section
cypress="students-of-the-study-programme-section"
cypress="students-of-the-study-programme"
infoBoxContent={studyProgrammeToolTips.studentsOfTheStudyProgramme}
isError={basicsIsError}
isLoading={basicsIsLoading}
@@ -140,7 +140,7 @@ export const BasicInformationTab = ({
</Section>
<Section
cypress="credits-produced-by-the-study-programme-section"
cypress="credits-produced-by-the-study-programme"
infoBoxContent={studyProgrammeToolTips.creditsProducedByTheStudyProgramme}
isError={creditsIsError}
isLoading={creditsIsLoading}
@@ -150,7 +150,7 @@ export const BasicInformationTab = ({
<Stack gap={2}>
<Stack alignItems="center">
<Stack alignItems="center" direction="row">
<Switch checked={showAll} onChange={() => setShowAll(!showAll)} />
<Switch checked={showAll} data-cy="special-categories-toggle" onChange={() => setShowAll(!showAll)} />
<Typography>Show special categories</Typography>
</Stack>
</Stack>
@@ -186,7 +186,7 @@ export const BasicInformationTab = ({
</Section>
<Section
cypress="graduated-of-the-programme-section"
cypress="graduated-and-thesis-writers-of-the-programme"
infoBoxContent={studyProgrammeToolTips.graduatedAndThesisWritersOfTheProgramme}
isError={graduationsIsError}
isLoading={graduationsIsLoading}
@@ -194,9 +194,13 @@ export const BasicInformationTab = ({
>
{graduations.isSuccess && graduations.data && (
<Stack gap={2}>
<BarChart cypress="GraduatedAndgraduationsOfTheProgramme" data={graduations?.data} />
<BarChart
graphStats={graduations.data.graphStats}
id={graduations.data.id}
years={graduations.data.years}
/>
<DataTable
cypress="GraduatedAndgraduationsOfTheProgramme"
cypress="graduated-and-graduations-of-the-programme"
data={graduations?.data?.tableStats}
titles={graduations?.data?.titles}
/>
@@ -205,7 +209,7 @@ export const BasicInformationTab = ({
</Section>
<Section
cypress="average-graduation-times-section"
cypress="average-graduation-times"
infoBoxContent={studyProgrammeToolTips.averageGraduationTimes}
isError={graduationsIsError}
isLoading={graduationsIsLoading}
@@ -215,7 +219,7 @@ export const BasicInformationTab = ({
<Stack gap={2}>
<ToggleContainer>
<Toggle
cypress="GraduationTimeToggle"
cypress="graduation-time-toggle"
firstLabel="Breakdown"
secondLabel="Median time"
setValue={setShowMedian}
@@ -273,7 +277,7 @@ export const BasicInformationTab = ({
</Section>
<Section
cypress="programmes-before-or-after-section"
cypress="programmes-before-or-after"
infoBoxContent={studyProgrammeToolTips.programmesBeforeOrAfter}
isError={graduationsIsError}
isLoading={graduationsIsLoading}
@@ -18,7 +18,7 @@ export const BasicDataTable = ({ data, titles, track }: BasicDataTableProps) =>
})
return (
<Table celled compact data-cy="Table-StudyTrackProgress">
<Table celled compact data-cy="study-track-progress-basic-data-table">
<Table.Header>
<Table.Row>
{titles?.map(title => (
@@ -21,7 +21,7 @@ export const ProgressOfStudents = ({ progressStats, progressComboStats, track, y
<>
<h2 style={{ margin: '0 0 1rem 0' }}>Bachelor + master study right</h2>
<div style={{ display: 'flex', alignItems: 'center', gap: '2rem', flexWrap: 'wrap' }}>
<div data-cy="Graph-StudyTrackProgressCombo" style={{ flex: '2 1 600px', minWidth: '600px' }}>
<div data-cy="study-track-progress-combo-bar-chart" style={{ flex: '2 1 600px', minWidth: '600px' }}>
<BarChart
data={{
creditGraphStats: { [track]: progressComboStats.chartStats },
@@ -42,7 +42,7 @@ export const ProgressOfStudents = ({ progressStats, progressComboStats, track, y
)}
{progressComboStats != null && <h2 style={{ margin: '2rem 0 1rem 0' }}>Master study right</h2>}
<div style={{ display: 'flex', alignItems: 'center', gap: '2rem', flexWrap: 'wrap' }}>
<div data-cy="Graph-StudyTrackProgress" style={{ flex: '2 1 600px', minWidth: '600px' }}>
<div data-cy="study-track-progress-bar-chart" style={{ flex: '2 1 600px', minWidth: '600px' }}>
<BarChart
data={{
creditGraphStats: { [track]: progressStats.chartStats },
@@ -317,7 +317,7 @@ export const StudyTrackDataTable = ({
setValue={setShowPercentages}
value={showPercentages}
/>
<Table celled data-cy="Table-StudyTrackOverview">
<Table celled data-cy="study-tracks-and-class-statistics-data-table">
<Table.Header>
<Table.Row key="FirstHeader">
<Table.HeaderCell colSpan={!showPercentages ? 3 : 4} />
@@ -5,8 +5,8 @@ import { getTargetCreditsForProgramme } from '@/common'
import { studyProgrammeToolTips } from '@/common/InfoToolTips'
import { GraduationTimes } from '@/components/GraduationTimes'
import { InfoBox } from '@/components/InfoBox'
import { BreakdownBarChart } from '@/pages/StudyProgramme/BreakdownBarChart'
import { MedianTimeBarChart } from '@/pages/StudyProgramme/MedianTimeBarChart'
import { BreakdownBarChart } from '@/components/material/BreakdownBarChart'
import { MedianTimeBarChart } from '@/components/material/MedianTimeBarChart'
import { Toggle } from '@/pages/StudyProgramme/Toggle'
import '@/pages/StudyProgramme/studyprogramme.css'
import { useGetStudyTrackStatsQuery } from '@/redux/studyProgramme'
@@ -147,15 +147,15 @@ export const StudyTracksAndClassStatisticsTab = ({
<StudyTrackSelector setTrack={setTrack} studyTracks={stats?.data?.studyTracks} track={track} />
<div className="toggle-container">
<Toggle
cypress="StudentToggle"
cypress="study-right-toggle"
firstLabel="All study rights"
secondLabel="Special study rights excluded"
setValue={setSpecialGroupsExcluded}
toolTips={studyProgrammeToolTips.studentToggle}
toolTips={studyProgrammeToolTips.studyRightToggle}
value={specialGroupsExcluded}
/>
<Toggle
cypress="GraduatedToggle"
cypress="graduated-toggle"
firstLabel="Graduated included"
secondLabel="Graduated excluded"
setValue={setGraduated}
@@ -209,7 +209,7 @@ export const StudyTracksAndClassStatisticsTab = ({
<>
{getDivider('Average graduation times by starting year', infoTextGraduationTimes)}
<Toggle
cypress="GraduationTimeToggle"
cypress="graduation-time-toggle"
firstLabel="Breakdown"
secondLabel="Median times"
setValue={setShowMedian}
@@ -16,13 +16,13 @@ export const FacultyGraduationsTab = () => {
return (
<Stack gap={2}>
<Section
cypress="AverageGraduationTimes"
cypress="average-graduation-times"
infoBoxContent={facultyToolTips.averageGraduationTimes}
title="Average graduation times"
>
<ToggleContainer>
<Toggle
cypress="GraduationTimeToggle"
cypress="graduation-time-toggle"
disabled={isFetching || isLoading || isError}
firstLabel="Breakdown"
secondLabel="Median times"
@@ -26,7 +26,7 @@ export const FacultyProgressTab = () => {
>
<ToggleContainer>
<Toggle
cypress="GraduatedToggle"
cypress="graduated-toggle"
disabled={progressStats.isLoading || progressStats.isError}
firstLabel="Graduated included"
infoBoxContent={facultyToolTips.graduatedToggle}
@@ -35,10 +35,10 @@ export const FacultyProgressTab = () => {
value={excludeGraduated}
/>
<Toggle
cypress="StudyRightToggle"
cypress="study-right-toggle"
disabled={progressStats.isLoading || progressStats.isError}
firstLabel="All study rights"
infoBoxContent={facultyToolTips.studentToggle}
infoBoxContent={facultyToolTips.studyRightToggle}
secondLabel="Special study rights excluded"
setValue={() => setIncludeSpecials(!excludeSpecials)}
value={excludeSpecials}