IO-2327 posting bills test cases
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
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);
|
||||
|
||||
@@ -250,10 +251,17 @@ describe(
|
||||
describe.only(
|
||||
"Validating and calculating bills",
|
||||
{
|
||||
defaultCommandTimeout: 5000,
|
||||
defaultCommandTimeout: 10000,
|
||||
},
|
||||
() => {
|
||||
const today = moment(new Date()).format("YYYY-MM-DD");
|
||||
const jobLines = job2.joblines.data.filter(
|
||||
(line) => line.part_type === "PAS" || line.part_type === "PAE"
|
||||
);
|
||||
const linesTotal = jobLines.reduce(
|
||||
(prev, line) => prev + line.act_price,
|
||||
0
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
cy.viewport(1280, 720);
|
||||
@@ -282,7 +290,7 @@ describe.only(
|
||||
cy.get('[data-cy="tab-partssublet"]').should("be.visible").click();
|
||||
});
|
||||
|
||||
it.only("validates auto reconciliation through posting bill", () => {
|
||||
it("validates auto reconciliation through posting bill", () => {
|
||||
// Find the first row in the parts order
|
||||
cy.get('[data-cy="part-orders-table"]')
|
||||
.find(".ant-table-tbody")
|
||||
@@ -300,7 +308,7 @@ describe.only(
|
||||
cy.get('[data-cy="bill-form-invoice"]').type(uuid());
|
||||
|
||||
cy.get("#bill-form-date").click();
|
||||
cy.get(`[title="${today}"]`).should("be.visible").click();
|
||||
cy.get(`[title="${today}"]`).should("be.visible").click({ force: true });
|
||||
|
||||
cy.get('[data-cy="bill-line-table"]').each(($row) => {
|
||||
// get retail amount
|
||||
@@ -338,22 +346,28 @@ describe.only(
|
||||
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("@retailPrice")
|
||||
.invoke("val")
|
||||
.then((val) => {
|
||||
const discrepancy = linesTotal - Number(val);
|
||||
|
||||
cy.get("#retailtotal").should("have.text", `$${val}`);
|
||||
|
||||
cy.get(".discrepancy").each(($statistic) => {
|
||||
cy.wrap($statistic).should(
|
||||
"have.text",
|
||||
Dinero({
|
||||
amount: discrepancy,
|
||||
precision: 0,
|
||||
}).toFormat()
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
// TODO get total of discrepancy
|
||||
|
||||
// cy.get(".discrepancy").each(($statistic) => {
|
||||
// cy.wrap($statistic).should("have.text", "$0.00");
|
||||
// });
|
||||
});
|
||||
|
||||
it("returning item and validating statistics", () => {
|
||||
it.only("returning item and validating statistics", () => {
|
||||
cy.get('[data-cy="bills-table"]')
|
||||
.find(".ant-table-tbody")
|
||||
.find("> tr:not(.ant-table-measure-row)")
|
||||
@@ -368,20 +382,23 @@ describe.only(
|
||||
|
||||
cy.get('[data-cy="billline-checkbox"]').check();
|
||||
cy.get('[data-cy="billline-return-items-ok-button"]').click();
|
||||
|
||||
cy.get("#order-quantity").type("1", { force: true, multiple: true });
|
||||
cy.get('[data-cy="part-order-select-none"]').click({
|
||||
multiple: true,
|
||||
force: true,
|
||||
});
|
||||
cy.get('[data-cy="order-part-submit"]').click({
|
||||
multiple: true,
|
||||
force: true,
|
||||
});
|
||||
|
||||
cy.get("#totalReturns").should("have.text", "$83.87");
|
||||
cy.get("#calculatedcreditsnotreceived").should("have.text", "$83.87");
|
||||
cy.get("#creditsnotreceived").should("have.text", "$83.87");
|
||||
cy.get('[data-cy="billline-actual-price"]')
|
||||
.find(".ant-form-item-control-input-content")
|
||||
.invoke("text")
|
||||
.then((value) => {
|
||||
cy.get("#order-quantity").type("1", { force: true, multiple: true });
|
||||
cy.get('[data-cy="part-order-select-none"]').click({
|
||||
multiple: true,
|
||||
force: true,
|
||||
});
|
||||
cy.get('[data-cy="order-part-submit"]').click({
|
||||
multiple: true,
|
||||
force: true,
|
||||
});
|
||||
cy.get("#totalReturns").should("have.text", value);
|
||||
cy.get("#calculatedcreditsnotreceived").should("have.text", value);
|
||||
cy.get("#creditsnotreceived").should("have.text", value);
|
||||
});
|
||||
});
|
||||
|
||||
it("receives credit memo without return part", () => {
|
||||
|
||||
Reference in New Issue
Block a user