IO-2327 Intake checklist tests

This commit is contained in:
swtmply
2023-06-20 09:12:36 +08:00
parent aa064cc573
commit 7ae48db212
5 changed files with 183 additions and 11 deletions

View File

@@ -16,7 +16,7 @@ export default function JobIntakeFormCheckboxComponent({ formItem, readOnly }) {
},
]}
>
<Checkbox disabled={readOnly} />
<Checkbox data-cy="checklist-item-checkbox" disabled={readOnly} />
</Form.Item>
);
}

View File

@@ -199,6 +199,7 @@ export function JobChecklistForm({
extra={
!readOnly && (
<Button
data-cy="checklist-submit-button"
loading={loading}
type="primary"
onClick={() => form.submit()}
@@ -209,6 +210,7 @@ export function JobChecklistForm({
}
>
<Form
data-cy="checklist-form"
form={form}
onFinish={handleFinish}
initialValues={{
@@ -256,7 +258,7 @@ export function JobChecklistForm({
label={t("checklist.labels.addtoproduction")}
disabled={readOnly}
>
<Switch disabled={readOnly} />
<Switch data-cy="add-to-production-switch" disabled={readOnly} />
</Form.Item>
<Form.Item
name="allow_text_message"
@@ -292,7 +294,11 @@ export function JobChecklistForm({
disabled={readOnly}
trigger="onChange"
>
<Input.TextArea rows={3} disabled={readOnly} />
<Input.TextArea
data-cy="checklist-production-note"
rows={3}
disabled={readOnly}
/>
</Form.Item>
</div>
)}
@@ -324,7 +330,11 @@ export function JobChecklistForm({
label={t("checklist.labels.removefromproduction")}
disabled={readOnly}
>
<Switch disabled={readOnly} defaultChecked={true} />
<Switch
data-cy="remove-from-production"
disabled={readOnly}
defaultChecked={true}
/>
</Form.Item>
</div>
)}

View File

@@ -196,6 +196,7 @@ export function JobsDetailHeaderActions({
</Popover>
</Menu.Item>
<Menu.Item
data-cy="job-intake-button"
disabled={
!!job.intakechecklist ||
!jobInPreProduction ||
@@ -214,7 +215,7 @@ export function JobsDetailHeaderActions({
</Link>
)}
</Menu.Item>
<Menu.Item disabled={!jobInProduction || jobRO}>
<Menu.Item data-cy="job-deliver" disabled={!jobInProduction || jobRO}>
{!jobInProduction ? (
t("jobs.actions.deliver")
) : (
@@ -223,7 +224,7 @@ export function JobsDetailHeaderActions({
</Link>
)}
</Menu.Item>
<Menu.Item disabled={!job.converted}>
<Menu.Item data-cy="job-checklist" disabled={!job.converted}>
<Link to={`/manage/jobs/${job.id}/checklist`}>
{t("jobs.actions.viewchecklist")}
</Link>
@@ -517,7 +518,7 @@ export function JobsDetailHeaderActions({
);
return (
<Dropdown overlay={statusmenu} trigger={["click"]} key="changestatus">
<Button>
<Button data-cy="job-actions-button">
<span>{t("general.labels.actions")}</span>
<DownCircleFilled />

View File

@@ -81,7 +81,7 @@ export function JobsChecklistViewContainer({
</Typography.Title>
{data.jobs_by_pk.intakechecklist &&
data.jobs_by_pk.intakechecklist.form && (
<>
<span data-cy="intake-checklist">
<JobChecklistForm
formItems={
data.jobs_by_pk.intakechecklist &&
@@ -92,7 +92,7 @@ export function JobsChecklistViewContainer({
readOnly
/>
<CompletedBy checklist={data.jobs_by_pk.intakechecklist} />
</>
</span>
)}
</Col>
<Col span={12}>
@@ -101,7 +101,7 @@ export function JobsChecklistViewContainer({
</Typography.Title>
{data.jobs_by_pk.deliverchecklist &&
data.jobs_by_pk.deliverchecklist.form && (
<>
<span data-cy="deliver-checklist">
<JobChecklistForm
formItems={
data.jobs_by_pk.deliverchecklist &&
@@ -112,7 +112,7 @@ export function JobsChecklistViewContainer({
readOnly
/>
<CompletedBy checklist={data.jobs_by_pk.deliverchecklist} />
</>
</span>
)}
</Col>
</Row>