Skip to content

Commit

Permalink
Merge pull request #41399 from nextcloud/fix/cypress-flaky-new-users
Browse files Browse the repository at this point in the history
fix(cypress): Make new-users test less flaky by using test isolation
  • Loading branch information
susnux authored Nov 17, 2023
2 parents 137e488 + b06951e commit 8442900
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions cypress/e2e/settings/users.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,16 @@ const admin = new User('admin', 'admin')
const john = new User('john', '123456')

describe('Settings: Create and delete users', function() {
before(function() {
cy.login(admin)
// open the User settings
cy.visit('/settings/users')
})

beforeEach(function() {
cy.login(admin)
cy.listUsers().then((users) => {
cy.login(admin)
if ((users as string[]).includes(john.userId)) {
// ensure created user is deleted
cy.deleteUser(john).login(admin)
// ensure deleted user is not present
cy.reload().login(admin)
cy.deleteUser(john)
}
})
cy.login(admin)
// open the User settings
cy.visit('/settings/users')
})

it('Can create a user', function() {
Expand All @@ -64,7 +57,7 @@ describe('Settings: Create and delete users', function() {
// see that the password is 123456
cy.get('input[type="password"]').should('have.value', john.password)
// submit the new user form
cy.get('button[type="submit"]').click()
cy.get('button[type="submit"]').click({ force: true })
})

// Make sure no confirmation modal is shown
Expand Down Expand Up @@ -98,7 +91,7 @@ describe('Settings: Create and delete users', function() {
cy.get('input[type="password"]').type(john.password)
cy.get('input[type="password"]').should('have.value', john.password)
// submit the new user form
cy.get('button[type="submit"]').click()
cy.get('button[type="submit"]').click({ force: true })
})

// Make sure no confirmation modal is shown
Expand Down

0 comments on commit 8442900

Please sign in to comment.