From 12d07f83189f96e6eb4758da62d5e44a78346005 Mon Sep 17 00:00:00 2001 From: swtmply Date: Thu, 22 Jun 2023 06:43:45 +0800 Subject: [PATCH] IO-2327 parts ordering send by email --- .../e2e/parts-ordering/parts-ordering.cy.js | 69 +++++++++++++++++++ .../job-detail-lines/job-lines.component.jsx | 3 + .../parts-order-modal.component.jsx | 7 +- .../parts-order-modal.container.jsx | 2 +- .../vendor-search-select.component.jsx | 2 + .../jobs-detail.page.component.jsx | 2 +- 6 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 client/cypress/e2e/parts-ordering/parts-ordering.cy.js diff --git a/client/cypress/e2e/parts-ordering/parts-ordering.cy.js b/client/cypress/e2e/parts-ordering/parts-ordering.cy.js new file mode 100644 index 000000000..a8dba80af --- /dev/null +++ b/client/cypress/e2e/parts-ordering/parts-ordering.cy.js @@ -0,0 +1,69 @@ +describe( + "Ordering parts for the job", + { + defaultCommandTimeout: 5000, + }, + () => { + beforeEach(() => { + cy.visit("/manage"); + + cy.get("body").then(($body) => { + if ($body.text().includes("Login")) { + // Log in + cy.get('[data-cy="username"]').type("john@imex.dev"); + cy.get('[data-cy="password"]').type("john123"); + cy.get('[data-cy="sign-in-button"]').click(); + } + + cy.get(".ant-table-tbody") + .should("be.visible") + .find("tr") + .should("not.have.class", "ant-table-placeholder"); + + cy.get(".ant-table-row") + .not(':contains("Open")') + .first() + .find("a") + .first() + .click(); + + cy.url().should("include", "/manage/jobs"); + + // Go to repair data tab + cy.get('[data-cy="tab-repairdata"]').should("be.visible").click(); + // Click on filter parts only + cy.get('[data-cy="filter-parts-button"]') + .should("not.be.disabled") + .click(); + // Select multiple rows + cy.get('[data-cy="repair-data-table"]') + .find(".ant-table-tbody") + .find("> tr:not(.ant-table-measure-row)") + .first() + .find(".ant-checkbox-input") + .click(); + // Click Order Parts + cy.get('[data-cy="order-parts-button"]') + .should("not.be.disabled") + .click(); + // Modal should be visible + cy.get('[data-cy="parts-order-modal"]').should("be.visible"); + // Fill required fields + cy.antdFormSelect("vendor", "Vendor"); + cy.get("#deliver_by").click(); + cy.get('[title="2023-06-21"]').should("be.visible").click(); + }); + }); + + it("sending by email", () => { + // FIXME email preview not working + cy.get('[data-cy="part-order-checkbox-remove"]').check(); + cy.get('[data-cy="order-part-submit"]').should("not.be.disabled").click(); + + cy.contains("Email Preview"); + }); + + // TODO Send by PDF + // TODO Send by OEC + } +); diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx index 89debdf45..8bc5cbcdd 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -497,6 +497,7 @@ export function JobLinesComponent({ {selectedLines.length > 0 && ` (${selectedLines.length})`}