From e9b3a10b097ded906654c43d02f74e60977435a2 Mon Sep 17 00:00:00 2001 From: tfhuhtal Date: Tue, 1 Oct 2024 11:04:52 +0300 Subject: [PATCH] trafficlight tests --- .../Generic/TrackingTrafficLight.js | 2 +- cypress/integration/trackingpage.spec.js | 44 +++++++++++++++---- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/client/components/Generic/TrackingTrafficLight.js b/client/components/Generic/TrackingTrafficLight.js index 8d77f29e..c0fb2669 100644 --- a/client/components/Generic/TrackingTrafficLight.js +++ b/client/components/Generic/TrackingTrafficLight.js @@ -88,7 +88,7 @@ const TrackingTrafficLight = ({ id, form }) => { )} {!showChooser && ( - )} diff --git a/cypress/integration/trackingpage.spec.js b/cypress/integration/trackingpage.spec.js index a9344643..d7b1009a 100644 --- a/cypress/integration/trackingpage.spec.js +++ b/cypress/integration/trackingpage.spec.js @@ -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() @@ -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() + }) }) \ No newline at end of file