From 2b3308bde7222888edbf5cc3988c07586cdf1182 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 7 Mar 2025 07:15:41 +0100 Subject: [PATCH] fix: refs #8583 workerE2E --- src/pages/Worker/Card/WorkerPit.vue | 12 +++++++- .../worker/workerBasicData.spec.js | 11 ++------ .../integration/worker/workerNotes.spec.js | 5 ---- .../integration/worker/workerOperator.spec.js | 8 +++--- .../integration/worker/workerPit.spec.js | 28 +++++-------------- 5 files changed, 25 insertions(+), 39 deletions(-) diff --git a/src/pages/Worker/Card/WorkerPit.vue b/src/pages/Worker/Card/WorkerPit.vue index 3de60d6a0..cb07c1f1d 100644 --- a/src/pages/Worker/Card/WorkerPit.vue +++ b/src/pages/Worker/Card/WorkerPit.vue @@ -68,8 +68,14 @@ const deleteRelative = async (id) => { :label="t('familySituation')" clearable v-model="data.familySituation" + data-cy="familySituation" + /> + - { clearable v-model="data.childPension" :label="t(`childPension`)" + data-cy="childPension" /> @@ -190,12 +198,14 @@ const deleteRelative = async (id) => { type="number" v-model="row.birthed" :label="t(`birthed`)" + data-cy="birthed" /> { - const maritalStatusSelect = '[data-cy="MaritalStatus"]'; - const countrySelect = '[data-cy="country"]'; - const country = 'Alemania'; - const nif = '42572374H'; - const fi = '[data-cy="fi"]'; beforeEach(() => { cy.viewport(1280, 720); cy.login('developer'); @@ -11,9 +6,9 @@ describe('WorkerBasicData', () => { }); it('should modify worker summary', () => { - cy.get(maritalStatusSelect).type('Married'); - cy.get(fi).type(nif); - cy.get(countrySelect).type(country); + cy.dataCy('MaritalStatus').type('Married'); + cy.dataCy('fi').type('42572374H'); + cy.dataCy('country').type('Alemania'); cy.saveCard(); cy.checkNotification('Data saved'); }); diff --git a/test/cypress/integration/worker/workerNotes.spec.js b/test/cypress/integration/worker/workerNotes.spec.js index 09083c25d..661314ac9 100644 --- a/test/cypress/integration/worker/workerNotes.spec.js +++ b/test/cypress/integration/worker/workerNotes.spec.js @@ -1,11 +1,6 @@ /// describe('WorkerNotes', () => { const userId = 1106; - const addNote = '[data-cy="addNote"]'; - const numberOfWagons = '[data-cy="numberOfWagons"]'; - const linesLimit = '[data-cy="linesLimit"]'; - const volumeLimit = '[data-cy="volumeLimit"]'; - const sizeLimit = '[data-cy="sizeLimit"]'; beforeEach(() => { cy.viewport(1280, 720); cy.login('developer'); diff --git a/test/cypress/integration/worker/workerOperator.spec.js b/test/cypress/integration/worker/workerOperator.spec.js index 9248b229c..93961072b 100644 --- a/test/cypress/integration/worker/workerOperator.spec.js +++ b/test/cypress/integration/worker/workerOperator.spec.js @@ -13,10 +13,10 @@ describe('WorkerOperator', () => { }); it('should fill the operator form', () => { - cy.get(numberOfWagons).type(nWagons); - cy.get(linesLimit).type('6'); - cy.get(volumeLimit).type('3'); - cy.get(sizeLimit).type('3'); + cy.dataCy('numberOfWagons').type(nWagons); + cy.dataCy('linesLimit').type('6'); + cy.get('volumeLimit').type('3'); + cy.get('sizeLimit').type('3'); cy.saveCard(); cy.checkNotification('Data saved'); diff --git a/test/cypress/integration/worker/workerPit.spec.js b/test/cypress/integration/worker/workerPit.spec.js index 19cbebc20..04f232648 100644 --- a/test/cypress/integration/worker/workerPit.spec.js +++ b/test/cypress/integration/worker/workerPit.spec.js @@ -1,19 +1,5 @@ describe('WorkerPit', () => { - const familySituationInput = '[data-cy="Family Situation_input"]'; - const familySituation = '1'; - const childPensionInput = '[data-cy="Child Pension_input"]'; - const childPension = '120'; - const spouseNifInput = '[data-cy="Spouse Pension_input"]'; - const spouseNif = '65117125P'; - const spousePensionInput = '[data-cy="Spouse Pension_input"]'; - const spousePension = '120'; const addRelative = '[data-cy="addRelative"]'; - const isDescendantSelect = '[data-cy="Descendant/Ascendant"]'; - const Descendant = 'Descendiente'; - const birthedInput = '[data-cy="Birth Year_input"]'; - const birthed = '2002'; - const adoptionYearInput = '[data-cy="Adoption Year_input"]'; - const adoptionYear = '2004'; const saveRelative = '[data-cy="workerPitRelativeSaveBtn"]'; const savePIT = '#st-actions > .q-btn-group > .q-btn--standard'; @@ -24,15 +10,15 @@ describe('WorkerPit', () => { }); it('complete PIT', () => { - cy.get(familySituationInput).type(familySituation); - cy.get(childPensionInput).type(childPension); - cy.get(spouseNifInput).type(spouseNif); - cy.get(spousePensionInput).type(spousePension); + cy.dataCy('familySituation').type('1'); + cy.dataCy('childPension').type('120'); + cy.dataCy('spouseNif').type('65117125P'); + cy.dataCy('spousePension').type('120'); cy.get(savePIT).click(); cy.get(addRelative).click(); - cy.get(isDescendantSelect).type(Descendant); - cy.get(birthedInput).type(birthed); - cy.get(adoptionYearInput).type(adoptionYear); + cy.dataCy('Descendant/Ascendant').type('Descendiente'); + cy.dataCy('birthed').type('2002'); + cy.dataCy('adoptionYear').type('2004'); cy.get(saveRelative).click(); }); });