IO-2327 posting bills test cases
This commit is contained in:
@@ -367,7 +367,7 @@ describe.only(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it.only("returning item and validating statistics", () => {
|
it("returning item and validating statistics", () => {
|
||||||
cy.get('[data-cy="bills-table"]')
|
cy.get('[data-cy="bills-table"]')
|
||||||
.find(".ant-table-tbody")
|
.find(".ant-table-tbody")
|
||||||
.find("> tr:not(.ant-table-measure-row)")
|
.find("> tr:not(.ant-table-measure-row)")
|
||||||
@@ -424,22 +424,49 @@ describe.only(
|
|||||||
cy.get('[data-cy="bill-form-invoice"]').type(uuid());
|
cy.get('[data-cy="bill-form-invoice"]').type(uuid());
|
||||||
|
|
||||||
cy.get("#bill-form-date").click();
|
cy.get("#bill-form-date").click();
|
||||||
cy.get('[title="2023-07-06"]').should("be.visible").click();
|
cy.get(`[title="${today}"]`).should("be.visible").click({ force: true });
|
||||||
|
|
||||||
cy.get('[data-cy="bill-form-bill-total"]').type("70.46");
|
cy.get('[data-cy="bill-line-table"]').each(($row) => {
|
||||||
cy.get('[data-cy="bill-line-actual-cost"]').type("67.10");
|
// 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);
|
||||||
|
|
||||||
|
// Get taxes add it to the sum
|
||||||
|
cy.get('[data-cy="bill-form-tax"]').then((taxes) => {
|
||||||
|
const subtotals = taxes
|
||||||
|
.toArray()
|
||||||
|
.map((el) => Number(el.innerText.substring(1)));
|
||||||
|
const totalTax = Cypress._.sum(subtotals);
|
||||||
|
|
||||||
|
const billAmount = sum + totalTax;
|
||||||
|
|
||||||
|
cy.get('[data-cy="bill-form-bill-total"]')
|
||||||
|
.find("input")
|
||||||
|
.clear()
|
||||||
|
.type(billAmount);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
cy.get("#bill-form-discrepancy").should("have.text", "$0.00");
|
cy.get("#bill-form-discrepancy").should("have.text", "$0.00");
|
||||||
|
|
||||||
// Click save
|
|
||||||
cy.get('[data-cy="bill-form-save-button"]').click();
|
cy.get('[data-cy="bill-form-save-button"]').click();
|
||||||
|
|
||||||
cy.get("#totalReturns").should("have.text", "$83.87");
|
// TODO add other totals to assert the posted CNR
|
||||||
cy.get("#calculatedcreditsnotreceived").should("have.text", "$0.00");
|
cy.get("#calculatedcreditsnotreceived").should("have.text", "$0.00");
|
||||||
cy.get("#creditsnotreceived").should("have.text", "$83.87");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("receives credit memo with return part", () => {
|
it.only("receives credit memo with return part", () => {
|
||||||
// Find the first row in the parts order
|
// Find the first row in the parts order
|
||||||
cy.get('[data-cy="part-orders-table"]')
|
cy.get('[data-cy="part-orders-table"]')
|
||||||
.find(".ant-table-tbody")
|
.find(".ant-table-tbody")
|
||||||
@@ -462,11 +489,39 @@ describe.only(
|
|||||||
cy.get('[data-cy="bill-form-invoice"]').type(uuid());
|
cy.get('[data-cy="bill-form-invoice"]').type(uuid());
|
||||||
|
|
||||||
cy.get("#bill-form-date").click();
|
cy.get("#bill-form-date").click();
|
||||||
cy.get('[title="2023-07-06"]').should("be.visible").click();
|
cy.get(`[title="${today}"]`).should("be.visible").click({ force: true });
|
||||||
|
|
||||||
cy.get('[data-cy="bill-form-bill-total"]').type("70.46");
|
cy.get('[data-cy="bill-line-table"]').each(($row) => {
|
||||||
cy.get('[data-cy="bill-line-actual-cost"]').type("67.10");
|
// 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);
|
||||||
|
|
||||||
|
// Get taxes add it to the sum
|
||||||
|
cy.get('[data-cy="bill-form-tax"]').then((taxes) => {
|
||||||
|
const subtotals = taxes
|
||||||
|
.toArray()
|
||||||
|
.map((el) => Number(el.innerText.substring(1)));
|
||||||
|
const totalTax = Cypress._.sum(subtotals);
|
||||||
|
|
||||||
|
const billAmount = sum + totalTax;
|
||||||
|
|
||||||
|
cy.get('[data-cy="bill-form-bill-total"]')
|
||||||
|
.find("input")
|
||||||
|
.clear()
|
||||||
|
.type(billAmount);
|
||||||
|
});
|
||||||
|
});
|
||||||
cy.get("#bill-form-discrepancy").should("have.text", "$0.00");
|
cy.get("#bill-form-discrepancy").should("have.text", "$0.00");
|
||||||
|
|
||||||
cy.get('[data-cy="mark-as-received-checkbox"]').check();
|
cy.get('[data-cy="mark-as-received-checkbox"]').check();
|
||||||
@@ -474,11 +529,12 @@ describe.only(
|
|||||||
// Click save
|
// Click save
|
||||||
cy.get('[data-cy="bill-form-save-button"]').click();
|
cy.get('[data-cy="bill-form-save-button"]').click();
|
||||||
|
|
||||||
cy.get("#totalReturns").should("have.text", "$83.87");
|
// TODO add assertion to the total
|
||||||
cy.get("#calculatedcreditsnotreceived").should("have.text", "$0.00");
|
cy.get("#calculatedcreditsnotreceived").should("have.text", "$0.00");
|
||||||
cy.get("#creditsnotreceived").should("have.text", "$0.00");
|
cy.get("#creditsnotreceived").should("have.text", "$0.00");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO add more assertions to the parts table
|
||||||
it("views the row expander if it has the order and bill", () => {
|
it("views the row expander if it has the order and bill", () => {
|
||||||
cy.get('[data-cy="tab-repairdata"]').should("be.visible").click();
|
cy.get('[data-cy="tab-repairdata"]').should("be.visible").click();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user