]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(cypress): Can delete a user
authorChristopher Ng <chrng8@gmail.com>
Wed, 2 Aug 2023 18:38:48 +0000 (11:38 -0700)
committerChristopher Ng <chrng8@gmail.com>
Wed, 9 Aug 2023 00:20:25 +0000 (17:20 -0700)
Signed-off-by: Christopher Ng <chrng8@gmail.com>
cypress/e2e/settings/users.cy.ts

index 3a96f7546db1047741ae9067b7896d35cfeaa7a9..9bc0c8ad6570882bafb039f086c7775364b02397 100644 (file)
@@ -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')
        })