warmfix: #6321 ticketNegative #1536

Open
jsegarra wants to merge 11 commits from warmfix_ticketNegative into test
2 changed files with 163 additions and 151 deletions
Showing only changes of commit 262079ce99 - Show all commits

View File

@ -1,147 +1,177 @@
/// <reference types="cypress" />
const firstRow = 'tr.cursor-pointer > :nth-child(1)';
const ticketId = 1000000;
const findTr = (index) => `tbody > tr > :nth-child(${index}) > div`;
const clickNotificationAction = () => {
const notification = '.q-notification';
cy.waitForElement(notification);
cy.get(notification).should('be.visible');
cy.get(notification).find('.q-btn').click();
cy.get(notification).should('not.be.visible');
};
describe('Ticket Lack detail', () => {
beforeEach(() => {
cy.viewport(1280, 720);
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,
hasObservation: 1,
hasToIgnore: 1,
isBasket: 1,
minTimed: 0,
customerId: 1104,
customerName: 'Tony Stark',
observationTypeCode: 'administrative',
},
],
}).as('getItemLack');
cy.intercept('GET', /\/api\/Tickets\/itemLack\/88.*$/).as('getItemLack');
cy.visit('/#/ticket/negative/88');
cy.visit('/#/ticket/negative/5');
cy.wait('@getItemLack');
cy.wait('@getItemLack').then((interception) => {
const { query } = interception.request;
const filter = JSON.parse(query.filter);
expect(filter).to.have.property('where');
expect(filter.where).to.have.property('alertLevelCode', 'FREE');
});
cy.domContentLoad();
cy.waitForElement('.q-table');
});
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');
describe('Table detail', () => {
it('should open descriptors', () => {
cy.get('.q-table').should('be.visible');
cy.colField('zoneName').click();
cy.dataCy('zoneDescriptorProxy').should('be.visible');
cy.get('.q-item > .q-item__label').should('have.text', ' #1');
cy.colField('ticketFk').click();
cy.dataCy('ticketDescriptorProxy').should('be.visible');
cy.get('.q-item > .q-item__label').should('have.text', ` #${ticketId}`);
cy.colField('nickname').find('.link').click();
cy.waitForElement('[data-cy="customerDescriptorProxy"]');
cy.dataCy('customerDescriptorProxy').should('be.visible');
cy.get('.q-item > .q-item__label').should('have.text', ' #1');
});
it('should display only one row in the lack list', () => {
cy.dataCy('changeItem').should('be.disabled');
cy.dataCy('changeState').should('be.disabled');
cy.dataCy('changeQuantity').should('be.disabled');
cy.dataCy('itemProposal').should('be.disabled');
cy.dataCy('transferLines').should('be.disabled');
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');
cy.dataCy('changeItem').should('be.enabled');
cy.dataCy('changeState').should('be.enabled');
cy.dataCy('changeQuantity').should('be.enabled');
cy.dataCy('itemProposal').should('be.enabled');
cy.dataCy('transferLines').should('be.enabled');
});
});
describe('Split', () => {
beforeEach(() => {
cy.get(firstRow).click();
cy.dataCy('transferLines').click();
});
it('Split', () => {
cy.dataCy('ticketTransferPopup').find('.flex > .q-btn').click();
clickNotificationAction();
cy.dataCy('handleSplitDialog').should('be.visible');
cy.dataCy('handleSplitDialog').find('tbody > tr > :nth-child(1) > .q-icon');
cy.dataCy('handleSplitDialog').find(findTr(2)).should('have.class', 'link');
cy.dataCy('handleSplitDialog')
.find(`${findTr(2)}.link > div > span`)
.should('have.text', `${ticketId} `);
cy.dataCy('handleSplitDialog').find(findTr(3)).should('have.text', 'noSplit');
});
});
describe('Change Item', () => {
beforeEach(() => {
cy.get(firstRow).click();
cy.dataCy('changeItem').click();
});
it('Change failed', () => {
cy.dataCy('New item_select').should('be.visible').click();
cy.get('.q-item').contains('Palito rojo').click();
cy.get('.q-btn--unelevated > .q-btn__content > .block').click();
clickNotificationAction();
cy.dataCy('handleSplitDialog').should('be.visible');
cy.dataCy('handleSplitDialog').find('tbody > tr > :nth-child(1) > .q-icon');
cy.dataCy('handleSplitDialog').find(findTr(2)).should('have.class', 'link');
cy.dataCy('handleSplitDialog')
.find(`${findTr(2)}.link > span`)
.should('have.text', `${ticketId}`);
cy.dataCy('handleSplitDialog')
.find(findTr(3))
.should('have.text', 'price retrieval failed');
});
});
describe('Change state', () => {
beforeEach(() => {
cy.get(firstRow).click();
cy.dataCy('changeState').click();
});
it('Change success', () => {
cy.dataCy('New state_select').should('be.visible').click();
cy.get('.q-item').contains('OK').click();
cy.get('.q-btn--unelevated > .q-btn__content > .block').click();
clickNotificationAction();
cy.dataCy('handleSplitDialog')
.should('be.visible')
.find('tbody > tr > :nth-child(1) > .q-icon');
cy.dataCy('handleSplitDialog').find(findTr(2)).should('have.class', 'link');
cy.dataCy('handleSplitDialog')
.find(`${findTr(2)}.link > div > span`)
.should('have.text', `${ticketId} `);
cy.dataCy('handleSplitDialog').find(findTr(3)).should('have.text', 'OK');
});
});
describe('change quantity', () => {
beforeEach(() => {
cy.get(firstRow).click();
cy.dataCy('changeQuantity').click();
});
it('Change success', () => {
cy.dataCy('New quantity_input').type(10);
cy.get('.q-btn--unelevated > .q-btn__content > .block').click();
clickNotificationAction();
cy.dataCy('handleSplitDialog')
.should('be.visible')
.find('tbody > tr > :nth-child(1) > .q-icon');
cy.dataCy('handleSplitDialog').find(findTr(2)).should('have.class', 'link');
cy.dataCy('handleSplitDialog')
.find(`${findTr(2)}.link > div > span`)
.should('have.text', `${ticketId} `);
cy.dataCy('handleSplitDialog').find(findTr(3)).should('have.text', '10');
});
});
describe('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');
cy.get(firstRow).click();
cy.dataCy('itemProposal').click();
});
describe('Replace item if', () => {
it.only('Quantity is less than available', () => {
it.skip('Quantity is less than available', () => {
cy.get(':nth-child(1) > .text-right > .q-btn').click();
});
it('item proposal cells', () => {
cy.get(
':nth-child(1) > .q-table--col-auto-width > .q-btn > .q-btn__content > .q-icon',
).should('not.be.visible');
cy.get('[data-col-field="longName"] .link').first().click();
cy.dataCy('itemDescriptorProxy').should('be.visible');
cy.colField('longName', 2)
.find('.no-padding > .q-td > .middle')
.should('have.class', 'proposal-primary');
cy.colField('tag5', 2)
.find('.no-padding > .match')
.should('have.class', 'match');
cy.colField('tag6', 2)
.find('.no-padding > .match')
.should('have.class', 'match');
cy.colField('tag7', 2).click();
});
});
});
});

View File

@ -1,34 +1,16 @@
/// <reference types="cypress" />
describe('Ticket Lack list', () => {
beforeEach(() => {
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.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/ticket/negative');
});
describe('Table actions', () => {
it('should display only one row in the lack list', () => {
cy.wait('@getLack', { timeout: 10000 });
cy.get('[data-col-field="longName"]').first().click();
cy.dataCy('itemDescriptorProxy').should('be.visible');
cy.get('.q-virtual-scroll__content > :nth-child(1) > .sticky').click();
cy.location('href').should('contain', '#/ticket/negative/5');
});