IO-2327 updated test cases for intake checklist

This commit is contained in:
swtmply
2023-07-29 17:21:00 +08:00
parent 8b4ce18409
commit d12ff11deb
3 changed files with 33 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ import job from "../../fixtures/jobs/job-3.json";
describe(
"Adding job to checklist",
{
defaultCommandTimeout: 5000,
defaultCommandTimeout: 10000,
},
() => {
beforeEach(() => {
@@ -43,8 +43,36 @@ describe(
// intakechecklist
const checklists = bodyshop.intakechecklist.form;
//console.log(checklists);
cy.get(".ant-slider-dot:eq(1)").click({ force: true });
checklists.forEach((item, index) => {
if (item.type === "text") {
cy.get('[data-cy="config-form-components"] > div')
.eq(index)
.find("input:text")
.type("Random Word");
} else if (item.type === "textarea") {
cy.get('[data-cy="config-form-components"] > div')
.eq(index)
.find("textarea")
.type("Random Word");
} else if (item.type === "checkbox") {
cy.get('[data-cy="config-form-components"] > div')
.eq(index)
.find("input:checkbox")
.check();
} else if (item.type === "slider") {
cy.get('[data-cy="config-form-components"] > div')
.eq(index)
.find(".ant-slider-dot:eq(1)")
.click({ force: true });
} else if (item.type === "rate") {
cy.get('[data-cy="config-form-components"] > div')
.eq(index)
.find(".ant-rate > li")
.eq(Math.floor(Math.random() * 4))
.find("div[role='radio']")
.click({ force: true });
}
});
});
});

View File

@@ -3,7 +3,7 @@ import FormTypes from "./config-form-types";
export default function ConfirmFormComponents({ componentList, readOnly }) {
return (
<div>
<div data-cy="config-form-components">
{componentList.map((f, idx) => {
const Comp = FormTypes[f.type];

View File

@@ -32,6 +32,7 @@ export default function JobIntakeFormCheckboxComponent({ formItem, readOnly }) {
min={min || 0}
max={max || 10}
marks={marks}
style={{ marginBottom: 0, marginTop: 0 }}
/>
</Form.Item>
);