From 154b3020057a94767f93eba3114fda5eb815af52 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 19 Feb 2025 13:41:06 +0100 Subject: [PATCH 1/2] fix: refs #7323 e2e --- src/pages/Worker/Card/WorkerPit.vue | 1 + .../integration/worker/workerCreate.spec.js | 25 ++++++++++++++----- .../worker/workerNotificationsManager.spec.js | 13 +++------- .../integration/worker/workerPit.spec.js | 8 +++--- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/pages/Worker/Card/WorkerPit.vue b/src/pages/Worker/Card/WorkerPit.vue index 40e814452..3de60d6a0 100644 --- a/src/pages/Worker/Card/WorkerPit.vue +++ b/src/pages/Worker/Card/WorkerPit.vue @@ -176,6 +176,7 @@ const deleteRelative = async (id) => { :label="t('isDescendant')" v-model="row.isDescendant" class="q-gutter-xs q-mb-xs" + data-cy="Descendant/Ascendant" /> { const externalRadio = '.q-radio:nth-child(2)'; const developerBossId = 120; const payMethodCross = - '.grid-create .full-width > :nth-child(9) .q-select .q-field__append:not(.q-anchor--skip)'; + ':nth-child(9) > .q-select > .q-field__inner > .q-field__control > :nth-child(2)'; const saveBtn = '.q-mt-lg > .q-btn--standard'; + const internalWithOutPay = { + Fi: { val: '78457139E' }, + 'Web user': { val: 'manolo' }, + Name: { val: 'Manolo' }, + 'Last name': { val: 'Hurtado' }, + 'Personal email': { val: 'manolo@mydomain.com' }, + Company: { val: 'VNL', type: 'select' }, + Street: { val: 'S/ DEFAULTWORKERSTREET' }, + Location: { val: 1, type: 'select' }, + Phone: { val: '123456789' }, + 'Worker code': { val: 'DWW' }, + Boss: { val: developerBossId, type: 'select' }, + Birth: { val: '11-12-2022', type: 'date' }, + }; + const internal = { Fi: { val: '78457139E' }, 'Web user': { val: 'manolo' }, @@ -14,6 +29,7 @@ describe('WorkerCreate', () => { Company: { val: 'VNL', type: 'select' }, Street: { val: 'S/ DEFAULTWORKERSTREET' }, Location: { val: 1, type: 'select' }, + 'Pay method': { val: 1, type: 'select' }, Phone: { val: '123456789' }, 'Worker code': { val: 'DWW' }, Boss: { val: developerBossId, type: 'select' }, @@ -37,17 +53,14 @@ describe('WorkerCreate', () => { }); it('should throw an error if a pay method has not been selected', () => { - cy.fillInForm(internal); + cy.fillInForm(internalWithOutPay); cy.get(payMethodCross).click(); cy.get(saveBtn).click(); cy.checkNotification('Payment method is required'); }); it('should create an internal', () => { - cy.fillInForm({ - ...internal, - 'Pay method': { val: 'PayMethod one', type: 'select' }, - }); + cy.fillInForm(internal); cy.get(saveBtn).click(); cy.checkNotification('Data created'); }); diff --git a/test/cypress/integration/worker/workerNotificationsManager.spec.js b/test/cypress/integration/worker/workerNotificationsManager.spec.js index f121b3894..cffb6475a 100644 --- a/test/cypress/integration/worker/workerNotificationsManager.spec.js +++ b/test/cypress/integration/worker/workerNotificationsManager.spec.js @@ -2,8 +2,8 @@ describe('WorkerNotificationsManager', () => { const salesPersonId = 18; const developerId = 9; - const activeList = ':nth-child(1) > .q-list'; - const availableList = ':nth-child(2) > .q-list'; + const activeList = '.q-infinite-scroll > :nth-child(1)'; + const availableList = '.q-infinite-scroll > :nth-child(2)'; const firstActiveNotification = ':nth-child(1) > .q-list > :nth-child(1) > .q-item > .q-toggle > .q-toggle__inner'; const firstAvailableNotification = @@ -18,7 +18,7 @@ describe('WorkerNotificationsManager', () => { cy.visit(`/#/worker/${salesPersonId}/notifications`); cy.get(firstAvailableNotification).click(); cy.checkNotification( - 'The notification subscription of this worker cant be modified' + 'The notification subscription of this worker cant be modified', ); }); @@ -29,7 +29,6 @@ describe('WorkerNotificationsManager', () => { cy.waitForElement(availableList); cy.get(activeList) - .children() .its('length') .then((beforeSize) => { cy.get(firstAvailableNotification).click(); @@ -46,13 +45,10 @@ describe('WorkerNotificationsManager', () => { cy.waitForElement(availableList); cy.get(availableList) - .children() .its('length') .then((beforeSize) => { cy.get(firstActiveNotification).click(); - cy.get(availableList) - .children() - .should('have.length', beforeSize + 1); + cy.get(availableList).children().should('have.length', beforeSize); }); }); @@ -62,7 +58,6 @@ describe('WorkerNotificationsManager', () => { cy.waitForElement(availableList); cy.get(activeList) - .children() .its('length') .then((beforeSize) => { cy.get(firstAvailableNotification).click(); diff --git a/test/cypress/integration/worker/workerPit.spec.js b/test/cypress/integration/worker/workerPit.spec.js index cc3a87637..19cbebc20 100644 --- a/test/cypress/integration/worker/workerPit.spec.js +++ b/test/cypress/integration/worker/workerPit.spec.js @@ -8,7 +8,8 @@ describe('WorkerPit', () => { const spousePensionInput = '[data-cy="Spouse Pension_input"]'; const spousePension = '120'; const addRelative = '[data-cy="addRelative"]'; - const isDescendantSelect = '[data-cy="Descendant/Ascendant_select"]'; + 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"]'; @@ -28,11 +29,8 @@ describe('WorkerPit', () => { cy.get(spouseNifInput).type(spouseNif); cy.get(spousePensionInput).type(spousePension); cy.get(savePIT).click(); - }); - - it('complete relative', () => { cy.get(addRelative).click(); - cy.get(isDescendantSelect).type('{downArrow}{downArrow}{enter}'); + cy.get(isDescendantSelect).type(Descendant); cy.get(birthedInput).type(birthed); cy.get(adoptionYearInput).type(adoptionYear); cy.get(saveRelative).click(); From 743e07cd64a4794905025c847552190c3585f76f Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 20 Feb 2025 09:46:02 +0100 Subject: [PATCH 2/2] fix: refs #7323 notification manager --- .../worker/workerNotificationsManager.spec.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/cypress/integration/worker/workerNotificationsManager.spec.js b/test/cypress/integration/worker/workerNotificationsManager.spec.js index cffb6475a..ad48d8a6c 100644 --- a/test/cypress/integration/worker/workerNotificationsManager.spec.js +++ b/test/cypress/integration/worker/workerNotificationsManager.spec.js @@ -2,8 +2,8 @@ describe('WorkerNotificationsManager', () => { const salesPersonId = 18; const developerId = 9; - const activeList = '.q-infinite-scroll > :nth-child(1)'; - const availableList = '.q-infinite-scroll > :nth-child(2)'; + const activeList = ':nth-child(1) > .q-list'; + const availableList = ':nth-child(2) > .q-list'; const firstActiveNotification = ':nth-child(1) > .q-list > :nth-child(1) > .q-item > .q-toggle > .q-toggle__inner'; const firstAvailableNotification = @@ -29,6 +29,7 @@ describe('WorkerNotificationsManager', () => { cy.waitForElement(availableList); cy.get(activeList) + .children() .its('length') .then((beforeSize) => { cy.get(firstAvailableNotification).click(); @@ -45,10 +46,13 @@ describe('WorkerNotificationsManager', () => { cy.waitForElement(availableList); cy.get(availableList) + .children() .its('length') .then((beforeSize) => { cy.get(firstActiveNotification).click(); - cy.get(availableList).children().should('have.length', beforeSize); + cy.get(availableList) + .children() + .should('have.length', beforeSize + 1); }); }); @@ -58,6 +62,7 @@ describe('WorkerNotificationsManager', () => { cy.waitForElement(availableList); cy.get(activeList) + .children() .its('length') .then((beforeSize) => { cy.get(firstAvailableNotification).click();