/// describe('OrderList', () => { const clientCreateSelect = '#formModel [data-cy="Client_select"]'; const addressCreateSelect = '#formModel [data-cy="Address_select"]'; const agencyCreateSelect = '#formModel [data-cy="Agency_select"]'; beforeEach(() => { cy.login('developer'); cy.viewport(1920, 1080); cy.visit('/#/order/list'); }); it('create order', () => { cy.get('[data-cy="vnTableCreateBtn"]').click(); cy.selectOption(clientCreateSelect, 1101); cy.get(addressCreateSelect).click(); cy.get( '.q-menu > div> div.q-item:nth-child(1) >div.q-item__section--avatar > i', ).should('have.text', 'star'); cy.dataCy('landedDate').find('input').type('06/01/2001'); cy.selectOption(agencyCreateSelect, 1); cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale'); cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click(); cy.wait('@orderSale'); cy.get('.q-item > .q-item__label.subtitle').then((text) => { const id = text.text().trim().split('#')[1]; cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`); }); cy.url().should('include', `/order`); }); it('filter list and create order', () => { cy.dataCy('Customer ID_input').type('1101{enter}'); cy.intercept('GET', /\/api\/Clients/).as('clientFilter'); cy.dataCy('vnTableCreateBtn').click(); cy.wait('@clientFilter'); cy.dataCy('landedDate').find('input').type('06/01/2001'); cy.selectOption(agencyCreateSelect, 1); cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale'); cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click(); cy.wait('@orderSale'); cy.get('.q-item > .q-item__label.subtitle').then((text) => { const id = text.text().trim().split('#')[1]; cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`); }); cy.url().should('include', `/order`); }); it('create order from customer summary', function () { const clientId = 1101; cy.dataCy('Customer ID_input').type(`${clientId}{enter}`); cy.get( ':nth-child(1) > [data-col-field="clientFk"] > .no-padding > .link', ).click(); cy.get( `[href="#/order/list?createForm={%22clientFk%22:${clientId},%22addressId%22:1}"] > .q-btn__content > .q-icon`, ).click(); cy.dataCy('vnTableCreateBtn').click(); cy.get(clientCreateSelect).should('have.value', 'Bruce Wayne'); cy.get(addressCreateSelect).should('have.value', 'Bruce Wayne'); cy.dataCy('landedDate').find('input').type('06/01/2001'); cy.selectOption(agencyCreateSelect, 1); cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale'); cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click(); cy.wait('@orderSale'); cy.get('.q-item > .q-item__label.subtitle').then((text) => { const id = text.text().trim().split('#')[1]; cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`); }); cy.url().should('include', `/order`); }); });