Skip to content

Commit

Permalink
test(org-survey): update organisation surveys e2e tests according to …
Browse files Browse the repository at this point in the history
…the updates
  • Loading branch information
HRemonen committed Dec 19, 2023
1 parent 4fc52da commit 5998bc4
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions cypress/integration/organisatioSurvey.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ describe('Feedback Correspondents', () => {
cy.get('[data-cy="organisation-survey-responsible-persons-Test survey-chips-Tommi Testaaja"]').should('not.exist')

// Edit the survey to add students and new responsible teacher
cy.get('[data-cy="organisation-survey-edit-Test survey"]').should('exist').click()
cy.get('[data-cy="organisation-survey-show-feedback-Test survey"').should('exist').click()
cy.get('[data-cy="feedback-target-edit-organisation-survey"]').should('exist').click()

// Add new teacher
cy.get('[data-cy="formik-responsible-teacher-input-field"]').type('Tommi Testaaja')
Expand All @@ -212,20 +213,25 @@ describe('Feedback Correspondents', () => {
cy.get('[data-cy="organisation-survey-editor-save"]').click()

// Assure the changes is visible
cy.visit(`${baseUrl}/organisations/500-K005/organisation-surveys`)

cy.get('[data-cy="organisation-survey-item-title-Test survey"]').should('exist')
cy.get('[data-cy="organisation-survey-feedback-count-percentage-0/2"]').should('exist')
cy.get('[data-cy="organisation-survey-responsible-persons-Test survey"]').should('exist')
cy.get('[data-cy="organisation-survey-responsible-persons-Test survey-chips-Correspondent Tester"]').should('exist')
cy.get('[data-cy="organisation-survey-responsible-persons-Test survey-chips-Tommi Testaaja"]').should('exist')

// Edit the survey name
cy.get('[data-cy="organisation-survey-edit-Test survey"]').should('exist').click()
cy.get('[data-cy="organisation-survey-show-feedback-Test survey"').should('exist').click()
cy.get('[data-cy="feedback-target-edit-organisation-survey"]').should('exist').click()

cy.get('[data-cy="formik-locales-field-en-name"]').clear().type('Greatest survey of them all!')

cy.get('[data-cy="organisation-survey-editor-save"]').click()

// Assure that only the name changed
cy.visit(`${baseUrl}/organisations/500-K005/organisation-surveys`)

cy.get('[data-cy="organisation-survey-item-title-Test survey"]').should('not.exist')
cy.get('[data-cy="organisation-survey-item-title-Greatest survey of them all!"]').should('exist')
cy.get('[data-cy="organisation-survey-feedback-count-percentage-0/2"]').should('exist')
Expand All @@ -238,6 +244,8 @@ describe('Feedback Correspondents', () => {
).should('exist')
})

it.skip('can edit organisation surveys after feedback period has started', () => {})

it('can not delete organisation surveys after feedback has been given', () => {
const today = new Date()
const organisationCode = '500-K005'
Expand All @@ -261,11 +269,11 @@ describe('Feedback Correspondents', () => {

// Check that the view and edit buttons are there but delete button should not exist
cy.get('[data-cy="organisation-survey-show-feedback-New survey"]').should('exist')
cy.get('[data-cy="organisation-survey-edit-New survey"]').should('exist')
cy.get('[data-cy="organisation-survey-show-results-New survey"]').should('exist')
cy.get('[data-cy="organisation-survey-delete-New survey"]').should('not.exist')
})

it('can create questions for organisation survey and open the feedback', () => {
it('can create questions for organisation survey', () => {
cy.visit(`${baseUrl}/organisations/500-K005/organisation-surveys`)

// Create a new survey with just the name given
Expand Down Expand Up @@ -300,11 +308,6 @@ describe('Feedback Correspondents', () => {
cy.get('[data-cy="option-editor-new-option-en-name.2"]').clear().type('Manual testing')

cy.get('[data-cy="question-card-save-edit"]').click()

// Open the feedback
cy.get('[data-cy="feedback-target-edit-period"]').click()
cy.get('[data-cy="feedback-target-open-feedback-immediately"]').click()
cy.get('[data-cy="feedback-target-open-feedback-immediately-confirm"]').click()
})
})

Expand Down Expand Up @@ -372,7 +375,8 @@ describe('Responsible Teachers', () => {
cy.loginAsTeacher()
})

it.skip('can edit organisation surveys')
it.skip('can view own organisation surveys', () => {})
it.skip('can edit organisation surveys', () => {})
})

describe('Admin Users', () => {
Expand Down

0 comments on commit 5998bc4

Please sign in to comment.