salix-front/test/cypress/integration/ticket/negative/TicketLackDetail.spec.js

181 lines
7.0 KiB
JavaScript
Raw Normal View History

2024-06-19 22:01:12 +00:00
/// <reference types="cypress" />
describe('Ticket Lack detail', () => {
beforeEach(() => {
const ticketId = 1;
cy.login('developer');
2025-01-25 23:37:30 +00:00
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');
2025-01-26 01:36:10 +00:00
cy.wait('@getItemLack');
2024-06-19 22:01:12 +00:00
});
2025-01-25 23:37:30 +00:00
describe('Table actions', () => {
2025-01-26 01:36:10 +00:00
it.skip('should display only one row in the lack list', () => {
2025-01-25 23:37:30 +00:00
cy.location('href').should('contain', '#/ticket/negative/5');
2024-06-19 22:01:12 +00:00
2025-01-25 23:37:30 +00:00
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');
});
});
2025-01-26 01:36:10 +00:00
describe.skip('Update quantity', () => {
2024-06-19 22:01:12 +00:00
it('Update from popover', () => {});
it('Update from table', () => {});
});
2025-01-26 01:36:10 +00:00
describe.skip('Update state', () => {
2024-06-19 22:01:12 +00:00
it('Update from popover', () => {});
it('Update from table', () => {});
});
2025-01-26 01:36:10 +00:00
describe.skip('Ticket transfer', () => {
2024-06-19 22:01:12 +00:00
describe('Split ticket if ', () => {
it('Ticket has less or equal than 1 row', () => {});
it('Ticket has more than 1 row', () => {});
});
});
2025-01-26 01:36:10 +00:00
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');
});
2024-06-19 22:01:12 +00:00
describe('Replace item if', () => {
2025-01-26 01:36:10 +00:00
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 ==== */
});
2024-06-19 22:01:12 +00:00
it('Quantity is equal than available', () => {});
it('Quantity is more than available', () => {});
});
});
});