Skip to content

Commit

Permalink
Add Cypress test completed action is not editable
Browse files Browse the repository at this point in the history
  • Loading branch information
maiaht committed Oct 29, 2021
1 parent 1422bf2 commit f2d5dde
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions frontend/cypress/integration/actions_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,25 @@ describe('Actions management', () => {
}, fusionProject1.id)
})

it(`Complete action by ${roleThatCanComplete} on ${randomProgression}
then verify that completed action is not editable`, () => {
let user = seed.findParticipantByRole(roleThatCanComplete).user
cy.visitProgression(randomProgression, seed.evaluationId, user, fusionProject1.id)
;({ actionNotes, action } = findActionWithNotes(seed))
;({ updatedAction, newNote } = createCompleteAction(user, action))

actionsGrid.actionLink(action.questionOrder, action.title).click()

editActionDialog.assertCompletedInView(action.completed)

editActionDialog.completeActionButton().click()
editActionDialog.assertCompleteConfirmViewVisible(true)
editActionDialog.completedReasonInput().replace(newNote.text)
editActionDialog.completeActionConfirmButton().click()

editActionDialog.assertEditActionDisabled(seed)
})

it(`Cancel complete action by ${roleThatCanComplete} on ${randomProgression}
then verify action was not completed`, () => {
cy.visitProgression(
Expand Down
19 changes: 19 additions & 0 deletions frontend/cypress/page_objects/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Action, Note } from '../support/testsetup/mocks'
import { FUSION_DATE_LOCALE } from '../support/helpers/helpers'
import { Priority } from '../../src/api/models'
import { SavingState } from '../../src/utils/Variables'
import { EvaluationSeed } from '../support/testsetup/evaluation_seed'

/**
* List of actions under every question
Expand Down Expand Up @@ -200,6 +201,24 @@ export class EditActionDialog extends ActionDialog {
this.completeActionConfirmButton().should(completeViewOpen ? 'be.visible' : 'not.exist')
this.completeActionCancelButton().should(completeViewOpen ? 'be.visible' : 'not.exist')
}

/**
* Check that an action is not editable
* @param seed
*/
assertEditActionDisabled = (seed: EvaluationSeed) => {
this.titleInput().should('be.disabled')
this.assignedToInput().click()
const participantList = seed.participants.map(p => { return p.user.name })
participantList.forEach(participantName => {
cy.get('section').contains(participantName).should('be.disabled')
})
this.dueDateInput().should('be.disabled')
this.priorityInput().children().eq(0).children().eq(0).should('have.class', 'fc--Select__disabled--TZzty')
this.descriptionInput().should('be.disabled')
this.notesInput().should('be.disabled')
this.addNoteButton().should('be.disabled')
}
}

/**
Expand Down

0 comments on commit f2d5dde

Please sign in to comment.