Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cypress): Make new-users test less flaky by using test isolation #41399

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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