70 lines
2.0 KiB
JavaScript
70 lines
2.0 KiB
JavaScript
describe(
|
|
"Ordering parts for the job",
|
|
{
|
|
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")
|
|
.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", () => {
|
|
// FIXME email preview not working
|
|
cy.get('[data-cy="part-order-checkbox-remove"]').check();
|
|
cy.get('[data-cy="order-part-submit"]').should("not.be.disabled").click();
|
|
|
|
cy.contains("Email Preview");
|
|
});
|
|
|
|
// TODO Send by PDF
|
|
// TODO Send by OEC
|
|
}
|
|
);
|