From ff61a5931bac5a473e56ea4c6c3091e4552e850c Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 27 Jan 2025 19:00:07 +0100 Subject: [PATCH 1/5] test: fix clientList spec --- .../integration/client/clientList.spec.js | 2 +- test/cypress/support/commands.js | 29 +------------------ 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/test/cypress/integration/client/clientList.spec.js b/test/cypress/integration/client/clientList.spec.js index d5723375b..21fc0f2ea 100644 --- a/test/cypress/integration/client/clientList.spec.js +++ b/test/cypress/integration/client/clientList.spec.js @@ -62,7 +62,7 @@ describe('Client list', () => { it('Client founded create order', () => { const search = 'Jessica Jones'; cy.searchByLabel('Name', search); - cy.openActionDescriptor('New order'); + cy.clickButtonDescriptor(3); cy.waitForElement('#formModel'); cy.waitForElement('.q-form'); cy.checkValueForm(1, search); diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 93f6d0054..9bfa2c03e 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -289,40 +289,13 @@ Cypress.Commands.add('openActionDescriptor', (opt) => { cy.openActionsDescriptor(); const listItem = '[role="menu"] .q-list .q-item'; cy.contains(listItem, opt).click(); - 1; }); Cypress.Commands.add('openActionsDescriptor', () => { cy.get('[data-cy="descriptor-more-opts"]').click(); }); -Cypress.Commands.add('clickButtonsDescriptor', (id) => { - cy.get(`.actions > .q-card__actions> .q-btn:nth-child(${id})`) - .invoke('removeAttr', 'target') - .click(); -}); - -Cypress.Commands.add('openActionDescriptor', (opt) => { - cy.openActionsDescriptor(); - const listItem = '[role="menu"] .q-list .q-item'; - cy.contains(listItem, opt).click(); - 1; -}); - -Cypress.Commands.add('clickButtonsDescriptor', (id) => { - cy.get(`.actions > .q-card__actions> .q-btn:nth-child(${id})`) - .invoke('removeAttr', 'target') - .click(); -}); - -Cypress.Commands.add('openActionDescriptor', (opt) => { - cy.openActionsDescriptor(); - const listItem = '[role="menu"] .q-list .q-item'; - cy.contains(listItem, opt).click(); - 1; -}); - -Cypress.Commands.add('clickButtonsDescriptor', (id) => { +Cypress.Commands.add('clickButtonDescriptor', (id) => { cy.get(`.actions > .q-card__actions> .q-btn:nth-child(${id})`) .invoke('removeAttr', 'target') .click(); From 0910425c5c8409982717a16dc256589cf6255b48 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 27 Jan 2025 19:00:27 +0100 Subject: [PATCH 2/5] feat: add addressFk --- src/pages/Customer/Card/CustomerDescriptor.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/Customer/Card/CustomerDescriptor.vue b/src/pages/Customer/Card/CustomerDescriptor.vue index 4a064843a..c42d77b60 100644 --- a/src/pages/Customer/Card/CustomerDescriptor.vue +++ b/src/pages/Customer/Card/CustomerDescriptor.vue @@ -190,7 +190,9 @@ const debtWarning = computed(() => { name: 'OrderList', query: { createForm: JSON.stringify({ - clientFk: entity.id, + clientFk: entity.id + , + addressId: entity.defaultAddressFk, }), }, }" From a5adc7550c51690d221bfef5af4f26161b262855 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 27 Jan 2025 19:00:46 +0100 Subject: [PATCH 3/5] style: customerDescriptor --- src/pages/Customer/Card/CustomerDescriptor.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/Customer/Card/CustomerDescriptor.vue b/src/pages/Customer/Card/CustomerDescriptor.vue index c42d77b60..bc57908ec 100644 --- a/src/pages/Customer/Card/CustomerDescriptor.vue +++ b/src/pages/Customer/Card/CustomerDescriptor.vue @@ -190,8 +190,7 @@ const debtWarning = computed(() => { name: 'OrderList', query: { createForm: JSON.stringify({ - clientFk: entity.id - , + clientFk: entity.id, addressId: entity.defaultAddressFk, }), }, From e1566297754aa80bbc2e403573b32e5a27ff3b9a Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 28 Jan 2025 23:33:39 +0100 Subject: [PATCH 4/5] feat: new command --- .../integration/client/clientList.spec.js | 4 ++-- test/cypress/support/commands.js | 24 ++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/test/cypress/integration/client/clientList.spec.js b/test/cypress/integration/client/clientList.spec.js index 21fc0f2ea..195987539 100644 --- a/test/cypress/integration/client/clientList.spec.js +++ b/test/cypress/integration/client/clientList.spec.js @@ -59,10 +59,10 @@ describe('Client list', () => { cy.checkValueForm(1, search); cy.checkValueForm(2, search); }); - it('Client founded create order', () => { + it.only('Client founded create order', () => { const search = 'Jessica Jones'; cy.searchByLabel('Name', search); - cy.clickButtonDescriptor(3); + cy.clickButtonWith('icon', 'icon-basketadd'); cy.waitForElement('#formModel'); cy.waitForElement('.q-form'); cy.checkValueForm(1, search); diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 9bfa2c03e..23963125e 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -71,7 +71,7 @@ Cypress.Commands.add('getValue', (selector) => { return cy .get( selector + - '> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input' + '> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input', ) .invoke('val'); } @@ -303,7 +303,7 @@ Cypress.Commands.add('clickButtonDescriptor', (id) => { Cypress.Commands.add('openUserPanel', () => { cy.get( - '.column > .q-avatar > .q-avatar__content > .q-img > .q-img__container > .q-img__image' + '.column > .q-avatar > .q-avatar__content > .q-img > .q-img__container > .q-img__image', ).click(); }); @@ -329,7 +329,7 @@ Cypress.Commands.add('checkValueForm', (id, search) => { Cypress.Commands.add('checkValueSelectForm', (id, search) => { cy.get( - `.grid-create > :nth-child(${id}) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > .q-field__input` + `.grid-create > :nth-child(${id}) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > .q-field__input`, ).should('have.value', search); }); @@ -347,3 +347,21 @@ Cypress.Commands.add('addBtnClick', () => { .and('be.visible') .click(); }); + +Cypress.Commands.add('clickButtonWith', (type, value) => { + switch (type) { + case 'icon': + cy.clickButtonWithIcon(value); + break; + + default: + cy.clickButtonWithText(value); + break; + } +}); +Cypress.Commands.add('clickButtonWithIcon', (iconClass) => { + cy.get(`.q-icon.${iconClass}`).parent().click(); +}); +Cypress.Commands.add('clickButtonWithText', (buttonText) => { + cy.get('.q-btn').contains(buttonText).click(); +}); From c86731d9e859186a1876330d8b6441fd3d537fe5 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 28 Jan 2025 23:35:35 +0100 Subject: [PATCH 5/5] test: remove only --- test/cypress/integration/client/clientList.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cypress/integration/client/clientList.spec.js b/test/cypress/integration/client/clientList.spec.js index 195987539..3bc391fc7 100644 --- a/test/cypress/integration/client/clientList.spec.js +++ b/test/cypress/integration/client/clientList.spec.js @@ -59,7 +59,7 @@ describe('Client list', () => { cy.checkValueForm(1, search); cy.checkValueForm(2, search); }); - it.only('Client founded create order', () => { + it('Client founded create order', () => { const search = 'Jessica Jones'; cy.searchByLabel('Name', search); cy.clickButtonWith('icon', 'icon-basketadd');