diff --git a/client/cypress/e2e/parts-ordering/parts-ordering.cy.js b/client/cypress/e2e/parts-ordering/parts-ordering.cy.js index 1759564bf..84212ef53 100644 --- a/client/cypress/e2e/parts-ordering/parts-ordering.cy.js +++ b/client/cypress/e2e/parts-ordering/parts-ordering.cy.js @@ -18,7 +18,7 @@ describe( .should("not.have.class", "ant-table-placeholder"); }); - it("order multiple parts for the job", () => { + it("order parts for the job", () => { const today = moment(new Date()).format("YYYY-MM-DD"); cy.get("@active-jobs-table") @@ -73,7 +73,7 @@ describe( .contains("Ordered"); }); - it.only("order parts for the job", () => { + it.only("order multiple parts for the job", () => { const today = moment(new Date()).format("YYYY-MM-DD"); cy.get("@active-jobs-table") @@ -110,6 +110,8 @@ describe( cy.get("#deliver_by").click(); cy.get(`[title="${today}"]`).should("be.visible").click({ force: true }); + cy.get('[data-cy="part-order-comments"]').type("testing from cypress"); + cy.get('[data-cy="part-order-select-none"]').check(); cy.get('[data-cy="order-part-submit"]').should("not.be.disabled").click(); diff --git a/client/cypress/e2e/posting-bills/posting-bills.cy.js b/client/cypress/e2e/posting-bills/posting-bills.cy.js index bde8479ea..4e3538604 100644 --- a/client/cypress/e2e/posting-bills/posting-bills.cy.js +++ b/client/cypress/e2e/posting-bills/posting-bills.cy.js @@ -5,7 +5,7 @@ import Dinero from "dinero.js"; const uuid = () => Cypress._.random(0, 1e6); -describe( +describe.only( "Billing job parts orders", { defaultCommandTimeout: 10000, @@ -35,12 +35,57 @@ describe( .parent() .find('[data-cy="active-job-link"]') .click(); - - // Go to repair data tab - cy.get('[data-cy="tab-partssublet"]').should("be.visible").click(); }); it("receives a part bill", () => { + // Order a part + // 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.get(".ant-select-selection-search").find(`#vendorid`).click(); + cy.get(`#vendorid_list`) + .next() + .find(".ant-select-item-option-content") + .first() + .click({ force: true }); + cy.get("#deliver_by").click(); + cy.get(`[title="${today}"]`).should("be.visible").click({ force: true }); + + cy.get('[data-cy="part-order-comments"]').type("testing from cypress"); + + cy.get('[data-cy="part-order-select-none"]').check(); + cy.get('[data-cy="order-part-submit"]').should("not.be.disabled").click(); + + cy.get(".ant-notification-notice-message").contains( + "Parts order created successfully." + ); + + cy.get('[data-cy="repair-data-table"]') + .find(".ant-table-tbody") + .find("> tr:not(.ant-table-measure-row)") + .first() + .find(".ant-table-cell") + .eq(15) + .contains("Ordered"); + + cy.get('[data-cy="tab-partssublet"]').should("be.visible").click(); // Find the first row in the parts order cy.get('[data-cy="part-orders-table"]') .find(".ant-table-tbody") @@ -55,7 +100,6 @@ describe( .click(); // fill out form - // data-cy="bill-form-invoice" cy.get('[data-cy="bill-form-invoice"]').type(uuid()); cy.get("#bill-form-date").click(); @@ -90,9 +134,100 @@ describe( cy.get(".ant-notification-notice-message").contains( "Invoice added successfully." ); + + cy.get('[data-cy="tab-repairdata"]').should("be.visible").click(); + + cy.get('[data-cy="filter-parts-button"]') + .should("not.be.disabled") + .click(); + + cy.get('[data-cy="repair-data-table"]') + .find(".ant-table-tbody") + .find("> tr:not(.ant-table-measure-row)") + .first() + .find(".ant-table-cell") + .eq(15) + .contains("Received"); + }); + + it("backorders part from order", () => { + cy.get('[data-cy="tab-partssublet"]').should("be.visible").click(); + + cy.get('[data-cy="part-orders-table"]') + .find(".ant-table-tbody") + .find("> tr:not(.ant-table-measure-row)") + .as("orders-table") + .should("not.have.class", "ant-table-placeholder"); + + cy.get("@orders-table") + .first() + .should("be.visible") + .find('[data-cy="view-part-order-button"]') + .click(); + + cy.get('[data-cy="mark-backorder-button"]').click(); + cy.get(".backorder-date").click(); + cy.get(`[title="${today}"]`).should("be.visible").click({ force: true }); + + cy.get('[data-cy="mark-for-backorder-button"]').click(); + + cy.get(".ant-drawer-close").click(); + + cy.get('[data-cy="tab-repairdata"]').should("be.visible").click(); + + cy.get('[data-cy="filter-parts-button"]') + .should("not.be.disabled") + .click(); + + cy.get('[data-cy="repair-data-table"]') + .find(".ant-table-tbody") + .find("> tr:not(.ant-table-measure-row)") + .first() + .find(".ant-table-cell") + .eq(15) + .contains("Backordered"); + }); + + it.only("order parts inhouse", () => { + 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-inhouse-button"]') + .should("not.be.disabled") + .click(); + + cy.antdSelect("bill-vendor"); + + cy.antdSelect("bill-cost-center"); + + cy.get('[data-cy="bill-form-save-button"]').click({ force: true }); + + cy.get(".ant-notification-notice-message").contains( + "Invoice added successfully." + ); + + cy.get('[data-cy="repair-data-table"]') + .find(".ant-table-tbody") + .find("> tr:not(.ant-table-measure-row)") + .first() + .find(".ant-table-cell") + .eq(15) + .contains("Received"); }); it("posts bill directly", () => { + cy.get('[data-cy="tab-partssublet"]').should("be.visible").click(); + cy.get('[data-cy="bills-post-button"]').should("be.visible").click(); // Add New Line @@ -144,6 +279,8 @@ describe( }); it("posts a bill with save and new", () => { + cy.get('[data-cy="tab-partssublet"]').should("be.visible").click(); + cy.get('[data-cy="bills-post-button"]').should("be.visible").click(); // Add New Line @@ -197,6 +334,8 @@ describe( }); it("uploads a document to a bill", () => { + cy.get('[data-cy="tab-partssublet"]').should("be.visible").click(); + cy.get('[data-cy="bills-table"]') .find(".ant-table-tbody") .find("> tr:not(.ant-table-measure-row)") @@ -216,6 +355,8 @@ describe( }); it("marks bill as exported", () => { + cy.get('[data-cy="tab-partssublet"]').should("be.visible").click(); + cy.get('[data-cy="bills-table"]') .find(".ant-table-tbody") .find("> tr:not(.ant-table-measure-row)") @@ -242,6 +383,8 @@ describe( }); it("marks bill for re-export", () => { + cy.get('[data-cy="tab-partssublet"]').should("be.visible").click(); + cy.get('[data-cy="bills-table"]') .find(".ant-table-tbody") .find("> tr:not(.ant-table-measure-row)") 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 8bc5cbcdd..640b57fd6 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -441,6 +441,7 @@ export function JobLinesComponent({ )} @@ -95,7 +99,11 @@ export function PartsOrderLineBackorderButton({ visible={visibility} disabled={disabled} > - )} diff --git a/client/src/components/parts-order-modal/parts-order-modal.component.jsx b/client/src/components/parts-order-modal/parts-order-modal.component.jsx index a2268dc1f..49754ca84 100644 --- a/client/src/components/parts-order-modal/parts-order-modal.component.jsx +++ b/client/src/components/parts-order-modal/parts-order-modal.component.jsx @@ -321,7 +321,7 @@ export function PartsOrderModalComponent({ } > - + 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 fb5722643..fb729ca03 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 @@ -362,7 +362,7 @@ export function PartsOrderModalContainer({ cancelButtonProps={{ loading: saving }} destroyOnClose width="75%" - forceRender + // forceRender > {error ? : null}