IO-2327 added some test cases on posting bills
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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)")
|
||||
|
||||
@@ -441,6 +441,7 @@ export function JobLinesComponent({
|
||||
</Tag>
|
||||
)}
|
||||
<Button
|
||||
data-cy="order-parts-inhouse-button"
|
||||
disabled={
|
||||
(job && !job.converted) ||
|
||||
(selectedLines.length > 0 ? false : true) ||
|
||||
|
||||
@@ -78,9 +78,13 @@ export function PartsOrderLineBackorderButton({
|
||||
<div>
|
||||
<Form form={form} onFinish={handleFinish}>
|
||||
<Form.Item name="eta">
|
||||
<FormDatePicker />
|
||||
<FormDatePicker className="backorder-date" />
|
||||
</Form.Item>
|
||||
<Button type="primary" onClick={() => form.submit()}>
|
||||
<Button
|
||||
data-cy="mark-for-backorder-button"
|
||||
type="primary"
|
||||
onClick={() => form.submit()}
|
||||
>
|
||||
{t("parts_orders.actions.backordered")}
|
||||
</Button>
|
||||
<Button onClick={() => setVisibility(false)}>Close</Button>
|
||||
@@ -95,7 +99,11 @@ export function PartsOrderLineBackorderButton({
|
||||
visible={visibility}
|
||||
disabled={disabled}
|
||||
>
|
||||
<Button loading={loading} onClick={handlePopover}>
|
||||
<Button
|
||||
data-cy="mark-backorder-button"
|
||||
loading={loading}
|
||||
onClick={handlePopover}
|
||||
>
|
||||
{isAlreadyBackordered
|
||||
? t("parts_orders.actions.receive")
|
||||
: t("parts_orders.actions.backordered")}
|
||||
|
||||
@@ -90,7 +90,10 @@ export function PartsOrderListTableComponent({
|
||||
const recordActions = (record, showView = false) => (
|
||||
<Space wrap>
|
||||
{showView && (
|
||||
<Button onClick={() => handleOnRowClick(record)}>
|
||||
<Button
|
||||
data-cy="view-part-order-button"
|
||||
onClick={() => handleOnRowClick(record)}
|
||||
>
|
||||
<EyeFilled />
|
||||
</Button>
|
||||
)}
|
||||
|
||||
@@ -321,7 +321,7 @@ export function PartsOrderModalComponent({
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Input.TextArea rows={3} />
|
||||
<Input.TextArea rows={3} data-cy="part-order-comments" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item noStyle shouldUpdate>
|
||||
|
||||
@@ -362,7 +362,7 @@ export function PartsOrderModalContainer({
|
||||
cancelButtonProps={{ loading: saving }}
|
||||
destroyOnClose
|
||||
width="75%"
|
||||
forceRender
|
||||
// forceRender
|
||||
>
|
||||
{error ? <AlertComponent message={error.message} type="error" /> : null}
|
||||
<Form
|
||||
|
||||
Reference in New Issue
Block a user