IO-2327 job importing tests
This commit is contained in:
@@ -57,9 +57,9 @@ describe(
|
|||||||
cy.get("#driveable").should("have.class", "ant-switch").click();
|
cy.get("#driveable").should("have.class", "ant-switch").click();
|
||||||
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("successfully");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ describe(
|
|||||||
cy.get('[data-cy="sign-in-button"]').click();
|
cy.get('[data-cy="sign-in-button"]').click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it("checks if there are available jobs", () => {
|
|
||||||
cy.get('[data-cy="available-jobs-table"]')
|
cy.get('[data-cy="available-jobs-table"]')
|
||||||
.find("tr")
|
.find("tr")
|
||||||
.should("not.have.class", "ant-table-placeholder");
|
.should("not.have.class", "ant-table-placeholder");
|
||||||
@@ -39,5 +37,69 @@ describe(
|
|||||||
|
|
||||||
cy.url().should("include", "/manage/jobs");
|
cy.url().should("include", "/manage/jobs");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("imports a supplement for an existing job", () => {
|
||||||
|
cy.get('[data-cy="add-job-as-supplement"]')
|
||||||
|
.filter(":enabled")
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.get('[data-cy="existing-jobs-table"]')
|
||||||
|
.find(".ant-table-tbody tr")
|
||||||
|
.should("not.have.class", "ant-table-placeholder")
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.get('[data-cy="existing-jobs-ok-button"]')
|
||||||
|
.should("not.be", "disabled")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.get(".ant-notification-notice-message")
|
||||||
|
.contains("Job supplemented successfully.")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.url().should("include", "/manage/jobs");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("imports a job with an existing owner", () => {
|
||||||
|
let hasOwner = false;
|
||||||
|
|
||||||
|
cy.get('[data-cy="add-job-as-new-button"]')
|
||||||
|
.filter(":enabled")
|
||||||
|
.each(($el) => {
|
||||||
|
cy.then(() => {
|
||||||
|
if (hasOwner) return false;
|
||||||
|
|
||||||
|
cy.wrap($el).click();
|
||||||
|
|
||||||
|
// check if table is not empty
|
||||||
|
cy.get('[data-cy="existing-owner-table"]', { timeout: 20000 })
|
||||||
|
.find(".ant-table-tbody tr")
|
||||||
|
.should("not.have.class", "ant-table-placeholder")
|
||||||
|
.then(($table) => {
|
||||||
|
if ($table.length === 0) {
|
||||||
|
cy.get('[data-cy="existing-owners-cancel-button"]').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
cy.wrap($table).first().click();
|
||||||
|
|
||||||
|
cy.get('[data-cy="new_owner_checkbox"]').should(
|
||||||
|
"not.be",
|
||||||
|
"checked"
|
||||||
|
);
|
||||||
|
|
||||||
|
hasOwner = true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get('[data-cy="existing-owners-ok-button"]').click();
|
||||||
|
|
||||||
|
cy.get(".ant-notification-notice-message")
|
||||||
|
.contains("Job created successfully. Click to view.")
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.url().should("include", "/manage/jobs");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -177,7 +177,10 @@ export function JobsAvailableComponent({
|
|||||||
>
|
>
|
||||||
<PlusCircleFilled />
|
<PlusCircleFilled />
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={() => addJobAsSupp(record)}>
|
<Button
|
||||||
|
data-cy="add-job-as-supplement"
|
||||||
|
onClick={() => addJobAsSupp(record)}
|
||||||
|
>
|
||||||
<DownloadOutlined />
|
<DownloadOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ export default function JobsFindModalComponent({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
data-cy="existing-jobs-table"
|
||||||
pagination={{ position: "bottom" }}
|
pagination={{ position: "bottom" }}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
|
|||||||
@@ -77,7 +77,10 @@ export default connect(
|
|||||||
title={t("jobs.labels.existing_jobs")}
|
title={t("jobs.labels.existing_jobs")}
|
||||||
width={"80%"}
|
width={"80%"}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
okButtonProps={{ disabled: selectedJob ? false : true }}
|
okButtonProps={{
|
||||||
|
disabled: selectedJob ? false : true,
|
||||||
|
"data-cy": "existing-jobs-ok-button",
|
||||||
|
}}
|
||||||
{...modalProps}
|
{...modalProps}
|
||||||
>
|
>
|
||||||
{loading ? <LoadingSpinner /> : null}
|
{loading ? <LoadingSpinner /> : null}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export default function LoadingSpinner({ loading = true, message, ...props }) {
|
|||||||
size="large"
|
size="large"
|
||||||
style={{
|
style={{
|
||||||
position: "relative",
|
position: "relative",
|
||||||
alignContent: "center"
|
alignContent: "center",
|
||||||
}}
|
}}
|
||||||
delay={200}
|
delay={200}
|
||||||
tip={message ? message : null}
|
tip={message ? message : null}
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ export default function OwnerFindModalComponent({
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Table
|
<Table
|
||||||
|
data-cy="existing-owner-table"
|
||||||
pagination={{ position: "bottom" }}
|
pagination={{ position: "bottom" }}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ export default function OwnerFindModalContainer({
|
|||||||
<Modal
|
<Modal
|
||||||
title={t("owners.labels.existing_owners")}
|
title={t("owners.labels.existing_owners")}
|
||||||
width={"80%"}
|
width={"80%"}
|
||||||
|
okButtonProps={{ "data-cy": "existing-owners-ok-button" }}
|
||||||
|
cancelButtonProps={{ "data-cy": "existing-owners-cancel-button" }}
|
||||||
{...modalProps}
|
{...modalProps}
|
||||||
>
|
>
|
||||||
{loading ? <LoadingSpinner /> : null}
|
{loading ? <LoadingSpinner /> : null}
|
||||||
|
|||||||
Reference in New Issue
Block a user