job converting and importing test cases
This commit is contained in:
@@ -1,65 +1,149 @@
|
|||||||
|
import job from "../../fixtures/jobs/job-3.json";
|
||||||
|
|
||||||
|
const errorMessages = {
|
||||||
|
class: "Class is required. ",
|
||||||
|
referral_source: "Referral Source is required. ",
|
||||||
|
employee_csr: "Customer Service Rep. is required. ",
|
||||||
|
category: "Category is required. ",
|
||||||
|
};
|
||||||
|
|
||||||
describe(
|
describe(
|
||||||
"Check if there are job without RO number",
|
"Converting a job with ",
|
||||||
{
|
{
|
||||||
defaultCommandTimeout: 5000,
|
defaultCommandTimeout: 10000,
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
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")
|
|
||||||
.find("tr")
|
|
||||||
.should("not.have.class", "ant-table-placeholder");
|
|
||||||
|
|
||||||
cy.get(".ant-table-row").find("a").contains("N/A").first().click();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
cy.get('[data-cy="job-convert-button"]').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("shows the error messages of required fields", () => {
|
it("shows the error messages of required fields", () => {
|
||||||
// Check if required fields are filled
|
cy.wait("@bodyshop").then(({ response }) => {
|
||||||
cy.get('[data-cy="job-convert-button"]').click();
|
const bodyshop = response.body.data.bodyshops[0];
|
||||||
cy.get('[data-cy="convert-button"]').click();
|
|
||||||
|
|
||||||
cy.antdFormSelect("", "Insurance Company Name", () => {
|
const data = {
|
||||||
cy.contains("Insurance Company Name is required.").should("exist");
|
ins_cos: bodyshop.md_ins_cos,
|
||||||
});
|
config: {
|
||||||
cy.antdFormSelect("", "Referral Source", () => {
|
class: bodyshop.enforce_class,
|
||||||
cy.contains("Referral Source is required.").should("exist");
|
referral_source: bodyshop.enforce_referral,
|
||||||
});
|
employee_csr: bodyshop.enforce_conversion_csr,
|
||||||
cy.antdFormSelect("", "Customer Service Rep.", () => {
|
category: bodyshop.enforce_conversion_category,
|
||||||
cy.contains("Customer Service Rep. is required.").should("exist");
|
},
|
||||||
});
|
};
|
||||||
cy.antdFormSelect("", "Category", () => {
|
|
||||||
cy.contains("Category is required.").should("exist");
|
cy.get('[data-cy="convert-button"]').click();
|
||||||
|
|
||||||
|
cy.get("#ins_co_nm_help")
|
||||||
|
.find(".ant-form-item-explain-error")
|
||||||
|
.should("have.text", "Insurance Company Name is required. ");
|
||||||
|
|
||||||
|
for (const id in data.config) {
|
||||||
|
if (data.config[id]) {
|
||||||
|
cy.get(`#${id}_help`)
|
||||||
|
.find(".ant-form-item-explain-error")
|
||||||
|
.should("have.text", errorMessages[id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("converts a job and issue an RO number", () => {
|
it("shows error of required fields when insurance company is selected", () => {
|
||||||
cy.get('[data-cy="job-convert-button"]').click();
|
cy.wait("@bodyshop").then(({ response }) => {
|
||||||
|
const bodyshop = response.body.data.bodyshops[0];
|
||||||
|
|
||||||
// Check if fields are present
|
const data = {
|
||||||
cy.antdFormSelect("ins_co_nm", "Insurance Company Name");
|
ins_cos: bodyshop.md_ins_cos,
|
||||||
cy.antdFormSelect("referral_source", "Referral Source", () => {
|
config: {
|
||||||
cy.get('[data-cy="referral_source_extra"]').type("Twitter");
|
class: bodyshop.enforce_class,
|
||||||
|
referral_source: bodyshop.enforce_referral,
|
||||||
|
employee_csr: bodyshop.enforce_conversion_csr,
|
||||||
|
category: bodyshop.enforce_conversion_category,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
cy.get(".ant-select-selection-search").find("#ins_co_nm").click();
|
||||||
|
cy.get("#ins_co_nm_list")
|
||||||
|
.next()
|
||||||
|
.find(".ant-select-item-option-content")
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.get("#ca_gst_registrant").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('[data-cy="convert-button"]').click();
|
||||||
|
|
||||||
|
for (const id in data.config) {
|
||||||
|
if (data.config[id]) {
|
||||||
|
cy.get(`#${id}_help`)
|
||||||
|
.find(".ant-form-item-explain-error")
|
||||||
|
.should("have.text", errorMessages[id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
cy.antdFormSelect("employee_csr", "Customer Service Rep.");
|
});
|
||||||
cy.antdFormSelect("category", "Category");
|
|
||||||
|
|
||||||
cy.get("#ca_gst_registrant").should("have.class", "ant-switch").click();
|
it("checks for the job to convert", () => {
|
||||||
cy.get("#driveable").should("have.class", "ant-switch").click();
|
cy.wait("@bodyshop").then(({ response }) => {
|
||||||
cy.get("#towin").should("have.class", "ant-switch").click();
|
const bodyshop = response.body.data.bodyshops[0];
|
||||||
|
|
||||||
cy.get('[data-cy="convert-button"]').click();
|
const data = {
|
||||||
|
ins_cos: bodyshop.md_ins_cos,
|
||||||
|
config: {
|
||||||
|
class: bodyshop.enforce_class,
|
||||||
|
referral_source: bodyshop.enforce_referral,
|
||||||
|
employee_csr: bodyshop.enforce_conversion_csr,
|
||||||
|
category: bodyshop.enforce_conversion_category,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
cy.get(".ant-notification-notice-message").contains("successfully");
|
cy.get(".ant-select-selection-search").find("#ins_co_nm").click();
|
||||||
|
cy.get("#ins_co_nm_list")
|
||||||
|
.next()
|
||||||
|
.find(".ant-select-item-option-content")
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
for (const id in data.config) {
|
||||||
|
if (data.config[id]) {
|
||||||
|
cy.get(".ant-select-selection-search").find(`#${id}`).click();
|
||||||
|
cy.get(`#${id}_list`)
|
||||||
|
.next()
|
||||||
|
.find(".ant-select-item-option-content")
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cy.get("#ca_gst_registrant").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('[data-cy="convert-button"]').click();
|
||||||
|
// cy.get(".ant-notification-notice-message").contains("successfully");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,16 +1,10 @@
|
|||||||
import job from "../../downloads/jobs/job-3.json";
|
import job from "../../fixtures/jobs/job-3.json";
|
||||||
import job2 from "../../downloads/jobs/job-4.json";
|
import job2 from "../../fixtures/jobs/job-4.json";
|
||||||
import jobSupplement from "../../downloads/jobs/job-3-supplement.json";
|
import jobSupplement from "../../fixtures/jobs/job-3-supplement.json";
|
||||||
import jobMetadata from "../../downloads/jobs/job-3-jobmetadata.json";
|
import jobMetadata from "../../fixtures/jobs/job-3-jobmetadata.json";
|
||||||
import jobSupplementMetadata from "../../downloads/jobs/job-3-supplment-jobmetadata.json";
|
import jobSupplementMetadata from "../../fixtures/jobs/job-3-supplment-jobmetadata.json";
|
||||||
import Dinero from "dinero.js";
|
import Dinero from "dinero.js";
|
||||||
|
|
||||||
const query = `mutation INSERT_AVAILABLE_JOB($job: available_jobs_insert_input!) {
|
|
||||||
insert_available_jobs_one(object: $job) {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}`;
|
|
||||||
|
|
||||||
const createJobEstimate = (job, bodyshopid) => {
|
const createJobEstimate = (job, bodyshopid) => {
|
||||||
return {
|
return {
|
||||||
owner: {
|
owner: {
|
||||||
@@ -354,3 +348,151 @@ describe(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const errorMessages = {
|
||||||
|
class: "Class is required. ",
|
||||||
|
referral_source: "Referral Source is required. ",
|
||||||
|
employee_csr: "Customer Service Rep. is required. ",
|
||||||
|
category: "Category is required. ",
|
||||||
|
};
|
||||||
|
|
||||||
|
describe(
|
||||||
|
"Converting an active job",
|
||||||
|
{
|
||||||
|
defaultCommandTimeout: 10000,
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.visit("/manage/jobs");
|
||||||
|
|
||||||
|
cy.intercept("POST", Cypress.env("graphql_dev_endpoint"), (req) => {
|
||||||
|
if (req.body.operationName === "QUERY_BODYSHOP") {
|
||||||
|
req.alias = "bodyshop";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
cy.get('[data-cy="job-convert-button"]').click();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("shows the error messages of required fields", () => {
|
||||||
|
cy.wait("@bodyshop").then(({ response }) => {
|
||||||
|
const bodyshop = response.body.data.bodyshops[0];
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
ins_cos: bodyshop.md_ins_cos,
|
||||||
|
config: {
|
||||||
|
class: bodyshop.enforce_class,
|
||||||
|
referral_source: bodyshop.enforce_referral,
|
||||||
|
employee_csr: bodyshop.enforce_conversion_csr,
|
||||||
|
category: bodyshop.enforce_conversion_category,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
cy.get('[data-cy="convert-button"]').click();
|
||||||
|
|
||||||
|
cy.get("#ins_co_nm_help")
|
||||||
|
.find(".ant-form-item-explain-error")
|
||||||
|
.should("have.text", "Insurance Company Name is required. ");
|
||||||
|
|
||||||
|
for (const id in data.config) {
|
||||||
|
if (data.config[id]) {
|
||||||
|
cy.get(`#${id}_help`)
|
||||||
|
.find(".ant-form-item-explain-error")
|
||||||
|
.should("have.text", errorMessages[id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("shows error of required fields when insurance company is selected", () => {
|
||||||
|
cy.wait("@bodyshop").then(({ response }) => {
|
||||||
|
const bodyshop = response.body.data.bodyshops[0];
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
ins_cos: bodyshop.md_ins_cos,
|
||||||
|
config: {
|
||||||
|
class: bodyshop.enforce_class,
|
||||||
|
referral_source: bodyshop.enforce_referral,
|
||||||
|
employee_csr: bodyshop.enforce_conversion_csr,
|
||||||
|
category: bodyshop.enforce_conversion_category,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
cy.get(".ant-select-selection-search").find("#ins_co_nm").click();
|
||||||
|
cy.get("#ins_co_nm_list")
|
||||||
|
.next()
|
||||||
|
.find(".ant-select-item-option-content")
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.get("#ca_gst_registrant").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('[data-cy="convert-button"]').click();
|
||||||
|
|
||||||
|
for (const id in data.config) {
|
||||||
|
if (data.config[id]) {
|
||||||
|
cy.get(`#${id}_help`)
|
||||||
|
.find(".ant-form-item-explain-error")
|
||||||
|
.should("have.text", errorMessages[id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("checks for the job to convert", () => {
|
||||||
|
cy.wait("@bodyshop").then(({ response }) => {
|
||||||
|
const bodyshop = response.body.data.bodyshops[0];
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
ins_cos: bodyshop.md_ins_cos,
|
||||||
|
config: {
|
||||||
|
class: bodyshop.enforce_class,
|
||||||
|
referral_source: bodyshop.enforce_referral,
|
||||||
|
employee_csr: bodyshop.enforce_conversion_csr,
|
||||||
|
category: bodyshop.enforce_conversion_category,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
cy.get(".ant-select-selection-search").find("#ins_co_nm").click();
|
||||||
|
cy.get("#ins_co_nm_list")
|
||||||
|
.next()
|
||||||
|
.find(".ant-select-item-option-content")
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
for (const id in data.config) {
|
||||||
|
if (data.config[id]) {
|
||||||
|
cy.get(".ant-select-selection-search").find(`#${id}`).click();
|
||||||
|
cy.get(`#${id}_list`)
|
||||||
|
.next()
|
||||||
|
.find(".ant-select-item-option-content")
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cy.get("#ca_gst_registrant").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('[data-cy="convert-button"]').click();
|
||||||
|
cy.get(".ant-notification-notice-message").contains("successfully");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ export function JobsList({ bodyshop }) {
|
|||||||
<Link
|
<Link
|
||||||
to={"/manage/jobs/" + record.id}
|
to={"/manage/jobs/" + record.id}
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
data-cy="active-job-link"
|
||||||
>
|
>
|
||||||
<Space>
|
<Space>
|
||||||
{record.ro_number || t("general.labels.na")}
|
{record.ro_number || t("general.labels.na")}
|
||||||
@@ -364,6 +365,7 @@ export function JobsList({ bodyshop }) {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Table
|
<Table
|
||||||
|
data-cy="active-jobs-table"
|
||||||
loading={loading}
|
loading={loading}
|
||||||
pagination={{ defaultPageSize: 50 }}
|
pagination={{ defaultPageSize: 50 }}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
|
|||||||
Reference in New Issue
Block a user