diff --git a/client/cypress/e2e/posting-bills/posting-bills.cy.js b/client/cypress/e2e/posting-bills/posting-bills.cy.js
index 2cea4a214..a98f7e7ee 100644
--- a/client/cypress/e2e/posting-bills/posting-bills.cy.js
+++ b/client/cypress/e2e/posting-bills/posting-bills.cy.js
@@ -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");
diff --git a/client/cypress/support/commands.js b/client/cypress/support/commands.js
index e0c6ed0f9..1eba6d6a5 100644
--- a/client/cypress/support/commands.js
+++ b/client/cypress/support/commands.js
@@ -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 }) => {
diff --git a/client/src/components/bill-form/bill-form.component.jsx b/client/src/components/bill-form/bill-form.component.jsx
index d80b435e9..5593ed25e 100644
--- a/client/src/components/bill-form/bill-form.component.jsx
+++ b/client/src/components/bill-form/bill-form.component.jsx
@@ -304,7 +304,7 @@ export function BillFormComponent({
}),
]}
>
-