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", () => {
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/
);
});
});