IO-2327 parts ordering send by email
This commit is contained in:
69
client/cypress/e2e/parts-ordering/parts-ordering.cy.js
Normal file
69
client/cypress/e2e/parts-ordering/parts-ordering.cy.js
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -497,6 +497,7 @@ export function JobLinesComponent({
|
|||||||
{selectedLines.length > 0 && ` (${selectedLines.length})`}
|
{selectedLines.length > 0 && ` (${selectedLines.length})`}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
data-cy="order-parts-button"
|
||||||
disabled={
|
disabled={
|
||||||
(job && !job.converted) ||
|
(job && !job.converted) ||
|
||||||
(selectedLines.length > 0 ? false : true) ||
|
(selectedLines.length > 0 ? false : true) ||
|
||||||
@@ -526,6 +527,7 @@ export function JobLinesComponent({
|
|||||||
{selectedLines.length > 0 && ` (${selectedLines.length})`}
|
{selectedLines.length > 0 && ` (${selectedLines.length})`}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
data-cy="filter-parts-button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setState((state) => ({
|
setState((state) => ({
|
||||||
...state,
|
...state,
|
||||||
@@ -575,6 +577,7 @@ export function JobLinesComponent({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Table
|
<Table
|
||||||
|
data-cy="repair-data-table"
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
loading={loading}
|
loading={loading}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export function PartsOrderModalComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div data-cy="parts-order-modal">
|
||||||
<Form.Item name="returnfrombill" style={{ display: "none" }}>
|
<Form.Item name="returnfrombill" style={{ display: "none" }}>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -98,6 +98,7 @@ export function PartsOrderModalComponent({
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="deliver_by"
|
name="deliver_by"
|
||||||
|
id="deliver_by"
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@@ -122,7 +123,7 @@ export function PartsOrderModalComponent({
|
|||||||
label={t("parts_orders.labels.removefrompartsqueue")}
|
label={t("parts_orders.labels.removefrompartsqueue")}
|
||||||
valuePropName="checked"
|
valuePropName="checked"
|
||||||
>
|
>
|
||||||
<Checkbox />
|
<Checkbox data-cy="part-order-checkbox-remove" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
{OEConnection.treatment === "on" && !isReturn && (
|
{OEConnection.treatment === "on" && !isReturn && (
|
||||||
@@ -131,7 +132,7 @@ export function PartsOrderModalComponent({
|
|||||||
label={t("parts_orders.labels.is_quote")}
|
label={t("parts_orders.labels.is_quote")}
|
||||||
valuePropName="checked"
|
valuePropName="checked"
|
||||||
>
|
>
|
||||||
<Checkbox />
|
<Checkbox data-cy="part-order-checkbox-quote" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ export function PartsOrderModalContainer({
|
|||||||
}
|
}
|
||||||
onCancel={() => toggleModalVisible()}
|
onCancel={() => toggleModalVisible()}
|
||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
okButtonProps={{ loading: saving }}
|
okButtonProps={{ loading: saving, "data-cy": "order-part-submit" }}
|
||||||
cancelButtonProps={{ loading: saving }}
|
cancelButtonProps={{ loading: saving }}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
width="75%"
|
width="75%"
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ const VendorSearchSelect = (
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
|
id="vendor"
|
||||||
|
className="ant-select-vendor"
|
||||||
ref={ref}
|
ref={ref}
|
||||||
showSearch
|
showSearch
|
||||||
value={option}
|
value={option}
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ export function JobsDetailPage({
|
|||||||
<Tabs.TabPane
|
<Tabs.TabPane
|
||||||
forceRender
|
forceRender
|
||||||
tab={
|
tab={
|
||||||
<span>
|
<span data-cy="tab-repairdata">
|
||||||
<BarsOutlined />
|
<BarsOutlined />
|
||||||
{t("menus.jobsdetail.repairdata")}
|
{t("menus.jobsdetail.repairdata")}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user