Skip to content

Commit

Permalink
Fix waiting for project save
Browse files Browse the repository at this point in the history
  • Loading branch information
janslifka committed May 2, 2024
1 parent 8c8c96f commit a17cdc6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cypress/e2e/projects/detail/questionnaire/basic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,21 @@ describe('Basic Questionnaire Tests', () => {

// Move the first item down and check that now the first one
cy.get(`.item:first-child() ${dataCy('item-move-down')}`).click()
cy.get('.item:first-child() label').contains('Item answer 1.2').closest('.form-group').find('input').should('not.be.checked')
cy.get('.item:first-child() label').contains('Item answer 1.2').closest('label').find('input').should('not.be.checked')
project.awaitSave()

// Reopen project and check it still works
project.open(projectName)
cy.get('.item:first-child() label').contains('Item answer 1.2').closest('.form-group').find('input').should('not.be.checked')
cy.get('.item:first-child() label').contains('Item answer 1.2').closest('label').find('input').should('not.be.checked')

// Move items back and check that the first one is checked
cy.get(`.item:last-child() ${dataCy('item-move-up')}`).click()
cy.get('.item:first-child() label').contains('Item answer 1.2').closest('.form-group').find('input').should('be.checked')
cy.get('.item:first-child() label').contains('Item answer 1.2').closest('label').find('input').should('be.checked')
project.awaitSave()

// Reopen project and check it still works
project.open(projectName)
cy.get('.item:first-child() label').contains('Item answer 1.2').closest('.form-group').find('input').should('be.checked')
cy.get('.item:first-child() label').contains('Item answer 1.2').closest('label').find('input').should('be.checked')
})


Expand Down
1 change: 1 addition & 0 deletions cypress/support/project-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ export function expectSummaryReportMetrics(metrics, chapter) {

export function awaitSave() {
cy.get('.questionnaire-header__saving').contains('Saved')
cy.get('.questionnaire-header__saving').should('not.contain', 'Saved')
}


Expand Down

0 comments on commit a17cdc6

Please sign in to comment.