From f01e6d74f82d355fe9f4a683491dd7ad409f8754 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 16 Jul 2024 10:42:35 +0200 Subject: [PATCH] test: better command if is date --- test/cypress/integration/worker/workerCreate.spec.js | 2 +- test/cypress/support/commands.js | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/test/cypress/integration/worker/workerCreate.spec.js b/test/cypress/integration/worker/workerCreate.spec.js index 26ce899c8..b73297b73 100644 --- a/test/cypress/integration/worker/workerCreate.spec.js +++ b/test/cypress/integration/worker/workerCreate.spec.js @@ -14,7 +14,7 @@ describe('WorkerCreate', () => { Phone: { val: '123456789' }, 'Worker code': { val: 'DWW' }, Boss: { val: developerBossId, type: 'select' }, - Birth: { val: '2022-12-11T23:00:00.000Z', type: 'date', day: 11 }, + Birth: { val: '11-12-2022', type: 'date' }, }; const external = { Fi: { val: 'Z4531219V' }, diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 8708ac064..3174e04d2 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -87,7 +87,6 @@ Cypress.Commands.add('selectOption', (selector, option) => { }); Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => { - const days = '.q-date__calendar-days .q-date__calendar-item--in'; cy.waitForElement('.q-form > .q-card'); cy.get(`${form} input`).each(([el]) => { cy.wrap(el) @@ -96,19 +95,14 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => { const field = obj[ariaLabel]; if (!field) return; - const { type, val, day } = field; + const { type, val } = field; switch (type) { case 'select': cy.wrap(el).type(val); cy.get('.q-menu .q-item').contains(val).click(); break; case 'date': - cy.get( - '[label="Birth"] > .q-field > .q-field__inner > .q-field__control > .q-field__append > .q-icon' - ).click(); - cy.get(days) - .eq(day ? day - 1 : 0) - .click(); + cy.wrap(el).type(val.split('-').join('')); break; default: cy.wrap(el).type(val);