From b4ee19bcde76c9d44568b7742aeab673fdf61b50 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 19 Nov 2024 15:56:27 +0100 Subject: [PATCH] test: #8162 fix clientList spec --- .../integration/client/clientList.spec.js | 18 +++++----- .../vnComponent/vnLocation.spec.js | 35 ++++++------------- 2 files changed, 20 insertions(+), 33 deletions(-) diff --git a/test/cypress/integration/client/clientList.spec.js b/test/cypress/integration/client/clientList.spec.js index b87ddff3b..b3ac9d3df 100644 --- a/test/cypress/integration/client/clientList.spec.js +++ b/test/cypress/integration/client/clientList.spec.js @@ -15,7 +15,7 @@ describe('Client list', () => { }); }); - it('Client list create new client', () => { + it.only('Client list create new client', () => { cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click(); const data = { Name: { val: 'Name 1' }, @@ -24,9 +24,9 @@ describe('Client list', () => { 'Web user': { val: 'user_test_1' }, Street: { val: 'C/ STREET 1' }, Email: { val: 'user.test@1.com' }, - 'Business type': { val: 'Otros', type: 'select' }, - 'Sales person': { val: 'salesboss', type: 'select' }, + 'Sales person': { val: 'employee', type: 'select' }, Location: { val: '46000, Valencia(Province one), EspaƱa', type: 'select' }, + 'Business type': { val: 'Otros', type: 'select' }, }; cy.fillInForm(data); @@ -48,13 +48,13 @@ describe('Client list', () => { }); }); - it.only('Client founded create ticket', () => { + it('Client founded create ticket', () => { const search = 'Jessica Jones'; cy.searchByLabel('Name', search); cy.openActionDescriptor('Create ticket'); cy.waitForElement('#formModel'); - cy.waitForElement('.q-form', { timeout: 5000 }); - cy.checkValueSelectForm(1, 1110); + cy.waitForElement('.q-form'); + cy.checkValueSelectForm(1, search); cy.checkValueSelectForm(2, search); // cy.get('@Open').should('have.been.calledOnceWithExactly', [ // '/#/ticket/list?table={"clientFk":1110}&createForm={"addressId":10,"clientId":1110}', @@ -62,13 +62,13 @@ describe('Client list', () => { // 'noopener,noreferrer', // ]); }); - it.only('Client founded create order', () => { + it('Client founded create order', () => { const search = 'Jessica Jones'; cy.searchByLabel('Name', search); cy.openActionDescriptor('New order'); cy.waitForElement('#formModel'); - cy.waitForElement('.q-form', { timeout: 5000 }); - cy.checkValueForm(1, 1110); + cy.waitForElement('.q-form'); + cy.checkValueForm(1, search); cy.checkValueForm(2, search); // cy.get('@Open').should( // 'have.been.calledOnceWithExactly', diff --git a/test/cypress/integration/vnComponent/vnLocation.spec.js b/test/cypress/integration/vnComponent/vnLocation.spec.js index 0ee453aa0..70c88b26f 100644 --- a/test/cypress/integration/vnComponent/vnLocation.spec.js +++ b/test/cypress/integration/vnComponent/vnLocation.spec.js @@ -7,6 +7,9 @@ describe('VnLocation', () => { prefix: '.q-dialog__inner > .column > #formModel > .q-card', sufix: ' .q-field__inner > .q-field__control', }; + const countrySelector = `${createForm.prefix} > :nth-child(5) > :nth-child(3) > ${createForm.sufix}`; + const provinceSelector = `${createForm.prefix} > :nth-child(5) > :nth-child(2) > ${createForm.sufix}`; + const citySelector = `${createForm.prefix} > :nth-child(4) > :nth-child(2) > ${createForm.sufix}`; describe('CreateFormDialog ', () => { beforeEach(() => { cy.viewport(1280, 720); @@ -17,45 +20,29 @@ describe('VnLocation', () => { }); it('should filter provinces based on selected country', () => { // Select a country - cy.selectOption( - `${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`, - 'Ecuador' - ); + cy.selectOption(countrySelector, 'Ecuador'); // Verify that provinces are filtered - cy.get( - `${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}` - ).should('have.length', 1); + cy.get(countrySelector).should('have.length', 1); // Verify that towns are filtered - cy.get( - `${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}` - ).should('have.length', 1); + cy.get(citySelector).should('have.length', 1); }); it('should filter towns based on selected province', () => { // Select a country - cy.selectOption( - `${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`, - 'Ecuador' - ); + cy.selectOption(countrySelector, 'Ecuador'); // Verify that provinces are filtered - cy.get( - `${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}` - ).should('have.length', 1); + cy.get(provinceSelector).should('have.length', 1); // Verify that towns are filtered - cy.get( - `${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}` - ).should('have.length', 1); + cy.get(citySelector).should('have.length', 1); }); it('should pass selected country', () => { // Select a country const country = 'Ecuador'; const province = 'Province five'; - cy.selectOption( - `${createForm.prefix} > :nth-child(5) > .q-field:nth-child(5)> ${createForm.sufix}`, - country - ); + + cy.selectOption(countrySelector, country); cy.selectOption( `${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`, province