From 9c5d6feec131a8bf24b6aeec55a07ce7524dec64 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 21 Jun 2022 13:30:39 +0530 Subject: [PATCH] test(cypress): show full response on insert_doc failure (#17257) --- cypress/support/commands.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index c168b0c201..b3708a1dba 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -313,7 +313,12 @@ Cypress.Commands.add('insert_doc', (doctype, args, ignore_duplicate) => { if (ignore_duplicate) { status_codes.push(409); } - expect(res.status).to.be.oneOf(status_codes); + + let message = null; + if (ignore_duplicate && !status_codes.includes(res.status)) { + message = `Document insert failed, response: ${JSON.stringify(res, null, '\t')}`; + } + expect(res.status).to.be.oneOf(status_codes, message); return res.body.data; }); });