-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4688 from UniversityOfHelsinkiCS/material-ui-univ…
…ersity Material UI: University
- Loading branch information
Showing
40 changed files
with
1,735 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,159 +1,96 @@ | ||
/// <reference types="cypress" /> | ||
|
||
const levels = ['Bachelors', 'BachelorMasters', 'Masters', 'Doctoral'] | ||
const progressLevels = ['Bachelors', 'BachelorMasters', 'Masters', 'Doctoral'] | ||
|
||
const checkProgressGraphs = () => { | ||
levels.forEach(level => cy.get(`[data-cy=Graph-Faculty${level}Progress]`)) | ||
const checkProgressBarCharts = () => { | ||
progressLevels.forEach(level => cy.get(`[data-cy=Faculty${level}ProgressBarChart]`)) | ||
} | ||
|
||
const checkProgressTables = () => { | ||
levels.forEach(level => cy.get(`[data-cy=Table-Faculty${level}Progress]`)) | ||
progressLevels.forEach(level => cy.get(`[data-cy=Faculty${level}ProgressTable]`)) | ||
} | ||
|
||
const checkAverageGraduationTimesGraphs = breakdown => { | ||
const levels = ['bachelor', 'bcMsCombo', 'master', 'doctor'] | ||
levels.forEach(level => { | ||
cy.get(`[data-cy=Section-${level}] .graduations-chart-container .faculty-${breakdown ? 'breakdown-' : ''}graph`) | ||
}) | ||
} | ||
const graduationTimesLevels = ['bachelor', 'master', 'doctor'] // ? Bachelor + master seems to be missing in test data | ||
|
||
const checkProgressStatsFacultyLevelBreakdown = () => { | ||
cy.get('[data-cy=Table-FacultyBachelorsProgress]').within(() => { | ||
cy.contains('2021 - 2022').click() | ||
cy.contains('29.5%').trigger('mouseover', { force: true }) | ||
cy.contains('Matemaattis-luonnontieteellinen tiedekunta') | ||
cy.contains('H50 - H50') | ||
cy.contains('0 Credits: 0') | ||
cy.contains('1 ≤ Credits < 45: 13') | ||
cy.contains('45 ≤ Credits < 90: 10') | ||
cy.contains('90 ≤ Credits < 135: 16') | ||
cy.contains('135 ≤ Credits < 180: 3') | ||
cy.contains('180 ≤ Credits: 2') | ||
const checkAverageGraduationTimesBreakdownBarCharts = () => { | ||
graduationTimesLevels.forEach(level => { | ||
cy.get(`[data-cy=${level}BreakdownBarChart]`) | ||
}) | ||
} | ||
|
||
const checkAverageGraduationTimesFacultyLevelBreakdown = breakdown => { | ||
cy.get('[data-cy=Section-bachelor] .graduations-chart-container').within(() => { | ||
cy.contains('.graduations-message', "Click a bar to view that year's faculty level breakdown") | ||
cy.contains(breakdown ? '51' : '141 graduated').click() | ||
cy.contains('.graduations-message', "Click a bar to view that year's faculty level breakdown").should('not.exist') | ||
cy.contains(`.programmes-${breakdown ? 'breakdown-' : ''}graph`, 'Year 2021 by graduation year') | ||
const checkAverageGraduationTimesMedianBarCharts = () => { | ||
graduationTimesLevels.forEach(level => { | ||
cy.get(`[data-cy=${level}MedianBarChart]`) | ||
}) | ||
} | ||
|
||
describe('University view', () => { | ||
beforeEach(() => { | ||
cy.init('/university') | ||
cy.contains('University-level view') | ||
cy.contains('University') | ||
cy.contains('Programme MH90_001 (Veterinary medicine bachelor + licentiate) is currently excluded.') | ||
}) | ||
|
||
describe('Progress stats section', () => { | ||
it('has all the correct progress graphs', () => { | ||
checkProgressGraphs() | ||
describe('Faculty progress tab', () => { | ||
it('contains all the correct progress bar charts', () => { | ||
checkProgressBarCharts() | ||
}) | ||
|
||
it('has all the correct progress tables', () => { | ||
it('contains all the correct progress tables', () => { | ||
checkProgressTables() | ||
}) | ||
|
||
it("'Graduated included/excluded' toggle works", () => { | ||
it("'Graduated included / Graduated excluded' toggle works", () => { | ||
cy.get('[data-cy=GraduatedToggle]').click() | ||
checkProgressGraphs() | ||
checkProgressBarCharts() | ||
checkProgressTables() | ||
}) | ||
|
||
it("'All studyrights/Special studyrights excluded' toggle works", () => { | ||
cy.get('[data-cy=StudentToggle]').click() | ||
checkProgressGraphs() | ||
it("'All study rights / Special study rights excluded' toggle works", () => { | ||
cy.get('[data-cy=StudyRightToggle]').click() | ||
checkProgressBarCharts() | ||
checkProgressTables() | ||
}) | ||
|
||
it('Years in the tables can be clicked to show faculty level breakdown', () => { | ||
// Filtering out special study rights to make the data match with the Evaluation overview page | ||
cy.get('[data-cy=StudentToggle]').click() | ||
checkProgressStatsFacultyLevelBreakdown() | ||
}) | ||
}) | ||
|
||
describe('Average graduation times section', () => { | ||
it('graphs exist', () => { | ||
checkAverageGraduationTimesGraphs(true) | ||
}) | ||
|
||
it('Faculty level breakdown can be seen by clicking a bar in the breakdown graph', () => { | ||
checkAverageGraduationTimesFacultyLevelBreakdown(true) | ||
}) | ||
|
||
it("'Breakdown/Median times' toggle works", () => { | ||
cy.get('[data-cy=GraduationTimeToggle]').click() | ||
checkAverageGraduationTimesGraphs(false) | ||
it('years in the tables can be clicked to show faculty level breakdown', () => { | ||
cy.get('[data-cy=StudyRightToggle]').click() | ||
cy.get('[data-cy=FacultyBachelorsProgressTableShowButton3]').click() | ||
cy.contains('29.5%').trigger('mouseover', { force: true }) | ||
cy.contains('Matemaattis-luonnontieteellinen tiedekunta') | ||
cy.contains('H50') | ||
cy.contains('0 Credits: 0') | ||
cy.contains('1 ≤ Credits < 45: 13') | ||
cy.contains('45 ≤ Credits < 90: 10') | ||
cy.contains('90 ≤ Credits < 135: 16') | ||
cy.contains('135 ≤ Credits < 180: 3') | ||
cy.contains('180 ≤ Credits: 2') | ||
}) | ||
|
||
it('Faculty level breakdown can be seen by clicking a bar in the median times graph', () => { | ||
cy.get('[data-cy=GraduationTimeToggle]').click() | ||
checkAverageGraduationTimesFacultyLevelBreakdown(false) | ||
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') | ||
}) | ||
}) | ||
}) | ||
|
||
// It's better to have these tests defined here than in the 'Evaluation overview' tests as they use the same data as the 'University view' tests | ||
describe("'Evaluation overview' university page", () => { | ||
beforeEach(() => { | ||
cy.init('/evaluationoverview/university') | ||
cy.contains('University-level view') | ||
}) | ||
|
||
it('page opens', () => { | ||
cy.contains("This view is a combined version of Oodikone's Faculty Evaluation Overview") | ||
}) | ||
|
||
it('has links to faculty evaluation overview pages', () => { | ||
cy.get('.facultyLinkBox span').should('have.length', 12) | ||
cy.contains('.facultyLinkBox span a', 'H50 Matemaattis-luonnontieteellinen tiedekunta').click() | ||
cy.url().should('include', '/evaluationoverview/faculty/H50') | ||
}) | ||
|
||
describe('Progress stats section', () => { | ||
it('has all the correct progress graphs', () => { | ||
checkProgressGraphs() | ||
}) | ||
|
||
it('has all the correct progress tables', () => { | ||
checkProgressTables() | ||
}) | ||
|
||
it("'Graduated included/excluded' toggle works", () => { | ||
cy.get('[data-cy=GraduatedToggle]').click() | ||
checkProgressGraphs() | ||
checkProgressTables() | ||
describe('Faculty graduations tab', () => { | ||
beforeEach(() => { | ||
cy.get('[data-cy=FacultyGraduationsTab]').click() | ||
}) | ||
|
||
it("'All studyrights/Special studyrights excluded' toggle doesn't exist", () => { | ||
cy.get('.toggle-container [data-cy=StudentToggle]').should('not.exist') | ||
}) | ||
|
||
it('Years in the tables can be clicked to show faculty level breakdown', () => { | ||
checkProgressStatsFacultyLevelBreakdown() | ||
}) | ||
}) | ||
|
||
describe('Average graduation times section', () => { | ||
it('graphs exist', () => { | ||
checkAverageGraduationTimesGraphs(true) | ||
}) | ||
|
||
it('Faculty level breakdown can be seen by clicking a bar in the breakdown graph', () => { | ||
checkAverageGraduationTimesFacultyLevelBreakdown(true) | ||
it('has all the correct median time bar charts', () => { | ||
checkAverageGraduationTimesBreakdownBarCharts() | ||
}) | ||
|
||
it("'Breakdown/Median times' toggle works", () => { | ||
cy.get('[data-cy=GraduationTimeToggle]').click() | ||
checkAverageGraduationTimesGraphs(false) | ||
checkAverageGraduationTimesMedianBarCharts() | ||
}) | ||
|
||
it('Faculty level breakdown can be seen by clicking a bar in the median times graph', () => { | ||
cy.get('[data-cy=GraduationTimeToggle]').click() | ||
checkAverageGraduationTimesFacultyLevelBreakdown(false) | ||
it('info boxes contain correct information', () => { | ||
cy.get('[data-cy=AverageGraduationTimesInfoBoxButton]').click() | ||
cy.get('[data-cy=AverageGraduationTimesInfoBoxContent]').contains('Opiskelijoiden keskimääräiset valmistumisajat') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.