IO-2327 added some test cases on posting bills

This commit is contained in:
swtmply
2023-08-18 11:51:56 +08:00
parent 807dbf0248
commit e89145e85f
7 changed files with 170 additions and 13 deletions

View File

@@ -18,7 +18,7 @@ describe(
.should("not.have.class", "ant-table-placeholder");
});
it("order multiple parts for the job", () => {
it("order parts for the job", () => {
const today = moment(new Date()).format("YYYY-MM-DD");
cy.get("@active-jobs-table")
@@ -73,7 +73,7 @@ describe(
.contains("Ordered");
});
it.only("order parts for the job", () => {
it.only("order multiple parts for the job", () => {
const today = moment(new Date()).format("YYYY-MM-DD");
cy.get("@active-jobs-table")
@@ -110,6 +110,8 @@ describe(
cy.get("#deliver_by").click();
cy.get(`[title="${today}"]`).should("be.visible").click({ force: true });
cy.get('[data-cy="part-order-comments"]').type("testing from cypress");
cy.get('[data-cy="part-order-select-none"]').check();
cy.get('[data-cy="order-part-submit"]').should("not.be.disabled").click();

View File

@@ -5,7 +5,7 @@ import Dinero from "dinero.js";
const uuid = () => Cypress._.random(0, 1e6);
describe(
describe.only(
"Billing job parts orders",
{
defaultCommandTimeout: 10000,
@@ -35,12 +35,57 @@ describe(
.parent()
.find('[data-cy="active-job-link"]')
.click();
// Go to repair data tab
cy.get('[data-cy="tab-partssublet"]').should("be.visible").click();
});
it("receives a part bill", () => {
// Order a part
// Go to repair data tab
cy.get('[data-cy="tab-repairdata"]').should("be.visible").click();
// Click on filter parts only
cy.get('[data-cy="filter-parts-button"]')
.should("not.be.disabled")
.click();
// Select multiple rows
cy.get('[data-cy="repair-data-table"]')
.find(".ant-table-tbody")
.find("> tr:not(.ant-table-measure-row)")
.first()
.find(".ant-checkbox-input")
.click();
// Click Order Parts
cy.get('[data-cy="order-parts-button"]')
.should("not.be.disabled")
.click();
// Modal should be visible
cy.get('[data-cy="parts-order-modal"]').should("be.visible");
// Fill required fields
cy.get(".ant-select-selection-search").find(`#vendorid`).click();
cy.get(`#vendorid_list`)
.next()
.find(".ant-select-item-option-content")
.first()
.click({ force: true });
cy.get("#deliver_by").click();
cy.get(`[title="${today}"]`).should("be.visible").click({ force: true });
cy.get('[data-cy="part-order-comments"]').type("testing from cypress");
cy.get('[data-cy="part-order-select-none"]').check();
cy.get('[data-cy="order-part-submit"]').should("not.be.disabled").click();
cy.get(".ant-notification-notice-message").contains(
"Parts order created successfully."
);
cy.get('[data-cy="repair-data-table"]')
.find(".ant-table-tbody")
.find("> tr:not(.ant-table-measure-row)")
.first()
.find(".ant-table-cell")
.eq(15)
.contains("Ordered");
cy.get('[data-cy="tab-partssublet"]').should("be.visible").click();
// Find the first row in the parts order
cy.get('[data-cy="part-orders-table"]')
.find(".ant-table-tbody")
@@ -55,7 +100,6 @@ describe(
.click();
// fill out form
// data-cy="bill-form-invoice"
cy.get('[data-cy="bill-form-invoice"]').type(uuid());
cy.get("#bill-form-date").click();
@@ -90,9 +134,100 @@ describe(
cy.get(".ant-notification-notice-message").contains(
"Invoice added successfully."
);
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()
.find(".ant-table-cell")
.eq(15)
.contains("Received");
});
it("backorders part from order", () => {
cy.get('[data-cy="tab-partssublet"]').should("be.visible").click();
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="view-part-order-button"]')
.click();
cy.get('[data-cy="mark-backorder-button"]').click();
cy.get(".backorder-date").click();
cy.get(`[title="${today}"]`).should("be.visible").click({ force: true });
cy.get('[data-cy="mark-for-backorder-button"]').click();
cy.get(".ant-drawer-close").click();
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()
.find(".ant-table-cell")
.eq(15)
.contains("Backordered");
});
it.only("order parts inhouse", () => {
cy.get('[data-cy="tab-repairdata"]').should("be.visible").click();
// Click on filter parts only
cy.get('[data-cy="filter-parts-button"]')
.should("not.be.disabled")
.click();
// Select multiple rows
cy.get('[data-cy="repair-data-table"]')
.find(".ant-table-tbody")
.find("> tr:not(.ant-table-measure-row)")
.first()
.find(".ant-checkbox-input")
.click();
// Click Order Parts
cy.get('[data-cy="order-parts-inhouse-button"]')
.should("not.be.disabled")
.click();
cy.antdSelect("bill-vendor");
cy.antdSelect("bill-cost-center");
cy.get('[data-cy="bill-form-save-button"]').click({ force: true });
cy.get(".ant-notification-notice-message").contains(
"Invoice added successfully."
);
cy.get('[data-cy="repair-data-table"]')
.find(".ant-table-tbody")
.find("> tr:not(.ant-table-measure-row)")
.first()
.find(".ant-table-cell")
.eq(15)
.contains("Received");
});
it("posts bill directly", () => {
cy.get('[data-cy="tab-partssublet"]').should("be.visible").click();
cy.get('[data-cy="bills-post-button"]').should("be.visible").click();
// Add New Line
@@ -144,6 +279,8 @@ describe(
});
it("posts a bill with save and new", () => {
cy.get('[data-cy="tab-partssublet"]').should("be.visible").click();
cy.get('[data-cy="bills-post-button"]').should("be.visible").click();
// Add New Line
@@ -197,6 +334,8 @@ describe(
});
it("uploads a document to a bill", () => {
cy.get('[data-cy="tab-partssublet"]').should("be.visible").click();
cy.get('[data-cy="bills-table"]')
.find(".ant-table-tbody")
.find("> tr:not(.ant-table-measure-row)")
@@ -216,6 +355,8 @@ describe(
});
it("marks bill as exported", () => {
cy.get('[data-cy="tab-partssublet"]').should("be.visible").click();
cy.get('[data-cy="bills-table"]')
.find(".ant-table-tbody")
.find("> tr:not(.ant-table-measure-row)")
@@ -242,6 +383,8 @@ describe(
});
it("marks bill for re-export", () => {
cy.get('[data-cy="tab-partssublet"]').should("be.visible").click();
cy.get('[data-cy="bills-table"]')
.find(".ant-table-tbody")
.find("> tr:not(.ant-table-measure-row)")