Files
bodyshop/client/cypress/e2e/job-import/job-import.cy.js
2023-06-15 03:17:36 +08:00

44 lines
1.1 KiB
JavaScript

describe(
"Importing an available job",
{
defaultCommandTimeout: 5000,
},
() => {
beforeEach(() => {
cy.visit("/manage/available");
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();
}
});
});
it("checks if there are available jobs", () => {
cy.get('[data-cy="available-jobs-table"]')
.find("tr")
.should("not.have.class", "ant-table-placeholder");
});
it("creates a new owner record for the job", () => {
cy.get('[data-cy="add-job-as-new-button"]')
.filter(":enabled")
.first()
.click();
cy.get('[data-cy="new_owner_checkbox"]').should("be.checked");
cy.get(".ant-modal-content").find("button").contains("OK").click();
cy.get(".ant-notification-notice-message")
.contains("Job created successfully. Click to view.")
.click();
cy.url().should("include", "/manage/jobs");
});
}
);