/// describe('Ticket Lack detail', () => { beforeEach(() => { const ticketId = 1; cy.login('developer'); cy.intercept('GET', /\/api\/Tickets\/itemLack\/5.*$/, { statusCode: 200, body: [ { saleFk: 33, code: 'OK', ticketFk: 142, nickname: 'Malibu Point', shipped: '2000-12-31T23:00:00.000Z', hour: 0, quantity: 50, agName: 'Super-Man delivery', alertLevel: 0, stateName: 'OK', stateId: 3, itemFk: 5, price: 1.79, alertLevelCode: 'FREE', zoneFk: 9, zoneName: 'Zone superMan', theoreticalhour: '2011-11-01T22:59:00.000Z', isRookie: 1, turno: 1, peticionCompra: 1, hasSubstitution: 1, hasToIgnore: 1, isBasket: 1, minTimed: 0, customerId: 1104, customerName: 'Tony Stark', observationTypeCode: 'administrative', }, ], }).as('getItemLack'); // and assign an alias cy.visit('/#/ticket/negative/5'); cy.wait('@getItemLack'); }); describe('Table actions', () => { it.skip('should display only one row in the lack list', () => { cy.location('href').should('contain', '#/ticket/negative/5'); cy.get('[data-cy="changeItem"]').should('be.disabled'); cy.get('[data-cy="changeState"]').should('be.disabled'); cy.get('[data-cy="changeQuantity"]').should('be.disabled'); cy.get('[data-cy="itemProposal"]').should('be.disabled'); cy.get('[data-cy="transferLines"]').should('be.disabled'); // WIP // cy.get('[data-cy="showFree"] > .q-checkbox__inner').should('be.checked'); cy.get('tr.cursor-pointer > :nth-child(1)').click(); cy.get('[data-cy="changeItem"]').should('be.enabled'); cy.get('[data-cy="changeState"]').should('be.enabled'); cy.get('[data-cy="changeQuantity"]').should('be.enabled'); cy.get('[data-cy="itemProposal"]').should('be.enabled'); cy.get('[data-cy="transferLines"]').should('be.enabled'); }); }); describe.skip('Update quantity', () => { it('Update from popover', () => {}); it('Update from table', () => {}); }); describe.skip('Update state', () => { it('Update from popover', () => {}); it('Update from table', () => {}); }); describe.skip('Ticket transfer', () => { describe('Split ticket if ', () => { it('Ticket has less or equal than 1 row', () => {}); it('Ticket has more than 1 row', () => {}); }); }); describe.only('Item proposal', () => { beforeEach(() => { cy.get('tr.cursor-pointer > :nth-child(1)').click(); cy.intercept('GET', /\/api\/Items\/getSimilar\?.*$/, { statusCode: 200, body: [ { id: 1, longName: 'Ranged weapon longbow 50cm', subName: 'Stark Industries', tag5: 'Color', value5: 'Brown', match5: 0, match6: 0, match7: 0, match8: 1, tag6: 'Categoria', value6: '+1 precission', tag7: 'Tallos', value7: '1', tag8: null, value8: null, available: 20, calc_id: 6, counter: 0, minQuantity: 1, visible: null, price2: 1, }, { id: 2, longName: 'Ranged weapon longbow 100cm', subName: 'Stark Industries', tag5: 'Color', value5: 'Brown', match5: 0, match6: 1, match7: 0, match8: 1, tag6: 'Categoria', value6: '+1 precission', tag7: 'Tallos', value7: '1', tag8: null, value8: null, available: 50, calc_id: 6, counter: 1, minQuantity: 5, visible: null, price2: 10, }, { id: 3, longName: 'Ranged weapon longbow 200cm', subName: 'Stark Industries', tag5: 'Color', value5: 'Brown', match5: 1, match6: 1, match7: 1, match8: 1, tag6: 'Categoria', value6: '+1 precission', tag7: 'Tallos', value7: '1', tag8: null, value8: null, available: 185, calc_id: 6, counter: 10, minQuantity: 10, visible: null, price2: 100, }, ], }).as('getItemGetSimilar'); cy.get('[data-cy="itemProposal"]').click(); cy.wait('@getItemGetSimilar'); }); describe('Replace item if', () => { it.only('Quantity is less than available', () => { /* ==== Generated with Cypress Studio ==== */ cy.get( ':nth-child(2) > .text-left > .q-td > [data-cy="replaceBtn"]', ).should('not.have.class', 'fill-icon'); cy.get( ':nth-child(2) > .text-left > .q-td > [data-cy="replaceBtn"] > .q-btn__content > .q-icon', ).click(); cy.get( ':nth-child(2) > .text-left > .q-td > [data-cy="replaceBtn"]', ).should('have.class', 'fill-icon'); cy.get( ':nth-child(2) > .text-left > .q-td > [data-cy="replaceBtn"] > .q-btn__content > .q-icon', ).click(); /* ==== End Cypress Studio ==== */ }); it('Quantity is equal than available', () => {}); it('Quantity is more than available', () => {}); }); }); });