From b1f42cc7e0b46bb2733f6adfb25bb76c848cb6ef Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 3 Dec 2024 15:35:24 +0100 Subject: [PATCH 1/4] test: fix own test --- src/components/FormModelPopup.vue | 2 ++ test/cypress/integration/client/clientBasicData.spec.js | 4 ++-- test/cypress/integration/client/clientList.spec.js | 6 +++--- test/cypress/integration/ticket/ticketList.spec.js | 3 ++- test/cypress/support/commands.js | 4 +++- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/components/FormModelPopup.vue b/src/components/FormModelPopup.vue index d91f07535..afdc6efca 100644 --- a/src/components/FormModelPopup.vue +++ b/src/components/FormModelPopup.vue @@ -62,6 +62,7 @@ defineExpose({ @click="emit('onDataCanceled')" v-close-popup data-cy="FormModelPopup_cancel" + z-max /> diff --git a/test/cypress/integration/client/clientBasicData.spec.js b/test/cypress/integration/client/clientBasicData.spec.js index efaad33c2..bed28dc22 100644 --- a/test/cypress/integration/client/clientBasicData.spec.js +++ b/test/cypress/integration/client/clientBasicData.spec.js @@ -7,8 +7,8 @@ describe('Client basic data', () => { }); it('Should load layout', () => { cy.get('.q-card').should('be.visible'); - cy.dataCy('customerPhone').filter('input').should('be.visible'); - cy.dataCy('customerPhone').filter('input').type('123456789'); + cy.dataCy('customerPhone').find('input').should('be.visible'); + cy.dataCy('customerPhone').find('input').type('123456789'); cy.get('.q-btn-group > .q-btn--standard').click(); cy.intercept('PATCH', '/api/Clients/1102', (req) => { const { body } = req; diff --git a/test/cypress/integration/client/clientList.spec.js b/test/cypress/integration/client/clientList.spec.js index e89b5fc77..ce07deb16 100644 --- a/test/cypress/integration/client/clientList.spec.js +++ b/test/cypress/integration/client/clientList.spec.js @@ -22,10 +22,10 @@ describe('Client list', () => { const data = { Name: { val: `Name ${randomInt}` }, 'Social name': { val: `TEST ${randomInt}` }, - 'Tax number': { val: `20852${randomInt.length}3Z` }, + 'Tax number': { val: `20852${randomInt}3Z` }, 'Web user': { val: `user_test_${randomInt}` }, Street: { val: `C/ STREET ${randomInt}` }, - Email: { val: 'user.test@1.com' }, + Email: { val: `user.test${randomInt}@cypress.com` }, 'Sales person': { val: 'employee', type: 'select' }, Location: { val: '46000, Valencia(Province one), EspaƱa', type: 'select' }, 'Business type': { val: 'Otros', type: 'select' }, @@ -34,7 +34,7 @@ describe('Client list', () => { cy.get('.q-mt-lg > .q-btn--standard').click(); - cy.checkNotification('Data saved'); + cy.checkNotification('Data created'); cy.url().should('include', '/summary'); }); it('Client list search client', () => { diff --git a/test/cypress/integration/ticket/ticketList.spec.js b/test/cypress/integration/ticket/ticketList.spec.js index bbdbcea92..b30b4cdad 100644 --- a/test/cypress/integration/ticket/ticketList.spec.js +++ b/test/cypress/integration/ticket/ticketList.spec.js @@ -47,7 +47,8 @@ describe('TicketList', () => { Landed: { val: '01-01-2024', type: 'date' }, }; cy.fillInForm(data); - cy.get('.q-mt-lg > .q-btn--standard').click(); + cy.dataCy('Agency_select').click(); + cy.dataCy('FormModelPopup_save').click(); cy.checkNotification('Data created'); cy.url().should('match', /\/ticket\/\d+\/summary/); }); diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 21121d9df..64b37239e 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -111,7 +111,9 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => { switch (type) { case 'select': cy.wrap(el).type(val); - cy.get('.q-menu .q-item').contains(val).click(); + cy.get('.q-menu .q-item', { timeout: 2000 }) + .contains(val) + .click(); break; case 'date': cy.wrap(el).type(val.split('-').join('')); From 408aa9d5356db8a2b657f3bcb39edba2ee7a5045 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 5 Dec 2024 10:20:35 +0100 Subject: [PATCH 2/4] test: pref minor change --- test/cypress/integration/ticket/ticketList.spec.js | 2 +- test/cypress/support/commands.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/test/cypress/integration/ticket/ticketList.spec.js b/test/cypress/integration/ticket/ticketList.spec.js index b30b4cdad..c1d1a0655 100644 --- a/test/cypress/integration/ticket/ticketList.spec.js +++ b/test/cypress/integration/ticket/ticketList.spec.js @@ -37,7 +37,7 @@ describe('TicketList', () => { cy.dataCy('ticketSummary').should('exist'); }); - it('Client list create new client', () => { + it.only('Client list create new client', () => { cy.dataCy('vnTableCreateBtn').should('exist'); cy.dataCy('vnTableCreateBtn').click(); const data = { diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 64b37239e..21121d9df 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -111,9 +111,7 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => { switch (type) { case 'select': cy.wrap(el).type(val); - cy.get('.q-menu .q-item', { timeout: 2000 }) - .contains(val) - .click(); + cy.get('.q-menu .q-item').contains(val).click(); break; case 'date': cy.wrap(el).type(val.split('-').join('')); From b068515f55d37b91c33b284d665e420475618293 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 5 Dec 2024 09:43:45 +0000 Subject: [PATCH 3/4] perf: test command fillInForm --- test/cypress/support/commands.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 21121d9df..2b13a7144 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -110,14 +110,14 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => { const { type, val } = field; switch (type) { case 'select': - cy.wrap(el).type(val); + cy.get(el).click(); cy.get('.q-menu .q-item').contains(val).click(); break; case 'date': - cy.wrap(el).type(val.split('-').join('')); + cy.get(el).type(val.split('-').join('')); break; case 'time': - cy.wrap(el).click(); + cy.get(el).click(); cy.get('.q-time .q-time__clock').contains(val.h).click(); cy.get('.q-time .q-time__clock').contains(val.m).click(); cy.get('.q-time .q-time__link').contains(val.x).click(); From 4c01cf9603f733145b4b07056d949a1d0501e20d Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 5 Dec 2024 14:55:51 +0100 Subject: [PATCH 4/4] perf: remove timeout --- test/cypress/support/commands.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 21121d9df..2b13a7144 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -110,14 +110,14 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => { const { type, val } = field; switch (type) { case 'select': - cy.wrap(el).type(val); + cy.get(el).click(); cy.get('.q-menu .q-item').contains(val).click(); break; case 'date': - cy.wrap(el).type(val.split('-').join('')); + cy.get(el).type(val.split('-').join('')); break; case 'time': - cy.wrap(el).click(); + cy.get(el).click(); cy.get('.q-time .q-time__clock').contains(val.h).click(); cy.get('.q-time .q-time__clock').contains(val.m).click(); cy.get('.q-time .q-time__link').contains(val.x).click();