Skip to content

Commit

Permalink
trafficlight tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tfhuhtal committed Oct 1, 2024
1 parent d00e235 commit e9b3a10
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/components/Generic/TrackingTrafficLight.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const TrackingTrafficLight = ({ id, form }) => {
)}
<Menu.Item position="right">
{!showChooser && (
<Button onClick={toggleChooser} disabled={reduxViewOnly}>
<Button data-cy="toggle-chooser" onClick={toggleChooser} disabled={reduxViewOnly}>
{t('chooseTrafficLight')}
</Button>
)}
Expand Down
44 changes: 36 additions & 8 deletions cypress/integration/trackingpage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@ describe('Tracking page tests', () => {

beforeEach(() => {
cy.login(cypressSuperAdmin)
cy.visit(`/admin`)
cy.contains('Deadline settings').click()
cy.createDeadline(2024, 'Toimenpiteiden toteutus ja seuranta tiedekunnissa')
cy.get('[data-cy=form-8-deadline]').contains('2024')
cy.visit(`/faculty-monitoring/${testFacultyCode}`)
})

it('should open tracking page', () => {
it('should open tracking page and select question 1', () => {
cy.contains(testFacultyName.toUpperCase())
})
cy.get(`[data-cy=question-picker-${testFacultyCode}]`).click()

it('should pick questions', () => {
cy.visit(`/admin`)
cy.contains('Deadline settings').click()
cy.createDeadline(2024, 'Toimenpiteiden toteutus ja seuranta tiedekunnissa')
cy.get('[data-cy=form-8-deadline]').contains('2024')
cy.get('[data-cy=questions-list-0]').click()

cy.visit(`/faculty-monitoring/${testFacultyCode}`)
cy.contains('1. Degree programmes include model schedules in curricula that support understanding of the education system, study paths, and course offerings').click()
cy.get('[data-cy=send-selection-button]').click()
})

it('should pick questions and write to modal', () => {
cy.get(`[data-cy=question-picker-${testFacultyCode}]`).click()

cy.get('[data-cy=questions-list-0]').click()
Expand All @@ -33,4 +37,28 @@ describe('Tracking page tests', () => {
cy.wait(100)
cy.get('[data-cy=send-form]').click()
})

it('should open tracking page and select question 1 and 2', () => {
cy.get(`[data-cy=question-picker-${testFacultyCode}]`).click()

cy.get('[data-cy=questions-list-0]').click()

cy.contains('1. Degree programmes include model schedules in curricula that support understanding of the education system, study paths, and course offerings').click()
cy.contains('2.').click()
cy.get('[data-cy=send-selection-button]').click()

cy.get('[data-cy=accordion-group-0]').click()
cy.get('[data-cy=modify-plan-1]').click()
cy.get('[data-cy=toggle-chooser]').click()
cy.get('[data-cy=color-positive-1]').click()
cy.get('[id=1_contact_person_text]').type('contact person')
cy.wait(100)
cy.get('[data-cy=send-form]').click()

cy.get('[data-cy=modify-plan-2]').click()
cy.get('[data-cy=toggle-chooser]').click()
cy.get('[data-cy=color-negative-2]').click()

cy.get('[data-cy=send-form]').click()
})
})

0 comments on commit e9b3a10

Please sign in to comment.