IO-2327 timetickets test cases
This commit is contained in:
@@ -12,6 +12,18 @@ describe(
|
||||
const today = moment().format("YYYY-MM-DD");
|
||||
|
||||
beforeEach(() => {
|
||||
cy.intercept("POST", Cypress.env("graphql_dev_endpoint"), (req) => {
|
||||
if (req.body.operationName === "QUERY_ACTIVE_EMPLOYEES") {
|
||||
req.alias = "employees";
|
||||
}
|
||||
});
|
||||
|
||||
cy.intercept("POST", Cypress.env("graphql_dev_endpoint"), (req) => {
|
||||
if (req.body.operationName === "QUERY_BODYSHOP") {
|
||||
req.alias = "bodyshop";
|
||||
}
|
||||
});
|
||||
|
||||
cy.visit("/manage");
|
||||
|
||||
cy.get('[data-cy="active-jobs-table"]')
|
||||
@@ -20,12 +32,6 @@ describe(
|
||||
.as("active-jobs-table")
|
||||
.should("not.have.class", "ant-table-placeholder");
|
||||
|
||||
cy.intercept("POST", Cypress.env("graphql_dev_endpoint"), (req) => {
|
||||
if (req.body.operationName === "QUERY_ACTIVE_EMPLOYEES") {
|
||||
req.alias = "employees";
|
||||
}
|
||||
});
|
||||
|
||||
cy.get("@active-jobs-table")
|
||||
.contains(job2.clm_no)
|
||||
.first()
|
||||
@@ -116,7 +122,7 @@ describe(
|
||||
|
||||
cy.wait("@employees").then(({ response }) => {
|
||||
const employees = response.body.data.employees;
|
||||
const employee = employees[0];
|
||||
const employee = employees.find((e) => e.flat_rate);
|
||||
const employee_name = `${employee.first_name} ${employee.last_name}`;
|
||||
|
||||
cy.antdSelectValue("timeticket-employee", employee_name);
|
||||
@@ -162,7 +168,7 @@ describe(
|
||||
|
||||
cy.wait("@employees").then(({ response }) => {
|
||||
const employees = response.body.data.employees;
|
||||
const employee = employees[1];
|
||||
const employee = employees.find((e) => !e.flat_rate);
|
||||
const employee_name = `${employee.first_name} ${employee.last_name}`;
|
||||
|
||||
cy.antdSelectValue("timeticket-employee", employee_name);
|
||||
@@ -201,20 +207,44 @@ describe(
|
||||
|
||||
// TODO check if labors are calculated correctly
|
||||
|
||||
cy.wait("@employees").then(({ response }) => {
|
||||
const employees = response.body.data.employees;
|
||||
const employee_body_rates = employees.map((emp) => {
|
||||
return emp.rates.filter((rate) => rate.cost_center === "Body")[0]
|
||||
.rate;
|
||||
cy.wait("@bodyshop").then(({ request }) => {
|
||||
const token = request.headers.authorization;
|
||||
|
||||
const query = `query QUERY_ACTIVE_EMPLOYEES {
|
||||
employees(where: { active: { _eq: true } }) {
|
||||
last_name
|
||||
id
|
||||
first_name
|
||||
employee_number
|
||||
active
|
||||
termination_date
|
||||
hire_date
|
||||
flat_rate
|
||||
rates
|
||||
pin
|
||||
user_email
|
||||
}
|
||||
}`;
|
||||
|
||||
cy.request({
|
||||
url: "http://localhost:4000/test/query",
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: token,
|
||||
},
|
||||
body: {
|
||||
query,
|
||||
},
|
||||
}).then((response) => {
|
||||
cy.log(response);
|
||||
});
|
||||
|
||||
cy.log(employee_body_rates);
|
||||
|
||||
cy.get('[data-cy="responsibilitycenter"]')
|
||||
.contains("Body")
|
||||
.parent()
|
||||
.parent()
|
||||
.find('[data-cy="cost"]');
|
||||
// cy.get('[data-cy="responsibilitycenter"]')
|
||||
// .contains("Body")
|
||||
// .parent()
|
||||
// .parent()
|
||||
// .find('[data-cy="cost"]');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user