From a2b887967ff39a9e6bc75f4ea95810186d49838d Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sun, 15 Feb 2026 17:36:39 -0800 Subject: [PATCH] 4643 --- .../regression/2-report/001-run-report.cy.js | 53 ++++++------------- 1 file changed, 15 insertions(+), 38 deletions(-) diff --git a/e2e/tests/regression/2-report/001-run-report.cy.js b/e2e/tests/regression/2-report/001-run-report.cy.js index c743208..1f40fe6 100644 --- a/e2e/tests/regression/2-report/001-run-report.cy.js +++ b/e2e/tests/regression/2-report/001-run-report.cy.js @@ -1,52 +1,29 @@ - describe("Report generation", () => { it("Customer report opens without error", () => { cy.ayLogin("bizadmin"); - //################# print customer report - cy.visit("/cust-customers"); - cy.url().should("include", "/cust-customers"); - cy.get("[data-cy=generalerror]").should("not.exist"); - cy.get("[data-cy=customersTable]"); - cy.visit("/cust-customers/1"); cy.url().should("include", "/cust-customers/1"); cy.get("[data-cy=generalerror]").should("not.exist"); cy.get("[data-cy=name]"); - + // Stub window.open AFTER the page has loaded + cy.window().then(win => { + cy.stub(win, "open").as("windowOpen"); + }); - // cy.visit("/cust-customer-notes/1"); - // cy.url().should("include", "/cust-customer-notes/1"); - // cy.get("[data-cy=generalerror]").should("not.exist"); - // cy.get("[data-cy=clickThru]"); + cy.get("[data-cy=contextmenu]").click(); + cy.get("[data-cy='customer-edit:report']").click(); + cy.get(".v-list > :nth-child(1) > .v-list-item__title").click(); - // cy.visit("/cust-customer-note/0"); - // cy.url().should("include", "/cust-customer-note/0"); - // cy.get("[data-cy=generalerror]").should("not.exist"); - // cy.get("[data-cy=notes]"); + // The render job is async — give it time to complete and call window.open + // Adjust timeout if your reports take longer to render + cy.get("@windowOpen", { timeout: 30000 }).should("have.been.calledOnce"); - // cy.visit("/cust-head-offices"); - // cy.url().should("include", "/cust-head-offices"); - // cy.get("[data-cy=generalerror]").should("not.exist"); - // cy.get("[data-cy=headofficesTable]"); - - // cy.visit("/cust-head-offices/1"); - // cy.url().should("include", "cust-head-offices/1"); - // cy.get("[data-cy=generalerror]").should("not.exist"); - // cy.get("[data-cy=name]"); - - // cy.visit("/cust-users"); - // cy.url().should("include", "/cust-users"); - // cy.get("[data-cy=generalerror]").should("not.exist"); - // cy.get("[data-cy=custUsersTable]"); - - // cy.visit("/cust-users/0"); - // cy.url().should("include", "/cust-users/0"); - // cy.get("[data-cy=customerId]"); - - - - //----------------------------------------------------- + // Verify the URL passed to window.open looks like a PDF download + cy.get("@windowOpen").should( + "have.been.calledWithMatch", + /\/api\/v8\.0\/report\/download\/.+\.pdf/ + ); }); });