From eb075d732ac100a4325e4f90e199130d82a75701 Mon Sep 17 00:00:00 2001 From: swtmply Date: Thu, 24 Aug 2023 04:55:28 +0800 Subject: [PATCH] IO-2327 moved the describe to different files --- .../e2e/posting-bills/part-ordering.cy.js | 431 ++++++++++++++++++ .../e2e/posting-bills/posting-bills.cy.js | 428 ----------------- 2 files changed, 431 insertions(+), 428 deletions(-) create mode 100644 client/cypress/e2e/posting-bills/part-ordering.cy.js diff --git a/client/cypress/e2e/posting-bills/part-ordering.cy.js b/client/cypress/e2e/posting-bills/part-ordering.cy.js new file mode 100644 index 000000000..9f3275efb --- /dev/null +++ b/client/cypress/e2e/posting-bills/part-ordering.cy.js @@ -0,0 +1,431 @@ +import job from "../../fixtures/jobs/job-3.json"; +import moment from "moment"; + +const uuid = () => Cypress._.random(0, 1e6); + +describe( + "Billing job parts orders", + { + defaultCommandTimeout: 10000, + }, + () => { + const today = moment(new Date()).format("YYYY-MM-DD"); + + beforeEach(() => { + cy.viewport(1280, 720); + cy.visit("/manage/jobs"); + + cy.intercept("POST", Cypress.env("graphql_dev_endpoint"), (req) => { + if (req.body.operationName === "SEARCH_VENDOR_AUTOCOMPLETE") { + req.alias = "vendors"; + } + }); + + cy.get('[data-cy="active-jobs-table"]') + .find(".ant-table-tbody") + .find("> tr:not(.ant-table-measure-row)") + .as("active-jobs-table") + .should("not.have.class", "ant-table-placeholder"); + + cy.get("@active-jobs-table") + .contains(job.clm_no) + .first() + .parent() + .find('[data-cy="active-job-link"]') + .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") + .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="receive-bill-button"]') + .click(); + + // fill out form + cy.get('[data-cy="bill-form-invoice"]').type(uuid()); + + cy.get("#bill-form-date").click(); + cy.get(`[title="${today}"]`).should("be.visible").click({ force: true }); + + cy.get('[data-cy="bill-form-parts-bin"]').find("input").click(); + cy.get("#location_list") + .next() + .find(".ant-select-item-option-content") + .first() + .click(); + + cy.get('[data-cy="bill-line-table"]').each(($row) => { + // get retail amount + cy.wrap($row) + .find('[data-cy="bill-line-actual-price"]') + .click({ force: true, multiple: true }); + cy.wrap($row) + .find('[data-cy="bill-line-actual-cost"]') + .click({ multiple: true }); + }); + + cy.get('[data-cy="bill-line-actual-cost"]').then((cells) => { + const totals = cells.toArray().map((el) => Number(el.value)); + const sum = Cypress._.sum(totals); + + cy.get('[data-cy="bill-form-bill-total"]').type(sum); + }); + // Click save + cy.get('[data-cy="bill-form-save-button"]').click(); + + 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("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("check inhouse bill to have extra actions", () => { + 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)") + .as("bills-table") + .should("not.have.class", "ant-table-placeholder"); + + cy.get("@bills-table") + .contains("$0.00") + .parent() + .parent() + .first() + .find('[data-cy="print-wrapper"]') + .should("exist"); + }); + + 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 + cy.get('[data-cy="bill-line-add-button"]') + .should("not.be.disabled") + .click(); + // Select Vendor + cy.antdSelect("bill-vendor"); + // Select Line + cy.antdSelect("bill-line"); + + cy.get('[data-cy="bill-line-line-desc"]').type("Line Description"); + // Fill the Form + cy.get('[data-cy="bill-form-invoice"]').type(uuid()); + + cy.get("#bill-form-date").click(); + cy.get(`[title="${today}"]`).should("be.visible").click({ force: true }); + + cy.get('[data-cy="bill-form-parts-bin"]').find("input").click(); + cy.get("#location_list") + .next() + .find(".ant-select-item-option-content") + .first() + .click(); + + cy.get('[data-cy="bill-line-table"]').each(($row) => { + // get retail amount + cy.wrap($row) + .find('[data-cy="bill-line-actual-price"]') + .click({ force: true, multiple: true }); + cy.wrap($row) + .find('[data-cy="bill-line-actual-cost"]') + .click({ multiple: true }); + }); + + cy.get('[data-cy="bill-line-actual-cost"]').then((cells) => { + const totals = cells.toArray().map((el) => Number(el.value)); + const sum = Cypress._.sum(totals); + + cy.get('[data-cy="bill-form-bill-total"]').type(sum); + }); + + cy.antdSelect("bill-cost-center"); + + // Click save + cy.get('[data-cy="bill-form-save-button"]').click(); + + cy.get(".ant-notification-notice-message").contains( + "Invoice added successfully." + ); + }); + + 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 + cy.get('[data-cy="bill-line-add-button"]') + .should("not.be.disabled") + .click(); + // Select Vendor + cy.antdSelect("bill-vendor"); + // Select Line + cy.antdSelect("bill-line", "-- Not On Estimate --"); + // Fill the Form + cy.get('[data-cy="bill-form-invoice"]').type(uuid()); + + cy.get("#bill-form-date").click(); + cy.get(`[title="${today}"]`).should("be.visible").click({ force: true }); + + cy.get('[data-cy="bill-form-parts-bin"]').find("input").click(); + cy.get("#location_list") + .next() + .find(".ant-select-item-option-content") + .first() + .click(); + + cy.get('[data-cy="bill-line-table"]').each(($row) => { + // get retail amount + cy.wrap($row) + .find('[data-cy="bill-line-actual-price"]') + .click({ force: true, multiple: true }); + cy.wrap($row) + .find('[data-cy="bill-line-actual-cost"]') + .click({ multiple: true }); + }); + + cy.get('[data-cy="bill-line-actual-cost"]').then((cells) => { + const totals = cells.toArray().map((el) => Number(el.value)); + const sum = Cypress._.sum(totals); + + cy.get('[data-cy="bill-form-bill-total"]').type(sum); + }); + + cy.antdSelect("bill-cost-center"); + + // Click save + cy.get('[data-cy="bill-form-savenew-button"]') + .should("not.be.disabled") + .click(); + + cy.get(".ant-notification-notice-message").contains( + "Invoice added successfully." + ); + }); + + 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)") + .as("bills-table") + .should("not.have.class", "ant-table-placeholder"); + + cy.get("@bills-table") + .first() + .should("be.visible") + .find('[data-cy="edit-bill-button"]') + .click(); + + cy.location("search").should("include", "billid"); + cy.get('[data-cy="bill-edit-form"]') + .find(".ant-upload #bill-document-upload") + .selectFile("job.json", { force: true }); + }); + + 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)") + .as("bills-table") + .should("not.have.class", "ant-table-placeholder"); + + cy.get("@bills-table") + .find('[data-cy="bill-exported-checkbox"]') + .not(":checked") + .first() + .as("export-status") + .parent() + .parent() + .parent() + .parent() + .find('[data-cy="edit-bill-button"]') + .click(); + + cy.location("search").should("include", "billid"); + cy.get('[data-cy="bill-mark-export-button"]') + .as("mark-for-export") + .click(); + cy.get("@mark-for-export").should("be.disabled"); + }); + + 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)") + .as("bills-table") + .should("not.have.class", "ant-table-placeholder"); + + cy.get("@bills-table") + .find('[data-cy="bill-exported-checkbox"]') + .filter(":checked") + .first() + .as("export-status") + .parent() + .parent() + .parent() + .parent() + .find('[data-cy="edit-bill-button"]') + .click(); + + cy.location("search").should("include", "billid"); + cy.get('[data-cy="bill-mark-reexport-button"]') + .as("mark-for-reexport") + .click(); + cy.get("@mark-for-reexport").should("be.disabled"); + }); + } +); diff --git a/client/cypress/e2e/posting-bills/posting-bills.cy.js b/client/cypress/e2e/posting-bills/posting-bills.cy.js index 2829890ea..57988902d 100644 --- a/client/cypress/e2e/posting-bills/posting-bills.cy.js +++ b/client/cypress/e2e/posting-bills/posting-bills.cy.js @@ -1,437 +1,9 @@ -import job from "../../fixtures/jobs/job-3.json"; import job2 from "../../fixtures/jobs/job-4.json"; import moment from "moment"; import Dinero from "dinero.js"; const uuid = () => Cypress._.random(0, 1e6); -describe( - "Billing job parts orders", - { - defaultCommandTimeout: 10000, - }, - () => { - const today = moment(new Date()).format("YYYY-MM-DD"); - - beforeEach(() => { - cy.viewport(1280, 720); - cy.visit("/manage/jobs"); - - cy.intercept("POST", Cypress.env("graphql_dev_endpoint"), (req) => { - if (req.body.operationName === "SEARCH_VENDOR_AUTOCOMPLETE") { - req.alias = "vendors"; - } - }); - - cy.get('[data-cy="active-jobs-table"]') - .find(".ant-table-tbody") - .find("> tr:not(.ant-table-measure-row)") - .as("active-jobs-table") - .should("not.have.class", "ant-table-placeholder"); - - cy.get("@active-jobs-table") - .contains(job.clm_no) - .first() - .parent() - .find('[data-cy="active-job-link"]') - .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") - .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="receive-bill-button"]') - .click(); - - // fill out form - cy.get('[data-cy="bill-form-invoice"]').type(uuid()); - - cy.get("#bill-form-date").click(); - cy.get(`[title="${today}"]`).should("be.visible").click({ force: true }); - - cy.get('[data-cy="bill-form-parts-bin"]').find("input").click(); - cy.get("#location_list") - .next() - .find(".ant-select-item-option-content") - .first() - .click(); - - cy.get('[data-cy="bill-line-table"]').each(($row) => { - // get retail amount - cy.wrap($row) - .find('[data-cy="bill-line-actual-price"]') - .click({ force: true, multiple: true }); - cy.wrap($row) - .find('[data-cy="bill-line-actual-cost"]') - .click({ multiple: true }); - }); - - cy.get('[data-cy="bill-line-actual-cost"]').then((cells) => { - const totals = cells.toArray().map((el) => Number(el.value)); - const sum = Cypress._.sum(totals); - - cy.get('[data-cy="bill-form-bill-total"]').type(sum); - }); - // Click save - cy.get('[data-cy="bill-form-save-button"]').click(); - - 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("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("check inhouse bill to have extra actions", () => { - 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)") - .as("bills-table") - .should("not.have.class", "ant-table-placeholder"); - - cy.get("@bills-table") - .contains("$0.00") - .parent() - .parent() - .first() - .find('[data-cy="print-wrapper"]') - .should("exist"); - }); - - 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 - cy.get('[data-cy="bill-line-add-button"]') - .should("not.be.disabled") - .click(); - // Select Vendor - cy.antdSelect("bill-vendor"); - // Select Line - cy.antdSelect("bill-line"); - - cy.get('[data-cy="bill-line-line-desc"]').type("Line Description"); - // Fill the Form - cy.get('[data-cy="bill-form-invoice"]').type(uuid()); - - cy.get("#bill-form-date").click(); - cy.get(`[title="${today}"]`).should("be.visible").click({ force: true }); - - cy.get('[data-cy="bill-form-parts-bin"]').find("input").click(); - cy.get("#location_list") - .next() - .find(".ant-select-item-option-content") - .first() - .click(); - - cy.get('[data-cy="bill-line-table"]').each(($row) => { - // get retail amount - cy.wrap($row) - .find('[data-cy="bill-line-actual-price"]') - .click({ force: true, multiple: true }); - cy.wrap($row) - .find('[data-cy="bill-line-actual-cost"]') - .click({ multiple: true }); - }); - - cy.get('[data-cy="bill-line-actual-cost"]').then((cells) => { - const totals = cells.toArray().map((el) => Number(el.value)); - const sum = Cypress._.sum(totals); - - cy.get('[data-cy="bill-form-bill-total"]').type(sum); - }); - - cy.antdSelect("bill-cost-center"); - - // Click save - cy.get('[data-cy="bill-form-save-button"]').click(); - - cy.get(".ant-notification-notice-message").contains( - "Invoice added successfully." - ); - }); - - 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 - cy.get('[data-cy="bill-line-add-button"]') - .should("not.be.disabled") - .click(); - // Select Vendor - cy.antdSelect("bill-vendor"); - // Select Line - cy.antdSelect("bill-line", "-- Not On Estimate --"); - // Fill the Form - cy.get('[data-cy="bill-form-invoice"]').type(uuid()); - - cy.get("#bill-form-date").click(); - cy.get(`[title="${today}"]`).should("be.visible").click({ force: true }); - - cy.get('[data-cy="bill-form-parts-bin"]').find("input").click(); - cy.get("#location_list") - .next() - .find(".ant-select-item-option-content") - .first() - .click(); - - cy.get('[data-cy="bill-line-table"]').each(($row) => { - // get retail amount - cy.wrap($row) - .find('[data-cy="bill-line-actual-price"]') - .click({ force: true, multiple: true }); - cy.wrap($row) - .find('[data-cy="bill-line-actual-cost"]') - .click({ multiple: true }); - }); - - cy.get('[data-cy="bill-line-actual-cost"]').then((cells) => { - const totals = cells.toArray().map((el) => Number(el.value)); - const sum = Cypress._.sum(totals); - - cy.get('[data-cy="bill-form-bill-total"]').type(sum); - }); - - cy.antdSelect("bill-cost-center"); - - // Click save - cy.get('[data-cy="bill-form-savenew-button"]') - .should("not.be.disabled") - .click(); - - cy.get(".ant-notification-notice-message").contains( - "Invoice added successfully." - ); - }); - - 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)") - .as("bills-table") - .should("not.have.class", "ant-table-placeholder"); - - cy.get("@bills-table") - .first() - .should("be.visible") - .find('[data-cy="edit-bill-button"]') - .click(); - - cy.location("search").should("include", "billid"); - cy.get('[data-cy="bill-edit-form"]') - .find(".ant-upload #bill-document-upload") - .selectFile("job.json", { force: true }); - }); - - 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)") - .as("bills-table") - .should("not.have.class", "ant-table-placeholder"); - - cy.get("@bills-table") - .find('[data-cy="bill-exported-checkbox"]') - .not(":checked") - .first() - .as("export-status") - .parent() - .parent() - .parent() - .parent() - .find('[data-cy="edit-bill-button"]') - .click(); - - cy.location("search").should("include", "billid"); - cy.get('[data-cy="bill-mark-export-button"]') - .as("mark-for-export") - .click(); - cy.get("@mark-for-export").should("be.disabled"); - }); - - 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)") - .as("bills-table") - .should("not.have.class", "ant-table-placeholder"); - - cy.get("@bills-table") - .find('[data-cy="bill-exported-checkbox"]') - .filter(":checked") - .first() - .as("export-status") - .parent() - .parent() - .parent() - .parent() - .find('[data-cy="edit-bill-button"]') - .click(); - - cy.location("search").should("include", "billid"); - cy.get('[data-cy="bill-mark-reexport-button"]') - .as("mark-for-reexport") - .click(); - cy.get("@mark-for-reexport").should("be.disabled"); - }); - } -); - describe( "Validating and calculating bills", {