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)")
|
||||||
@@ -476,12 +476,28 @@ describe.only(
|
|||||||
|
|
||||||
cy.get("#bill-form-discrepancy").should("have.text", "$0.00");
|
cy.get("#bill-form-discrepancy").should("have.text", "$0.00");
|
||||||
|
|
||||||
|
cy.get(`.ant-select-bill-cost-center > .ant-select-selector`).each(
|
||||||
|
(select) => {
|
||||||
|
cy.wrap(select).click();
|
||||||
|
|
||||||
|
cy.wrap(select)
|
||||||
|
.find("input")
|
||||||
|
.invoke("attr", "id")
|
||||||
|
.then((id) => {
|
||||||
|
cy.get(`#${id}_list`)
|
||||||
|
.next()
|
||||||
|
.find(".ant-select-item-option-content")
|
||||||
|
.first()
|
||||||
|
.click({ force: true });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
cy.get('[data-cy="bill-form-save-button"]').click();
|
cy.get('[data-cy="bill-form-save-button"]').click();
|
||||||
|
|
||||||
cy.get("#totalReturns")
|
cy.get("#totalReturns")
|
||||||
.invoke("text")
|
.invoke("text")
|
||||||
.then((value) => {
|
.then((value) => {
|
||||||
// TODO check if negative transform to 0
|
|
||||||
const totalReturns =
|
const totalReturns =
|
||||||
Number(value.substring(1)) - priceSum < 0
|
Number(value.substring(1)) - priceSum < 0
|
||||||
? 0
|
? 0
|
||||||
@@ -499,7 +515,7 @@ describe.only(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
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")
|
||||||
@@ -534,6 +550,13 @@ describe.only(
|
|||||||
.click({ multiple: true });
|
.click({ multiple: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO Credit memo should be checked
|
||||||
|
cy.get('[data-cy="is-credit-memo-switch"]').should(
|
||||||
|
"have.attr",
|
||||||
|
"aria-checked",
|
||||||
|
"true"
|
||||||
|
);
|
||||||
|
|
||||||
cy.get('[data-cy="bill-line-actual-cost"]').then((cells) => {
|
cy.get('[data-cy="bill-line-actual-cost"]').then((cells) => {
|
||||||
const totals = cells.toArray().map((el) => Number(el.value));
|
const totals = cells.toArray().map((el) => Number(el.value));
|
||||||
const sum = Cypress._.sum(totals);
|
const sum = Cypress._.sum(totals);
|
||||||
@@ -557,10 +580,27 @@ describe.only(
|
|||||||
});
|
});
|
||||||
cy.get("#bill-form-discrepancy").should("have.text", "$0.00");
|
cy.get("#bill-form-discrepancy").should("have.text", "$0.00");
|
||||||
|
|
||||||
|
cy.get(`.ant-select-bill-cost-center > .ant-select-selector`).each(
|
||||||
|
(select) => {
|
||||||
|
cy.wrap(select).click();
|
||||||
|
|
||||||
|
cy.wrap(select)
|
||||||
|
.find("input")
|
||||||
|
.invoke("attr", "id")
|
||||||
|
.then((id) => {
|
||||||
|
cy.get(`#${id}_list`)
|
||||||
|
.next()
|
||||||
|
.find(".ant-select-item-option-content")
|
||||||
|
.first()
|
||||||
|
.click({ force: true });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
cy.get('[data-cy="mark-as-received-checkbox"]').check();
|
cy.get('[data-cy="mark-as-received-checkbox"]').check();
|
||||||
|
|
||||||
// Click save
|
// Click save
|
||||||
cy.get('[data-cy="bill-form-save-button"]').click();
|
// cy.get('[data-cy="bill-form-save-button"]').click();
|
||||||
|
|
||||||
// TODO add assertion to the total
|
// TODO add assertion to the total
|
||||||
cy.get("#calculatedcreditsnotreceived").should("have.text", "$0.00");
|
cy.get("#calculatedcreditsnotreceived").should("have.text", "$0.00");
|
||||||
|
|||||||
@@ -74,15 +74,6 @@ Cypress.Commands.add("antdSelect", (selector, filter) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("antdFormSelect", (name, text, cb) => {
|
|
||||||
cy.get(".ant-form-item-required").then(($field) => {
|
|
||||||
if ($field.text().includes(text)) {
|
|
||||||
if (name) cy.antdSelect(name);
|
|
||||||
cb?.();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
"insertAvailableJob",
|
"insertAvailableJob",
|
||||||
({ bodyshopid, job, job_est_data, token }) => {
|
({ bodyshopid, job, job_est_data, token }) => {
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ export function BillFormComponent({
|
|||||||
}),
|
}),
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Switch />
|
<Switch data-cy="is-credit-memo-switch" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
data-cy="bill-form-bill-total"
|
data-cy="bill-form-bill-total"
|
||||||
|
|||||||
Reference in New Issue
Block a user