Skip to content

Commit

Permalink
tracking page tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tfhuhtal committed Oct 1, 2024
1 parent eeaac0f commit d00e235
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ const Answer = ({ question, faculty }) => {
>{`${currentEditors[modalName].firstname} ${currentEditors[modalName].lastname} ${t('generic:isWriting')}`}</i>
)}
<Button
data-cy={`modify-plan-${question.id}`}
disabled={someoneElseHasTheLock}
onClick={() => openFormModal(question)}
content={t('formView:modifyPlan')}
Expand All @@ -207,7 +208,7 @@ const Answer = ({ question, faculty }) => {
title={`${parseInt(formModalData.id, 10)} - ${formModalData.label[lang]}`}
>
<MonitoringQuestionForm question={formModalData} faculty={faculty} />
<Button secondary style={{ marginTop: '1em', float: 'right' }} onClick={closeFormModal}>
<Button data-cy="send-form" secondary style={{ marginTop: '1em', float: 'right' }} onClick={closeFormModal}>
{t('formView:sendForm')}
</Button>
</CustomModal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
import { updateFormField } from 'Utilities/redux/formReducer'
import '../../Generic/Generic.scss'

const QuestionPicker = ({ label, questionsList, form }) => {
const QuestionPicker = ({ index, label, questionsList, form }) => {
const { t } = useTranslation()
const dispatch = useDispatch()
const lang = useSelector(state => state.language)
Expand Down Expand Up @@ -41,7 +41,7 @@ const QuestionPicker = ({ label, questionsList, form }) => {
<label className="questions-list-label">{label}</label>
<Dropdown
className="comparison-questions-list-selector"
data-cy={`questions-list-${label}`}
data-cy={`questions-list-${index}`}
name="questions-list"
fluid
placeholder={t('common:noSelections')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,11 @@ const FacultyTrackingView = ({ faculty }) => {
{questionData.map((group, index) => (
// eslint-disable-next-line react/no-array-index-key
<div className="question-group" key={`group-${index}`}>
<QuestionPicker label={group.title[lang]} questionsList={group.parts} form={form} />
<QuestionPicker index={index} label={group.title[lang]} questionsList={group.parts} form={form} />
</div>
))}
<Button
data-cy="send-selection-button"
onClick={() => setQuestionPickerModalData(null)}
secondary
content={t('formView:sendSelection')}
Expand All @@ -156,6 +157,7 @@ const FacultyTrackingView = ({ faculty }) => {
<div className="accordion-container" key={group.groupId}>
<Accordion>
<Accordion.Title
data-cy={`accordion-${group.groupId}`}
active={activeAccordions[group.groupId]}
index={group.groupId}
onClick={handleAccordionClick}
Expand Down
12 changes: 11 additions & 1 deletion cypress/integration/trackingpage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ describe('Tracking page tests', () => {
cy.visit(`/faculty-monitoring/${testFacultyCode}`)
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.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('[id=1_contact_person_text]').type('contact person')
cy.wait(100)
cy.get('[data-cy=send-form]').click()
})
})
})

0 comments on commit d00e235

Please sign in to comment.