66 lines
2.2 KiB
JavaScript
66 lines
2.2 KiB
JavaScript
describe(
|
|
"Check if there are job without RO number",
|
|
{
|
|
defaultCommandTimeout: 5000,
|
|
},
|
|
() => {
|
|
beforeEach(() => {
|
|
cy.visit("/manage");
|
|
|
|
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.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();
|
|
});
|
|
});
|
|
|
|
it("shows the error messages of required fields", () => {
|
|
// Check if required fields are filled
|
|
cy.get('[data-cy="job-convert-button"]').click();
|
|
cy.get('[data-cy="convert-button"]').click();
|
|
|
|
cy.antdFormSelect("", "Insurance Company Name", () => {
|
|
cy.contains("Insurance Company Name is required.").should("exist");
|
|
});
|
|
cy.antdFormSelect("", "Referral Source", () => {
|
|
cy.contains("Referral Source is required.").should("exist");
|
|
});
|
|
cy.antdFormSelect("", "Customer Service Rep.", () => {
|
|
cy.contains("Customer Service Rep. is required.").should("exist");
|
|
});
|
|
cy.antdFormSelect("", "Category", () => {
|
|
cy.contains("Category is required.").should("exist");
|
|
});
|
|
});
|
|
|
|
it("converts a job and issue an RO number", () => {
|
|
cy.get('[data-cy="job-convert-button"]').click();
|
|
|
|
// Check if fields are present
|
|
cy.antdFormSelect("ins_co_nm", "Insurance Company Name");
|
|
cy.antdFormSelect("referral_source", "Referral Source", () => {
|
|
cy.get('[data-cy="referral_source_extra"]').type("Twitter");
|
|
});
|
|
cy.antdFormSelect("employee_csr", "Customer Service Rep.");
|
|
cy.antdFormSelect("category", "Category");
|
|
|
|
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");
|
|
});
|
|
}
|
|
);
|