Skip to content

Commit

Permalink
fix report page tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tfhuhtal committed Oct 23, 2024
1 parent d7d05cd commit a4e37df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 4 additions & 2 deletions client/components/Generic/ProgrammeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const ProgrammeList = ({ programmes, setPicked, picked }) => {

return (
<Accordion styled active fluid data-cy="report-programmes-list" style={{ maxHeight: '400px', overflowY: 'auto' }}>
<Accordion.Title onClick={() => setIsOpen(!isOpen)}>
<Accordion.Title data-cy="report-select-all-accordion" onClick={() => setIsOpen(!isOpen)}>
{t(labels.nowShowing)}
<span>
<Icon name={`caret ${isOpen ? 'down' : 'right'}`} />
Expand Down Expand Up @@ -83,7 +83,9 @@ const ProgrammeList = ({ programmes, setPicked, picked }) => {
)
})}
<div className="ui divider" />
<p className={`list-header${programmes.chosen.length === 0 ? '-alert' : ''}`}>{t(`${labels.chooseMore}`)}</p>
<p className={`list-header${programmes.chosen.length === 0 ? '-alert' : ''}`}>
{t(`${labels.chooseMore}`)}
</p>
{sortedItems(programmes.all, 'name', lang).map(p => {
let pKey = p.key
if (form === formKeys.EVALUATION_FACULTIES || form === formKeys.FACULTY_MONITORING) {
Expand Down
12 changes: 11 additions & 1 deletion cypress/integration/report.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('ReportPage tests', () => {
cy.reload()
cy.wait(1000)
cy.get('[data-cy=nav-report]').click()
cy.get('[data-cy=report-select-all-accordion]').click()
cy.get('[data-cy=report-select-all]').click()
cy.get('[data-cy=report-question-learning_outcomes_text]').should('be.visible').click()
cy.get('[data-cy=report-question-content-learning_outcomes_text]').should('contain.text', 'test words')
Expand All @@ -62,6 +63,7 @@ describe('ReportPage tests', () => {

cy.visit('/yearly')
cy.get('[data-cy=nav-report]').click()
cy.get('[data-cy=report-select-all-accordion]').click()
cy.get('[data-cy=report-select-all]').click()
cy.get('[data-cy=report-question-disabled-language_environment_text]').contains('0')
})
Expand All @@ -73,6 +75,7 @@ describe('ReportPage tests', () => {
cy.visit('/yearly')
cy.get('[data-cy=nav-report]').click()
cy.selectYear(defaultYears[1])
cy.get('[data-cy=report-select-all-accordion]').click()
cy.get('[data-cy=report-select-all]').click()
cy.get('[data-cy=report-question-content-teacher_skills_text]').contains(`Hello from ${defaultYears[1]}`)
})
Expand All @@ -85,6 +88,7 @@ describe('ReportPage tests', () => {

cy.selectYear(defaultYears[1])
cy.get('[data-cy=master-filter]').should('be.visible').click()
cy.get('[data-cy=report-select-all-accordion]').click()
cy.get('[data-cy=report-select-all]').should('contain', 'all')
cy.get('[data-cy=report-select-all]').click()
cy.get('[data-cy=answered-label-language_environment_text]').contains('/ 64')
Expand All @@ -99,6 +103,8 @@ describe('ReportPage tests', () => {
cy.get('[data-cy=faculty-filter]').click()
cy.wait(1000)
cy.get('[data-cy=faculty-filter]').contains('Faculty of Law').should('be.visible').click()
cy.get('[data-cy=faculty-filter]').click()
cy.get('[data-cy=report-select-all-accordion]').click()
cy.get('[data-cy=report-list-programme-KH20_001]').should('be.visible')
cy.get('[data-cy=report-list-programme-MH20_003]').should('be.visible')
cy.get('[data-cy=report-list-programme-MH20_001]').should('be.visible')
Expand All @@ -112,11 +118,12 @@ describe('ReportPage tests', () => {
cy.visit('/yearly')
cy.get('[data-cy=nav-report]').click()
cy.get('[data-cy=doctoral-school-filter]').should('not.exist')
cy.get('[data-cy=doctoral-filter]')

cy.get('[data-cy=doctoral-filter]').click()
cy.wait(1000)
cy.get('[data-cy=doctoral-school-filter]').click()
cy.get('span').contains('Doctoral school in natural sciences').should('be.visible').click()
cy.get('[data-cy=report-select-all-accordion]').click()
cy.get('[data-cy=report-list-programme-T923104]').should('be.visible')
cy.get('[data-cy=report-list-programme-T923107]').should('be.visible')
cy.get('[data-cy=report-list-programme-T922104]').should('not.exist')
Expand All @@ -130,9 +137,11 @@ describe('ReportPage tests', () => {
cy.get('[data-cy=companion-filter]').should('not.exist')
cy.get('[data-cy=faculty-filter]').should('be.visible').click()
cy.get('span').contains('Faculty of Arts').should('be.visible').click()
cy.get('[data-cy=faculty-filter]').click()
cy.get('[data-cy=doctoral-filter]').should('be.visible').click()
cy.get('[data-cy=companion-filter]').should('be.visible')
cy.get('[data-cy=companion-filter]').click()
cy.get('[data-cy=report-select-all-accordion]').click()
// Companion programmes
cy.get('[data-cy=report-list-programme-T921107]').should('be.visible')
cy.get('[data-cy=report-list-programme-T923102]').should('be.visible')
Expand All @@ -155,6 +164,7 @@ describe('ReportPage tests', () => {
cy.get('[data-cy=color-negative-review_of_last_years_situation_report]').click()
cy.visit('/yearly')
cy.get('[data-cy=nav-report]').click()
cy.get('[data-cy=report-select-all-accordion]').click()
cy.get('[data-cy=report-select-all]').click()
cy.get('div').contains('lights').should('be.visible').click()
cy.get('[data-cy=report-chart-review_of_last_years_situation_report_text]')
Expand Down

0 comments on commit a4e37df

Please sign in to comment.