From 1111d0257fd93745f898d4fef7bcff2c248e9fa9 Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Sat, 15 Nov 2025 05:49:49 +0100 Subject: [PATCH] test: ignore missing param for cy.remove_doc (#34697) This makes it easier to clean up db state before running a test. --- cypress/integration/workspace_blocks.js | 1 + cypress/support/commands.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cypress/integration/workspace_blocks.js b/cypress/integration/workspace_blocks.js index 70159150e2..396e80d16b 100644 --- a/cypress/integration/workspace_blocks.js +++ b/cypress/integration/workspace_blocks.js @@ -11,6 +11,7 @@ context("Workspace Blocks", () => { }); it("Create Test Page", () => { + cy.remove_doc("Workspace", `Test Block Page-${Cypress.config("testUser")}`, true); cy.intercept({ method: "POST", url: "api/method/frappe.desk.doctype.workspace.workspace.new_page", diff --git a/cypress/support/commands.js b/cypress/support/commands.js index cf94335a74..5731a0050c 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -125,7 +125,7 @@ Cypress.Commands.add("get_doc", (doctype, name) => { }); }); -Cypress.Commands.add("remove_doc", (doctype, name) => { +Cypress.Commands.add("remove_doc", (doctype, name, ignore_missing) => { return cy .window() .its("frappe.csrf_token") @@ -138,9 +138,9 @@ Cypress.Commands.add("remove_doc", (doctype, name) => { Accept: "application/json", "X-Frappe-CSRF-Token": csrf_token, }, + failOnStatusCode: !ignore_missing, }) .then((res) => { - expect(res.status).eq(202); return res.body; }); });