155 lines
5.9 KiB
JavaScript
155 lines
5.9 KiB
JavaScript
/// <reference types="cypress" />
|
|
const firstRow = 'tr.cursor-pointer > :nth-child(1)';
|
|
const ticketId = 1000000;
|
|
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', { testIsolation: true }, () => {
|
|
beforeEach(() => {
|
|
cy.viewport(1980, 1020);
|
|
cy.login('developer');
|
|
cy.intercept('GET', /\/api\/Tickets\/itemLack\/88.*$/).as('getItemLack');
|
|
cy.visit('/#/ticket/negative/88');
|
|
|
|
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');
|
|
});
|
|
});
|
|
describe('Table detail', () => {
|
|
it('should open descriptors', () => {
|
|
cy.get('.q-table').should('be.visible');
|
|
cy.colField('zoneName').click();
|
|
cy.dataCy('ZoneDescriptor').should('be.visible');
|
|
cy.get('.q-item > .q-item__label').should('have.text', ' #1');
|
|
cy.colField('ticketFk').click();
|
|
cy.dataCy('TicketDescriptor').should('be.visible');
|
|
cy.get('.q-item > .q-item__label').should('have.text', ` #${ticketId}`);
|
|
cy.colField('nickname').find('.link').click();
|
|
cy.waitForElement('[data-cy="CustomerDescriptor"]');
|
|
cy.dataCy('CustomerDescriptor').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.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();
|
|
|
|
cy.checkNotification('Ticket 1000000: No split');
|
|
});
|
|
});
|
|
describe('change quantity', () => {
|
|
beforeEach(() => {
|
|
cy.get(firstRow).click();
|
|
|
|
cy.dataCy('changeQuantity').click();
|
|
});
|
|
|
|
it('by popup', () => {
|
|
cy.dataCy('New quantity_input').type(10);
|
|
cy.get('.q-btn--unelevated > .q-btn__content > .block').click();
|
|
|
|
clickNotificationAction();
|
|
});
|
|
});
|
|
describe('Change state', () => {
|
|
beforeEach(() => {
|
|
cy.get(firstRow).click();
|
|
cy.dataCy('changeState').click();
|
|
});
|
|
it('by popup', () => {
|
|
cy.dataCy('New state_select').should('be.visible');
|
|
cy.selectOption('[data-cy="New state_select"]', 'OK');
|
|
cy.get('.q-btn--unelevated > .q-btn__content > .block').click();
|
|
|
|
clickNotificationAction();
|
|
});
|
|
});
|
|
describe('Change Item', () => {
|
|
beforeEach(() => {
|
|
cy.get(firstRow).click();
|
|
cy.dataCy('changeItem').click();
|
|
});
|
|
it('by popup', () => {
|
|
cy.dataCy('New item_select').should('be.visible');
|
|
|
|
cy.selectOption('[data-cy="New item_select"]', 'Palito rojo');
|
|
cy.get('.q-btn--unelevated > .q-btn__content > .block').click();
|
|
cy.checkNotification('Ticket 43: price retrieval failed');
|
|
cy.dataCy('changeItem').click();
|
|
cy.selectOption('[data-cy="New item_select"]', 'Ranged weapon longbow 200cm');
|
|
cy.get('.q-btn--unelevated > .q-btn__content > .block').click();
|
|
|
|
clickNotificationAction();
|
|
});
|
|
after(() => {
|
|
cy.visit('/#/ticket/1000000/sale');
|
|
const quantity = Math.floor(Math.random() * 100) + 1;
|
|
|
|
cy.dataCy('ticketSaleQuantityInput')
|
|
.find('input')
|
|
.eq(1)
|
|
.type(quantity)
|
|
.trigger('tab');
|
|
cy.get('.q-page > :nth-child(6)').click();
|
|
|
|
cy.get('[data-cy="ticketSaleQuantityInput"]')
|
|
.find('input')
|
|
.should('have.value', `${quantity}`);
|
|
});
|
|
});
|
|
|
|
describe('Item proposal', () => {
|
|
beforeEach(() => {
|
|
cy.get(firstRow).click();
|
|
cy.dataCy('itemProposal').click();
|
|
});
|
|
describe('Replace item if', () => {
|
|
it.skip('Quantity is less than available', () => {
|
|
cy.get(':nth-child(1) > .text-right > .q-btn').click();
|
|
});
|
|
|
|
it('item proposal cells', () => {
|
|
cy.get('[data-col-field="longName"] .link').first().click();
|
|
|
|
cy.dataCy('ItemDescriptor').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();
|
|
});
|
|
});
|
|
});
|
|
});
|