IO-2327 posting bills test cases

This commit is contained in:
swtmply
2023-08-11 20:08:43 +08:00
parent 7b8691935d
commit 413af6eb7c
3 changed files with 45 additions and 14 deletions

View File

@@ -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"]')
.find(".ant-table-tbody")
.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(`.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("#totalReturns")
.invoke("text")
.then((value) => {
// TODO check if negative transform to 0
const totalReturns =
Number(value.substring(1)) - priceSum < 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
cy.get('[data-cy="part-orders-table"]')
.find(".ant-table-tbody")
@@ -534,6 +550,13 @@ describe.only(
.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) => {
const totals = cells.toArray().map((el) => Number(el.value));
const sum = Cypress._.sum(totals);
@@ -557,10 +580,27 @@ describe.only(
});
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();
// 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
cy.get("#calculatedcreditsnotreceived").should("have.text", "$0.00");

View File

@@ -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(
"insertAvailableJob",
({ bodyshopid, job, job_est_data, token }) => {

View File

@@ -304,7 +304,7 @@ export function BillFormComponent({
}),
]}
>
<Switch />
<Switch data-cy="is-credit-memo-switch" />
</Form.Item>
<Form.Item
data-cy="bill-form-bill-total"