From bc75bd9dc08a6fd73c6417f189b8586b4c9c7ebd Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 24 Mar 2025 09:20:39 +0100 Subject: [PATCH] feat: update order creation test to use form data and improve readability --- .../integration/order/orderList.spec.js | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/test/cypress/integration/order/orderList.spec.js b/test/cypress/integration/order/orderList.spec.js index 1c954622f..e7b49c9d0 100644 --- a/test/cypress/integration/order/orderList.spec.js +++ b/test/cypress/integration/order/orderList.spec.js @@ -7,18 +7,17 @@ describe('OrderList', () => { }); it('create order', () => { - cy.get('[data-cy="vnTableCreateBtn"]').click(); - cy.get('[data-cy="Client_select"]').type('1101'); - cy.get('.q-menu').contains('Bruce Wayne').click(); - cy.get('[data-cy="Address_select"]').click(); - cy.get( - '.q-menu > div> div.q-item:nth-child(1) >div.q-item__section--avatar > i', - ).should('have.text', 'star'); - cy.get('.q-menu > div> .q-item:nth-child(1)').click(); - cy.dataCy('landedDate').find('input').type('06/01/2001'); - cy.get('.q-card [data-cy="Agency_select"]').click(); - cy.get('.q-menu > div> .q-item:nth-child(1)').click(); + cy.dataCy('vnTableCreateBtn').click(); + + const data = { + Client: { val: 'salesPerson', type: 'select' }, + Address: { val: 'salesPerson', type: 'select' }, + Landed: { val: '01-01-2024', type: 'date' }, + Agency: { val: 'Other agency', type: 'select' }, + }; cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale'); + cy.fillInForm(data); + cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click(); cy.wait('@orderSale'); cy.get('.q-item > .q-item__label.subtitle').then((text) => {