Skip to content

Commit

Permalink
Rewrite cypress test
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Sep 13, 2022
1 parent 57770ae commit 41ac69c
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions cypress/integration/settings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ describe('Check that user\'s settings survive a reload', () => {
})

it('Form survive a reload', () => {
cy.get("#app-content input[type='checkbox']").uncheck({force: true}).should('not.be.checked')
cy.get("#app-content input[type='checkbox']").uncheck({ force: true }).should('not.be.checked')

cy.reload()

cy.get("#app-content input[type='checkbox']").uncheck({force: true}).should('not.be.checked')
cy.get("#app-content input[type='checkbox']").uncheck({ force: true }).should('not.be.checked')

cy.get("#file_changed_notification").check({force: true})
cy.get("#file_changed_notification").check({ force: true })
cy.contains("A calendar was modified").click()
cy.contains("Comments for files").click()
cy.contains("Your password or email was modified").click()
Expand Down Expand Up @@ -95,21 +95,27 @@ describe('Check that user\'s settings survive a reload', () => {
})

it('Activity summary survive a reload', () => {
let input = cy.get("#app-content").contains("Send daily activity summary in the morning").parentsUntil('.settings-section').children('input')

input.check({force: true})
input.should('be.checked')

cy.reload()
input = cy.get("#app-content").contains("Send daily activity summary in the morning").parentsUntil('.settings-section').children('input')

input.should('be.checked')

input.uncheck({force: true})

cy.reload()
input = cy.get("#app-content").contains("Send daily activity summary in the morning").parentsUntil('.settings-section').children('input')

input.should('not.be.checked')
cy.intercept({ method: 'POST', url: '**/activity/settings' }).as("apiCall");

cy.get("#app-content")
.contains("Send daily activity summary in the morning")
.find('input')
.check({ force: true })
.should('be.checked')
.wait('@apiCall')
.reload()

cy.get("#app-content")
.contains("Send daily activity summary in the morning")
.find('input')
.should('be.checked')
.uncheck({ force: true })
.wait('@apiCall')
.reload()

cy.get("#app-content")
.contains("Send daily activity summary in the morning")
.find('input')
.should('not.be.checked')
})
})

0 comments on commit 41ac69c

Please sign in to comment.