Skip to content

Commit 9f85553

Browse files
committed
fix: make cypress create user more informative
Without this commit cypress may sat it has created a user when that is not the case. Nextcloud returns a 200 HTTP code with a status set to "failure" Signed-off-by: Robbert Gurdeep Singh <git@beardhatcode.be>
1 parent 195916f commit 9f85553

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

cypress/support/commands.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ Cypress.Commands.add('nextcloudCreateUser', (user, password) => {
6565
Authorization: `Basic ${btoa('admin:admin')}`,
6666
},
6767
}).then(response => {
68-
cy.log(`Created user ${user}`, response.status)
68+
if(response.body.ocs.meta.status.toLowerCase() == "ok"){
69+
cy.log(`Created user ${user}`, response.status)
70+
} else {
71+
throw new Error(`Unable to create user`)
72+
}
6973
})
7074
})
7175

0 commit comments

Comments
 (0)