From cd38017724c60d114b0400614967fbcb0056f9fa Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Wed, 2 Aug 2023 11:38:48 -0700 Subject: [PATCH] fix(cypress): Can delete a user Signed-off-by: Christopher Ng --- cypress/e2e/settings/users.cy.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cypress/e2e/settings/users.cy.ts b/cypress/e2e/settings/users.cy.ts index 3a96f7546db..9bc0c8ad657 100644 --- a/cypress/e2e/settings/users.cy.ts +++ b/cypress/e2e/settings/users.cy.ts @@ -150,6 +150,20 @@ describe('Settings: Create and delete users', function() { cy.get('.action-item__popper .action').contains('Delete user').should('exist').click() // And confirmation dialog accepted cy.get('.oc-dialog button').contains(`Delete ${jdoe.userId}`).click() + + // Ignore failure if modal is not shown + cy.once('fail', (error) => { + expect(error.name).to.equal('AssertionError') + expect(error).to.have.property('node', '.modal-container') + }) + // Make sure no confirmation modal is shown + cy.get('body').find('.modal-container').then(($modal) => { + if ($modal.length > 0) { + cy.wrap($modal).find('input[type="password"]').type(admin.password) + cy.wrap($modal).find('button').contains('Confirm').click() + } + }) + // deleted clicked the user is not shown anymore cy.get(`tbody.user-list__body tr td[data-test="${jdoe.userId}"]`).parents('tr').should('not.be.visible') }) -- 2.39.5