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})`} 0 ? false : true) || @@ -526,6 +527,7 @@ export function JobLinesComponent({ {selectedLines.length > 0 && ` (${selectedLines.length})`} { setState((state) => ({ ...state, @@ -575,6 +577,7 @@ export function JobLinesComponent({ } /> + @@ -98,6 +98,7 @@ export function PartsOrderModalComponent({ - + )} {OEConnection.treatment === "on" && !isReturn && ( @@ -131,7 +132,7 @@ export function PartsOrderModalComponent({ label={t("parts_orders.labels.is_quote")} valuePropName="checked" > - + )} diff --git a/client/src/components/parts-order-modal/parts-order-modal.container.jsx b/client/src/components/parts-order-modal/parts-order-modal.container.jsx index 0f30012a3..fb5722643 100644 --- a/client/src/components/parts-order-modal/parts-order-modal.container.jsx +++ b/client/src/components/parts-order-modal/parts-order-modal.container.jsx @@ -358,7 +358,7 @@ export function PartsOrderModalContainer({ } onCancel={() => toggleModalVisible()} onOk={() => form.submit()} - okButtonProps={{ loading: saving }} + okButtonProps={{ loading: saving, "data-cy": "order-part-submit" }} cancelButtonProps={{ loading: saving }} destroyOnClose width="75%" diff --git a/client/src/components/vendor-search-select/vendor-search-select.component.jsx b/client/src/components/vendor-search-select/vendor-search-select.component.jsx index 6537d0ded..5884ac3bc 100644 --- a/client/src/components/vendor-search-select/vendor-search-select.component.jsx +++ b/client/src/components/vendor-search-select/vendor-search-select.component.jsx @@ -30,6 +30,8 @@ const VendorSearchSelect = ( return ( + {t("menus.jobsdetail.repairdata")}