test: refs #6321 improve

This commit is contained in:
Javier Segarra 2025-01-26 00:37:30 +01:00
parent c88be1c6a8
commit fa83c2d49c
2 changed files with 79 additions and 26 deletions

View File

@ -4,9 +4,65 @@ describe('Ticket Lack detail', () => {
const ticketId = 1; const ticketId = 1;
cy.login('developer'); cy.login('developer');
cy.visit(`/#/ticket/${ticketId}/summary`); 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');
});
describe('Table actions', () => {
it('should display only one row in the lack list', () => {
cy.visit('/#/ticket/negative/5');
cy.wait('@getItemLack');
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('Update quantity', () => { describe('Update quantity', () => {
it('Update from popover', () => {}); it('Update from popover', () => {});
it('Update from table', () => {}); it('Update from table', () => {});

View File

@ -2,37 +2,34 @@
describe('Ticket Lack list', () => { describe('Ticket Lack list', () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
}); cy.intercept('GET', /Tickets\/itemLack\?.*$/, {
statusCode: 200,
body: [
{
itemFk: 5,
longName: 'Ranged weapon pistol 9mm',
warehouseFk: 1,
producer: null,
size: 15,
category: null,
warehouse: 'Warehouse One',
lack: -50,
inkFk: 'SLV',
timed: '2025-01-25T22:59:00.000Z',
minTimed: '23:59',
originFk: 'Holand',
},
],
}).as('getLack');
cy.visit('/#/ticket/negative');
});
describe('Filters', () => {}); describe('Filters', () => {});
describe('Table actions', () => { describe('Table actions', () => {
it('should display only one row in the lack list', () => { it('should display only one row in the lack list', () => {
// Espera a que la solicitud interceptada se complete
cy.intercept('GET', /Tickets\/itemLack\?.*$/, {
statusCode: 200,
body: [
{
itemFk: 5,
longName: 'Ranged weapon pistol 9mm',
warehouseFk: 1,
producer: null,
size: 15,
category: null,
warehouse: 'Warehouse One',
lack: -50,
inkFk: 'SLV',
timed: '2025-01-25T22:59:00.000Z',
minTimed: '23:59',
originFk: 'Holand',
},
],
}).as('getLack'); // and assign an alias
cy.visit('/#/ticket/negative');
cy.wait('@getLack', { timeout: 10000 }); cy.wait('@getLack', { timeout: 10000 });
// Verifica que solo se muestre una fila en la lista
cy.get('.q-virtual-scroll__content > :nth-child(1) > .sticky').click(); cy.get('.q-virtual-scroll__content > :nth-child(1) > .sticky').click();
cy.location('href').should('contain', '#/ticket/negative/5'); cy.location('href').should('contain', '#/ticket/negative/5');
}); });