IO-2327 posting bills tests cases
This commit is contained in:
@@ -52,10 +52,10 @@ describe(
|
||||
|
||||
// fill out form
|
||||
// data-cy="bill-form-invoice"
|
||||
cy.get('[data-cy="bill-form-invoice"]').type(uniqueId());
|
||||
cy.get('[data-cy="bill-form-invoice"]').type(uniqueId("QBD246-00-"));
|
||||
|
||||
cy.get("#bill-form-date").click();
|
||||
cy.get('[title="2023-06-22"]').should("be.visible").click();
|
||||
cy.get('[title="2023-06-30"]').should("be.visible").click();
|
||||
|
||||
// get table
|
||||
cy.get('[data-cy="bill-line-table"]').each(($row) => {
|
||||
@@ -75,9 +75,7 @@ describe(
|
||||
});
|
||||
|
||||
// Click save
|
||||
cy.get('[data-cy="bill-form-save-button"]')
|
||||
.should("not.be.disabled")
|
||||
.click();
|
||||
cy.get('[data-cy="bill-form-save-button"]').click();
|
||||
|
||||
cy.get(".ant-notification-notice-message").contains(
|
||||
"Invoice added successfully."
|
||||
@@ -96,10 +94,10 @@ describe(
|
||||
// Select Line
|
||||
cy.antdSelect("bill-line", "-- Not On Estimate --");
|
||||
// Fill the Form
|
||||
cy.get('[data-cy="bill-form-invoice"]').type(uniqueId("DBP"));
|
||||
cy.get('[data-cy="bill-form-invoice"]').type(uniqueId("QBD246-01-"));
|
||||
|
||||
cy.get("#bill-form-date").click();
|
||||
cy.get('[title="2023-06-22"]').should("be.visible").click();
|
||||
cy.get('[title="2023-06-30"]').should("be.visible").click();
|
||||
|
||||
// get table
|
||||
cy.get('[data-cy="bill-line-table"]').each(($row) => {
|
||||
@@ -119,9 +117,7 @@ describe(
|
||||
});
|
||||
|
||||
// Click save
|
||||
cy.get('[data-cy="bill-form-save-button"]')
|
||||
.should("not.be.disabled")
|
||||
.click();
|
||||
cy.get('[data-cy="bill-form-save-button"]').click();
|
||||
|
||||
cy.get(".ant-notification-notice-message").contains(
|
||||
"Invoice added successfully."
|
||||
@@ -140,10 +136,10 @@ describe(
|
||||
// Select Line
|
||||
cy.antdSelect("bill-line", "-- Not On Estimate --");
|
||||
// Fill the Form
|
||||
cy.get('[data-cy="bill-form-invoice"]').type(uniqueId("DBP"));
|
||||
cy.get('[data-cy="bill-form-invoice"]').type(uniqueId("QBD246-02-"));
|
||||
|
||||
cy.get("#bill-form-date").click();
|
||||
cy.get('[title="2023-06-22"]').should("be.visible").click();
|
||||
cy.get('[title="2023-06-30"]').should("be.visible").click();
|
||||
|
||||
// get table
|
||||
cy.get('[data-cy="bill-line-table"]').each(($row) => {
|
||||
@@ -190,5 +186,257 @@ describe(
|
||||
.find(".ant-upload #bill-document-upload")
|
||||
.selectFile("job.json", { force: true });
|
||||
});
|
||||
|
||||
it("marks bill as exported", () => {
|
||||
cy.get('[data-cy="bills-table"]')
|
||||
.find(".ant-table-tbody")
|
||||
.find("> tr:not(.ant-table-measure-row)")
|
||||
.as("bills-table")
|
||||
.should("not.have.class", "ant-table-placeholder");
|
||||
|
||||
cy.get("@bills-table")
|
||||
.find('[data-cy="bill-exported-checkbox"]')
|
||||
.not(":checked")
|
||||
.first()
|
||||
.as("export-status")
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.find('[data-cy="edit-bill-button"]')
|
||||
.click();
|
||||
|
||||
cy.location("search").should("include", "billid");
|
||||
cy.get('[data-cy="bill-mark-export-button"]')
|
||||
.as("mark-for-export")
|
||||
.click();
|
||||
cy.get("@mark-for-export").should("be.disabled");
|
||||
});
|
||||
|
||||
it("marks bill for re-export", () => {
|
||||
cy.get('[data-cy="bills-table"]')
|
||||
.find(".ant-table-tbody")
|
||||
.find("> tr:not(.ant-table-measure-row)")
|
||||
.as("bills-table")
|
||||
.should("not.have.class", "ant-table-placeholder");
|
||||
|
||||
cy.get("@bills-table")
|
||||
.find('[data-cy="bill-exported-checkbox"]')
|
||||
.filter(":checked")
|
||||
.first()
|
||||
.as("export-status")
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.find('[data-cy="edit-bill-button"]')
|
||||
.click();
|
||||
|
||||
cy.location("search").should("include", "billid");
|
||||
cy.get('[data-cy="bill-mark-reexport-button"]')
|
||||
.as("mark-for-reexport")
|
||||
.click();
|
||||
cy.get("@mark-for-reexport").should("be.disabled");
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
describe(
|
||||
"Validating and calculating bills",
|
||||
{
|
||||
defaultCommandTimeout: 5000,
|
||||
},
|
||||
() => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/manage");
|
||||
|
||||
cy.get("body").then(($body) => {
|
||||
if ($body.text().includes("Login")) {
|
||||
// Log in
|
||||
cy.get('[data-cy="username"]').type("john@imex.dev");
|
||||
cy.get('[data-cy="password"]').type("john123");
|
||||
cy.get('[data-cy="sign-in-button"]').click();
|
||||
}
|
||||
|
||||
cy.get(".ant-table-tbody")
|
||||
.should("be.visible")
|
||||
.find("tr")
|
||||
.should("not.have.class", "ant-table-placeholder");
|
||||
|
||||
cy.get(".ant-table-row").contains("QBD261").click();
|
||||
|
||||
cy.url().should("include", "/manage/jobs");
|
||||
|
||||
// Go to repair data tab
|
||||
cy.get('[data-cy="tab-partssublet"]').should("be.visible").click();
|
||||
});
|
||||
});
|
||||
|
||||
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")
|
||||
.find("> tr:not(.ant-table-measure-row)")
|
||||
.as("orders-table")
|
||||
.should("not.have.class", "ant-table-placeholder");
|
||||
|
||||
cy.get("@orders-table")
|
||||
.first()
|
||||
.should("be.visible")
|
||||
.find('[data-cy="receive-bill-button"]')
|
||||
.click();
|
||||
|
||||
// fill out form
|
||||
cy.get('[data-cy="bill-form-invoice"]').type(uniqueId("QBD261-0"));
|
||||
|
||||
cy.get("#bill-form-date").click();
|
||||
cy.get('[title="2023-06-30"]').should("be.visible").click();
|
||||
|
||||
cy.get('[data-cy="bill-form-bill-total"]').type("70.46");
|
||||
cy.get('[data-cy="bill-line-actual-cost"]').type("67.10");
|
||||
|
||||
cy.get("#bill-form-discrepancy").should("have.text", "$0.00");
|
||||
|
||||
// Click save
|
||||
cy.get('[data-cy="bill-form-save-button"]').click();
|
||||
|
||||
cy.get("#retailtotal").should("have.text", "$83.87");
|
||||
|
||||
cy.get(".discrepancy").each(($statistic) => {
|
||||
cy.wrap($statistic).should("have.text", "$0.00");
|
||||
});
|
||||
});
|
||||
|
||||
it("returning item and validating statistics", () => {
|
||||
cy.get('[data-cy="bills-table"]')
|
||||
.find(".ant-table-tbody")
|
||||
.find("> tr:not(.ant-table-measure-row)")
|
||||
.as("bills-table")
|
||||
.should("not.have.class", "ant-table-placeholder");
|
||||
|
||||
cy.get("@bills-table")
|
||||
.first()
|
||||
.should("not.be.disabled")
|
||||
.find('[data-cy="return-items-button"]')
|
||||
.click();
|
||||
|
||||
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");
|
||||
});
|
||||
|
||||
it("receives credit memo without return part", () => {
|
||||
// Find the first row in the parts order
|
||||
cy.get('[data-cy="part-orders-table"]')
|
||||
.find(".ant-table-tbody")
|
||||
.find("> tr:not(.ant-table-measure-row)")
|
||||
.as("orders-table")
|
||||
.should("not.have.class", "ant-table-placeholder");
|
||||
|
||||
cy.get("@orders-table")
|
||||
.find('[data-cy="part-order-return-checkbox"]')
|
||||
.filter(":checked")
|
||||
.first()
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.find('[data-cy="receive-bill-button"]')
|
||||
.click();
|
||||
|
||||
// fill out form
|
||||
cy.get('[data-cy="bill-form-invoice"]').type(uniqueId("QBD261-01-"));
|
||||
|
||||
cy.get("#bill-form-date").click();
|
||||
cy.get('[title="2023-06-30"]').should("be.visible").click();
|
||||
|
||||
cy.get('[data-cy="bill-form-bill-total"]').type("70.46");
|
||||
cy.get('[data-cy="bill-line-actual-cost"]').type("67.10");
|
||||
|
||||
cy.get("#bill-form-discrepancy").should("have.text", "$0.00");
|
||||
|
||||
// Click save
|
||||
cy.get('[data-cy="bill-form-save-button"]').click();
|
||||
|
||||
cy.get("#totalReturns").should("have.text", "$83.87");
|
||||
cy.get("#calculatedcreditsnotreceived").should("have.text", "$0.00");
|
||||
cy.get("#creditsnotreceived").should("have.text", "$83.87");
|
||||
});
|
||||
|
||||
it("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")
|
||||
.find("> tr:not(.ant-table-measure-row)")
|
||||
.as("orders-table")
|
||||
.should("not.have.class", "ant-table-placeholder");
|
||||
|
||||
cy.get("@orders-table")
|
||||
.find('[data-cy="part-order-return-checkbox"]')
|
||||
.filter(":checked")
|
||||
.first()
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.find('[data-cy="receive-bill-button"]')
|
||||
.click();
|
||||
|
||||
// fill out form
|
||||
cy.get('[data-cy="bill-form-invoice"]').type(uniqueId("QBD261-02-"));
|
||||
|
||||
cy.get("#bill-form-date").click();
|
||||
cy.get('[title="2023-06-30"]').should("be.visible").click();
|
||||
|
||||
cy.get('[data-cy="bill-form-bill-total"]').type("70.46");
|
||||
cy.get('[data-cy="bill-line-actual-cost"]').type("67.10");
|
||||
|
||||
cy.get("#bill-form-discrepancy").should("have.text", "$0.00");
|
||||
|
||||
cy.get('[data-cy="mark-as-received-checkbox"]').check();
|
||||
|
||||
// Click save
|
||||
cy.get('[data-cy="bill-form-save-button"]').click();
|
||||
|
||||
cy.get("#totalReturns").should("have.text", "$83.87");
|
||||
cy.get("#calculatedcreditsnotreceived").should("have.text", "$0.00");
|
||||
cy.get("#creditsnotreceived").should("have.text", "$0.00");
|
||||
});
|
||||
|
||||
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="filter-parts-button"]')
|
||||
.should("not.be.disabled")
|
||||
.click();
|
||||
|
||||
cy.get('[data-cy="repair-data-table"]')
|
||||
.find(".ant-table-tbody")
|
||||
.find("> tr:not(.ant-table-measure-row)")
|
||||
.first()
|
||||
.next()
|
||||
.find("td")
|
||||
.first()
|
||||
.click();
|
||||
|
||||
cy.get('[data-cy="parts-bills-order"]')
|
||||
.should("be.visible")
|
||||
.find("li")
|
||||
.first()
|
||||
.should("not.have.text", "This part has not yet been ordered.");
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user