slider test component
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import job from "../../fixtures/jobs/job-3.json";
|
||||
|
||||
describe(
|
||||
"Adding job to checklist",
|
||||
{
|
||||
@@ -5,20 +7,44 @@ describe(
|
||||
},
|
||||
() => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/manage");
|
||||
cy.visit("/manage/jobs");
|
||||
|
||||
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.intercept("POST", Cypress.env("graphql_dev_endpoint"), (req) => {
|
||||
if (req.body.operationName === "QUERY_BODYSHOP") {
|
||||
req.alias = "bodyshop";
|
||||
}
|
||||
});
|
||||
|
||||
cy.get(".ant-table-tbody")
|
||||
.should("be.visible")
|
||||
.find("tr")
|
||||
.should("not.have.class", "ant-table-placeholder");
|
||||
cy.get('[data-cy="active-jobs-table"]')
|
||||
.find(".ant-table-tbody")
|
||||
.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();
|
||||
});
|
||||
|
||||
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('[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 }) {
|
||||
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 (
|
||||
<Form.Item
|
||||
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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user