This commit is contained in:
2026-02-15 17:36:39 -08:00
parent 46cac98fb4
commit a2b887967f

View File

@@ -1,52 +1,29 @@
describe("Report generation", () => { describe("Report generation", () => {
it("Customer report opens without error", () => { it("Customer report opens without error", () => {
cy.ayLogin("bizadmin"); 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.visit("/cust-customers/1");
cy.url().should("include", "/cust-customers/1"); cy.url().should("include", "/cust-customers/1");
cy.get("[data-cy=generalerror]").should("not.exist"); cy.get("[data-cy=generalerror]").should("not.exist");
cy.get("[data-cy=name]"); cy.get("[data-cy=name]");
// Stub window.open AFTER the page has loaded
cy.window().then(win => {
cy.stub(win, "open").as("windowOpen");
});
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-notes/1"); // The render job is async — give it time to complete and call window.open
// cy.url().should("include", "/cust-customer-notes/1"); // Adjust timeout if your reports take longer to render
// cy.get("[data-cy=generalerror]").should("not.exist"); cy.get("@windowOpen", { timeout: 30000 }).should("have.been.calledOnce");
// cy.get("[data-cy=clickThru]");
// cy.visit("/cust-customer-note/0"); // Verify the URL passed to window.open looks like a PDF download
// cy.url().should("include", "/cust-customer-note/0"); cy.get("@windowOpen").should(
// cy.get("[data-cy=generalerror]").should("not.exist"); "have.been.calledWithMatch",
// cy.get("[data-cy=notes]"); /\/api\/v8\.0\/report\/download\/.+\.pdf/
);
// 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]");
//-----------------------------------------------------
}); });
}); });