From 692f5c016724fd78ba18f0822f69290b2e9df1c2 Mon Sep 17 00:00:00 2001 From: swtmply Date: Wed, 30 Aug 2023 12:11:31 +0800 Subject: [PATCH] IO-2327 timetickets test cases --- .../e2e/time-tickets/time-tickets.cy.js | 37 ++++++++++++++++++- .../tech-job-clock-in-form.component.jsx | 3 +- .../tech-sider/tech-sider.component.jsx | 4 +- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/client/cypress/e2e/time-tickets/time-tickets.cy.js b/client/cypress/e2e/time-tickets/time-tickets.cy.js index deb25df64..18c24721f 100644 --- a/client/cypress/e2e/time-tickets/time-tickets.cy.js +++ b/client/cypress/e2e/time-tickets/time-tickets.cy.js @@ -216,8 +216,6 @@ describe( .and("not.be.disabled") .click(); - // TODO check if labors are calculated correctly - cy.wait("@bodyshop").then(({ request }) => { const token = request.headers.authorization; @@ -280,6 +278,41 @@ describe( cy.get('[data-cy="tech-employee-id"]').type("a"); cy.get('[data-cy="tech-employee-password"]').type("a{enter}"); + + cy.contains("Logged in as"); + // go to clock in + cy.get('[data-cy="sider-joblock"]').click({ force: true }); + // find the job ro + cy.get('[data-cy="clock-ro-select"]').type("273"); + cy.get('[data-cy="clock-ro-select"] .ant-select-selection-search input') + .invoke("attr", "id") + .then((selElm) => { + const dropDownSelector = `#${selElm}_list`; + + cy.get(dropDownSelector) + .next() + .find(".ant-select-item-option-content") + .first() + .click({ force: true }); + }); + // select cost center + cy.get('[data-cy="clock-cost-center-select"]').click(); + cy.get( + '[data-cy="clock-cost-center-select"] .ant-select-selection-search input' + ) + .invoke("attr", "id") + .then((selElm) => { + const dropDownSelector = `#${selElm}_list`; + + cy.get(dropDownSelector) + .next() + .find(".ant-select-item-option-content") + .contains("Body") + .first() + .click({ force: true }); + }); + + // clock in and out of the job }); } ); diff --git a/client/src/components/tech-job-clock-in-form/tech-job-clock-in-form.component.jsx b/client/src/components/tech-job-clock-in-form/tech-job-clock-in-form.component.jsx index 77bc795a8..0430716fb 100644 --- a/client/src/components/tech-job-clock-in-form/tech-job-clock-in-form.component.jsx +++ b/client/src/components/tech-job-clock-in-form/tech-job-clock-in-form.component.jsx @@ -34,6 +34,7 @@ export function TechClockInComponent({ form, bodyshop, technician }) { convertedOnly={!bodyshop.tt_allow_post_to_invoiced} notExported={!bodyshop.tt_allow_post_to_invoiced} notInvoiced={!bodyshop.tt_allow_post_to_invoiced} + data-cy="clock-ro-select" /> @@ -47,7 +48,7 @@ export function TechClockInComponent({ form, bodyshop, technician }) { }, ]} > - {emps && emps.rates.map((item) => ( diff --git a/client/src/components/tech-sider/tech-sider.component.jsx b/client/src/components/tech-sider/tech-sider.component.jsx index c6ea4f67f..4e123e95e 100644 --- a/client/src/components/tech-sider/tech-sider.component.jsx +++ b/client/src/components/tech-sider/tech-sider.component.jsx @@ -56,7 +56,9 @@ export function TechSider({ technician, techLogout }) { disabled={!!!technician} icon={} > - {t("menus.tech.jobclockin")} + + {t("menus.tech.jobclockin")} +