IO-2327 part ordering test cases
This commit is contained in:
@@ -1,69 +1,79 @@
|
|||||||
|
import job from "../../fixtures/jobs/job-3.json";
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
describe(
|
describe(
|
||||||
"Ordering parts for the job",
|
"Ordering parts for the job",
|
||||||
{
|
{
|
||||||
defaultCommandTimeout: 5000,
|
defaultCommandTimeout: 5000,
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
beforeEach(() => {
|
it("order parts for the job", () => {
|
||||||
cy.visit("/manage");
|
const today = moment(new Date()).format("YYYY-MM-DD");
|
||||||
|
|
||||||
cy.get("body").then(($body) => {
|
cy.visit("/manage/jobs");
|
||||||
if ($body.text().includes("Login")) {
|
|
||||||
// Log in
|
cy.intercept("POST", Cypress.env("graphql_dev_endpoint"), (req) => {
|
||||||
cy.get('[data-cy="username"]').type("john@imex.dev");
|
if (req.body.operationName === "QUERY_BODYSHOP") {
|
||||||
cy.get('[data-cy="password"]').type("john123");
|
req.alias = "bodyshop";
|
||||||
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")
|
|
||||||
.not(':contains("Open")')
|
|
||||||
.first()
|
|
||||||
.find("a")
|
|
||||||
.first()
|
|
||||||
.click();
|
|
||||||
|
|
||||||
cy.url().should("include", "/manage/jobs");
|
|
||||||
|
|
||||||
// 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.antdFormSelect("vendor", "Vendor");
|
|
||||||
cy.get("#deliver_by").click();
|
|
||||||
cy.get('[title="2023-06-21"]').should("be.visible").click();
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it("sending by email", () => {
|
cy.get('[data-cy="active-jobs-table"]')
|
||||||
// FIXME email preview not working
|
.find(".ant-table-tbody")
|
||||||
cy.get('[data-cy="part-order-checkbox-remove"]').check();
|
.find("> tr:not(.ant-table-measure-row)")
|
||||||
|
.as("active-jobs-table")
|
||||||
|
.should("not.have.class", "ant-table-placeholder");
|
||||||
|
|
||||||
|
cy.get("@active-jobs-table")
|
||||||
|
.contains(job.clm_no)
|
||||||
|
.first()
|
||||||
|
.parent()
|
||||||
|
.find('[data-cy="active-job-link"]')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// 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-select-none"]').check();
|
||||||
cy.get('[data-cy="order-part-submit"]').should("not.be.disabled").click();
|
cy.get('[data-cy="order-part-submit"]').should("not.be.disabled").click();
|
||||||
|
|
||||||
cy.contains("Email Preview");
|
cy.get(".ant-notification-notice-message").contains(
|
||||||
});
|
"Parts order created successfully."
|
||||||
|
);
|
||||||
|
|
||||||
// TODO Send by PDF
|
cy.get('[data-cy="repair-data-table"]')
|
||||||
// TODO Send by OEC
|
.find(".ant-table-tbody")
|
||||||
|
.find("> tr:not(.ant-table-measure-row)")
|
||||||
|
.first()
|
||||||
|
.find(".ant-table-cell")
|
||||||
|
.eq(15)
|
||||||
|
.contains("Ordered");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user