From 100a380f9584b536daa5ce3448b9eed77e92e73e Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Sun, 26 Jan 2025 02:36:10 +0100 Subject: [PATCH] test: refs #6321 itemProposal --- .../ticket/negative/TicketLackDetail.spec.js | 111 ++++++++++++++++-- 1 file changed, 102 insertions(+), 9 deletions(-) diff --git a/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js b/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js index 29b653bf6..76396ad9c 100644 --- a/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js +++ b/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js @@ -40,12 +40,10 @@ describe('Ticket Lack detail', () => { }).as('getItemLack'); // and assign an alias cy.visit('/#/ticket/negative/5'); + cy.wait('@getItemLack'); }); describe('Table actions', () => { - it('should display only one row in the lack list', () => { - cy.visit('/#/ticket/negative/5'); - - cy.wait('@getItemLack'); + 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'); @@ -63,23 +61,118 @@ describe('Ticket Lack detail', () => { cy.get('[data-cy="transferLines"]').should('be.enabled'); }); }); - describe('Update quantity', () => { + describe.skip('Update quantity', () => { it('Update from popover', () => {}); it('Update from table', () => {}); }); - describe('Update state', () => { + describe.skip('Update state', () => { it('Update from popover', () => {}); it('Update from table', () => {}); }); - describe('Ticket transfer', () => { + 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('Item proposal', () => { + 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('Quantity is less than available', () => {}); + 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', () => {}); });