/// describe('Ticket descriptor', () => { const listItem = '[role="menu"] .q-list .q-item'; const toCloneOpt = 'To clone ticket'; const setWeightOpt = 'Set weight'; const warehouseValue = ':nth-child(1) > :nth-child(6) > .value > span'; const summaryHeader = '.summaryHeader > div'; const weight = 25; const weightValue = '.summaryBody.row :nth-child(1) > :nth-child(9) > .value > span'; beforeEach(() => { cy.login('developer'); cy.viewport(1920, 1080); }); it('should clone the ticket without warehouse', () => { cy.visit('/#/ticket/1/summary'); cy.openActionsDescriptor(); cy.contains(listItem, toCloneOpt).click(); cy.clickConfirm(); cy.get(warehouseValue).contains('Warehouse One'); cy.get(summaryHeader) .invoke('text') .then((text) => { const [, owner] = text.split('-'); cy.wrap(owner.trim()).should('eq', 'Bruce Wayne (1101)'); }); }); it('should set the weight of the ticket', () => { cy.visit('/#/ticket/10/summary'); cy.openActionsDescriptor(); cy.contains(listItem, setWeightOpt).click(); cy.intercept('POST', /\/api\/Tickets\/\d+\/setWeight/).as('weight'); cy.get('.q-dialog input').type(weight); cy.clickConfirm(); cy.wait('@weight'); cy.get(weightValue).contains(weight); }); });