slider test component
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import job from "../../fixtures/jobs/job-3.json";
|
||||||
|
|
||||||
describe(
|
describe(
|
||||||
"Adding job to checklist",
|
"Adding job to checklist",
|
||||||
{
|
{
|
||||||
@@ -5,20 +7,44 @@ describe(
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.visit("/manage");
|
cy.visit("/manage/jobs");
|
||||||
|
|
||||||
cy.get("body").then(($body) => {
|
cy.intercept("POST", Cypress.env("graphql_dev_endpoint"), (req) => {
|
||||||
if ($body.text().includes("Login")) {
|
if (req.body.operationName === "QUERY_BODYSHOP") {
|
||||||
// Log in
|
req.alias = "bodyshop";
|
||||||
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")
|
cy.get('[data-cy="active-jobs-table"]')
|
||||||
.should("be.visible")
|
.find(".ant-table-tbody")
|
||||||
.find("tr")
|
.find("> tr:not(.ant-table-measure-row)")
|
||||||
.should("not.have.class", "ant-table-placeholder");
|
.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();
|
||||||
|
});
|
||||||
|
|
||||||
|
it.only("tests the form", () => {
|
||||||
|
cy.get('[data-cy="job-actions-button"]').click();
|
||||||
|
// Go to intake
|
||||||
|
cy.get('[data-cy="job-intake-button"]').should("not.be.disabled").click();
|
||||||
|
cy.url().should("include", "/intake");
|
||||||
|
// Fill out the form
|
||||||
|
cy.get('[data-cy="checklist-form"]').should("be.visible");
|
||||||
|
|
||||||
|
cy.wait("@bodyshop").then(({ response }) => {
|
||||||
|
const bodyshop = response.body.data.bodyshops[0];
|
||||||
|
|
||||||
|
// intakechecklist
|
||||||
|
const checklists = bodyshop.intakechecklist.form;
|
||||||
|
|
||||||
|
//console.log(checklists);
|
||||||
|
cy.get(".ant-slider-dot:eq(1)").click({ force: true });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -491,7 +491,9 @@ describe(
|
|||||||
cy.get("#towin").should("have.class", "ant-switch").click();
|
cy.get("#towin").should("have.class", "ant-switch").click();
|
||||||
|
|
||||||
cy.get('[data-cy="convert-button"]').click();
|
cy.get('[data-cy="convert-button"]').click();
|
||||||
cy.get(".ant-notification-notice-message").contains("successfully");
|
cy.get(".ant-notification-notice-message").contains(
|
||||||
|
"Job converted successfully."
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,18 @@ import React from "react";
|
|||||||
export default function JobIntakeFormCheckboxComponent({ formItem, readOnly }) {
|
export default function JobIntakeFormCheckboxComponent({ formItem, readOnly }) {
|
||||||
const { name, label, required, min, max } = formItem;
|
const { name, label, required, min, max } = formItem;
|
||||||
|
|
||||||
|
const marks = {
|
||||||
|
[min]: {
|
||||||
|
label: <span style={{ height: 0 }}> </span>,
|
||||||
|
},
|
||||||
|
[max / 2]: {
|
||||||
|
label: <span style={{ height: 0 }}> </span>,
|
||||||
|
},
|
||||||
|
[max]: {
|
||||||
|
label: <span style={{ height: 0 }}> </span>,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name={name}
|
name={name}
|
||||||
@@ -15,7 +27,12 @@ export default function JobIntakeFormCheckboxComponent({ formItem, readOnly }) {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Slider disabled={readOnly} min={min || 0} max={max || 10} />
|
<Slider
|
||||||
|
disabled={readOnly}
|
||||||
|
min={min || 0}
|
||||||
|
max={max || 10}
|
||||||
|
marks={marks}
|
||||||
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user