2024-11-17 18:24:46 +00:00
|
|
|
/// <reference types="cypress" />
|
|
|
|
|
|
|
|
describe('TicketSale', () => {
|
2025-02-19 22:42:10 +00:00
|
|
|
describe('Free ticket #31', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.login('developer');
|
|
|
|
cy.viewport(1920, 1080);
|
|
|
|
cy.visit('/#/ticket/31/sale');
|
2025-03-03 21:01:30 +00:00
|
|
|
cy.domContentLoad();
|
2025-02-19 22:42:10 +00:00
|
|
|
});
|
2024-11-17 18:24:46 +00:00
|
|
|
|
2025-02-19 22:42:10 +00:00
|
|
|
const firstRow = 'tbody > :nth-child(1)';
|
2024-11-17 18:24:46 +00:00
|
|
|
|
2025-02-19 22:42:10 +00:00
|
|
|
const selectFirstRow = () => {
|
|
|
|
cy.waitForElement(firstRow);
|
|
|
|
cy.get(firstRow).find('.q-checkbox__inner').click();
|
|
|
|
};
|
2024-11-17 18:24:46 +00:00
|
|
|
|
2025-02-19 22:42:10 +00:00
|
|
|
it('it should add item to basket', () => {
|
|
|
|
cy.window().then((win) => {
|
|
|
|
cy.stub(win, 'open').as('windowOpen');
|
|
|
|
});
|
|
|
|
cy.dataCy('ticketSaleAddToBasketBtn').should('exist');
|
|
|
|
cy.dataCy('ticketSaleAddToBasketBtn').click();
|
|
|
|
cy.get('@windowOpen').should('be.calledWithMatch', /\/order\/\d+\/catalog/);
|
2024-11-17 18:24:46 +00:00
|
|
|
});
|
|
|
|
|
2025-02-19 22:42:10 +00:00
|
|
|
it('should send SMS', () => {
|
|
|
|
selectFirstRow();
|
|
|
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
|
|
|
cy.waitForElement('[data-cy="sendShortageSMSItem"]');
|
|
|
|
cy.dataCy('sendShortageSMSItem').should('exist');
|
|
|
|
cy.dataCy('sendShortageSMSItem').click();
|
|
|
|
cy.dataCy('vnSmsDialog').should('exist');
|
|
|
|
cy.dataCy('sendSmsBtn').click();
|
|
|
|
cy.checkNotification('SMS sent');
|
|
|
|
});
|
2024-11-17 18:24:46 +00:00
|
|
|
|
2025-02-19 22:42:10 +00:00
|
|
|
it('should recalculate price when "Recalculate price" is clicked', () => {
|
|
|
|
cy.intercept('POST', '**/recalculatePrice').as('recalculatePrice');
|
|
|
|
selectFirstRow();
|
|
|
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
|
|
|
cy.waitForElement('[data-cy="recalculatePriceItem"]');
|
|
|
|
cy.dataCy('recalculatePriceItem').should('exist');
|
|
|
|
cy.dataCy('recalculatePriceItem').click();
|
|
|
|
cy.wait('@recalculatePrice').its('response.statusCode').should('eq', 200);
|
|
|
|
cy.checkNotification('Data saved');
|
|
|
|
});
|
2024-11-17 18:24:46 +00:00
|
|
|
|
2025-02-19 22:42:10 +00:00
|
|
|
it('should update discount when "Update discount" is clicked', () => {
|
|
|
|
selectFirstRow();
|
|
|
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
|
|
|
cy.waitForElement('[data-cy="updateDiscountItem"]');
|
|
|
|
cy.dataCy('updateDiscountItem').should('exist');
|
|
|
|
cy.dataCy('updateDiscountItem').click();
|
|
|
|
cy.waitForElement('[data-cy="ticketSaleDiscountInput"]');
|
|
|
|
cy.dataCy('ticketSaleDiscountInput').find('input').focus();
|
|
|
|
cy.dataCy('ticketSaleDiscountInput').find('input').type('10');
|
|
|
|
cy.dataCy('saveManaBtn').click();
|
|
|
|
cy.waitForElement('.q-notification__message');
|
|
|
|
cy.checkNotification('Data saved');
|
|
|
|
});
|
2024-11-20 21:58:08 +00:00
|
|
|
|
2025-02-19 22:42:10 +00:00
|
|
|
it('adds claim', () => {
|
|
|
|
selectFirstRow();
|
|
|
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
|
|
|
cy.dataCy('createClaimItem').click();
|
|
|
|
cy.dataCy('VnConfirm_confirm').click();
|
|
|
|
cy.url().should('contain', 'claim/');
|
|
|
|
// Delete created claim to avoid cluttering the database
|
|
|
|
cy.dataCy('descriptor-more-opts').click();
|
|
|
|
cy.dataCy('deleteClaim').click();
|
|
|
|
cy.dataCy('VnConfirm_confirm').click();
|
|
|
|
cy.checkNotification('Data deleted');
|
|
|
|
});
|
2024-11-20 21:58:08 +00:00
|
|
|
|
2025-02-19 22:42:10 +00:00
|
|
|
it('marks row as reserved', () => {
|
|
|
|
selectFirstRow();
|
|
|
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
|
|
|
cy.waitForElement('[data-cy="markAsReservedItem"]');
|
|
|
|
cy.dataCy('markAsReservedItem').click();
|
|
|
|
cy.dataCy('ticketSaleReservedIcon').should('exist');
|
|
|
|
});
|
2024-11-20 21:58:08 +00:00
|
|
|
|
2025-02-19 22:42:10 +00:00
|
|
|
it('unmarks row as reserved', () => {
|
|
|
|
selectFirstRow();
|
|
|
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
|
|
|
cy.waitForElement('[data-cy="unmarkAsReservedItem"]');
|
|
|
|
cy.dataCy('unmarkAsReservedItem').click();
|
|
|
|
cy.dataCy('ticketSaleReservedIcon').should('not.exist');
|
|
|
|
});
|
2024-11-20 21:58:08 +00:00
|
|
|
|
2025-02-19 22:42:10 +00:00
|
|
|
it('refunds row with warehouse', () => {
|
|
|
|
selectFirstRow();
|
|
|
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
|
|
|
cy.dataCy('ticketSaleRefundItem').click();
|
|
|
|
cy.dataCy('ticketSaleRefundWithWarehouse').click();
|
|
|
|
cy.checkNotification('The following refund ticket have been created');
|
|
|
|
});
|
2024-11-20 21:58:08 +00:00
|
|
|
|
2025-02-19 22:42:10 +00:00
|
|
|
it('refunds row without warehouse', () => {
|
|
|
|
selectFirstRow();
|
|
|
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
|
|
|
cy.dataCy('ticketSaleRefundItem').click();
|
|
|
|
cy.dataCy('ticketSaleRefundWithoutWarehouse').click();
|
|
|
|
cy.checkNotification('The following refund ticket have been created');
|
|
|
|
});
|
2024-11-20 21:58:08 +00:00
|
|
|
|
2025-02-19 22:42:10 +00:00
|
|
|
it('transfer sale to a new ticket', () => {
|
|
|
|
cy.visit('/#/ticket/32/sale');
|
|
|
|
cy.get('.q-item > .q-item__label').should('have.text', ' #32');
|
|
|
|
selectFirstRow();
|
|
|
|
cy.dataCy('ticketSaleTransferBtn').click();
|
|
|
|
cy.dataCy('ticketTransferPopup').should('exist');
|
|
|
|
cy.dataCy('ticketTransferNewTicketBtn').click();
|
|
|
|
cy.get('.q-item > .q-item__label').should('not.have.text', ' #32');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should redirect to ticket logs', () => {
|
|
|
|
cy.get(firstRow).find('.q-btn:last').click();
|
|
|
|
cy.url().should('match', /\/ticket\/31\/log/);
|
|
|
|
});
|
2024-11-20 21:58:08 +00:00
|
|
|
});
|
2025-02-19 22:54:31 +00:00
|
|
|
describe('Ticket prepared #23', () => {
|
2025-02-19 22:42:10 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
cy.login('developer');
|
|
|
|
cy.viewport(1920, 1080);
|
|
|
|
cy.visit('/#/ticket/23/sale');
|
|
|
|
});
|
|
|
|
|
|
|
|
const firstRow = 'tbody > :nth-child(1)';
|
|
|
|
|
|
|
|
const selectFirstRow = () => {
|
|
|
|
cy.waitForElement(firstRow);
|
|
|
|
cy.get(firstRow).find('.q-checkbox__inner').click();
|
|
|
|
};
|
|
|
|
|
|
|
|
it('update price', () => {
|
|
|
|
const price = Number((Math.random() * 99 + 1).toFixed(2));
|
|
|
|
cy.waitForElement(firstRow);
|
2025-03-03 21:47:47 +00:00
|
|
|
cy.get('[data-col-field="price"]').find('.q-btn').click();
|
2025-02-19 22:42:10 +00:00
|
|
|
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
|
|
|
cy.dataCy('ticketEditManaProxy').should('exist');
|
|
|
|
cy.waitForElement('[data-cy="Price_input"]');
|
|
|
|
cy.dataCy('Price_input').clear();
|
|
|
|
cy.dataCy('Price_input').type(price);
|
|
|
|
cy.dataCy('saveManaBtn').click();
|
|
|
|
handleVnConfirm();
|
|
|
|
|
2025-03-03 21:47:47 +00:00
|
|
|
cy.get('[data-col-field="price"]')
|
|
|
|
.find('.q-btn > .q-btn__content')
|
|
|
|
.should('have.text', `€${price}`);
|
2025-02-19 22:42:10 +00:00
|
|
|
});
|
2025-03-03 21:47:47 +00:00
|
|
|
it('update discount', () => {
|
2025-02-19 22:42:10 +00:00
|
|
|
const discount = Math.floor(Math.random() * 100) + 1;
|
|
|
|
selectFirstRow();
|
2025-03-03 21:47:47 +00:00
|
|
|
cy.get('[data-col-field="discount"]').find('.q-btn').click();
|
2025-02-19 22:42:10 +00:00
|
|
|
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
|
|
|
cy.dataCy('ticketEditManaProxy').should('exist');
|
|
|
|
cy.waitForElement('[data-cy="Disc_input"]');
|
|
|
|
cy.dataCy('Disc_input').clear();
|
|
|
|
cy.dataCy('Disc_input').type(discount);
|
|
|
|
cy.dataCy('saveManaBtn').click();
|
|
|
|
handleVnConfirm();
|
2024-11-20 21:58:08 +00:00
|
|
|
|
2025-03-03 21:47:47 +00:00
|
|
|
cy.get('[data-col-field="discount"]')
|
|
|
|
.find('.q-btn > .q-btn__content')
|
|
|
|
.should('have.text', `${discount}.00%`);
|
2025-02-19 22:42:10 +00:00
|
|
|
});
|
|
|
|
|
2025-03-03 22:35:29 +00:00
|
|
|
it('change concept', () => {
|
2025-03-03 21:47:47 +00:00
|
|
|
const concept = Math.floor(Math.random() * 100) + 1;
|
2025-02-19 22:42:10 +00:00
|
|
|
cy.waitForElement(firstRow);
|
2025-03-03 21:47:47 +00:00
|
|
|
cy.get('[data-col-field="item"]').click();
|
|
|
|
cy.get('.q-menu')
|
|
|
|
.find('[data-cy="undefined_input"]')
|
|
|
|
.type(concept)
|
2025-02-19 22:42:10 +00:00
|
|
|
.type('{enter}');
|
|
|
|
handleVnConfirm();
|
|
|
|
|
2025-03-03 21:47:47 +00:00
|
|
|
cy.get('[data-col-field="item"]').should('contain.text', `${concept}`);
|
2025-02-19 22:42:10 +00:00
|
|
|
});
|
2025-03-03 21:47:47 +00:00
|
|
|
it('change quantity ', () => {
|
2025-02-19 22:42:10 +00:00
|
|
|
const quantity = Math.floor(Math.random() * 100) + 1;
|
|
|
|
cy.waitForElement(firstRow);
|
|
|
|
cy.dataCy('ticketSaleQuantityInput').clear();
|
|
|
|
cy.dataCy('ticketSaleQuantityInput').type(quantity).trigger('tab');
|
|
|
|
cy.get('.q-page > :nth-child(6)').click();
|
|
|
|
|
|
|
|
handleVnConfirm();
|
|
|
|
|
|
|
|
cy.get('[data-cy="ticketSaleQuantityInput"]')
|
|
|
|
.find('[data-cy="undefined_input"]')
|
|
|
|
.should('have.value', `${quantity}`);
|
|
|
|
});
|
2024-11-20 21:58:08 +00:00
|
|
|
});
|
2024-11-17 18:24:46 +00:00
|
|
|
});
|
2025-02-19 22:42:10 +00:00
|
|
|
|
|
|
|
function handleVnConfirm() {
|
2025-03-03 21:47:47 +00:00
|
|
|
cy.get('[data-cy="VnConfirm_confirm"]').click();
|
2025-02-19 22:42:10 +00:00
|
|
|
cy.waitForElement('.q-notification__message');
|
|
|
|
|
|
|
|
cy.get('.q-notification__message').should('be.visible');
|
|
|
|
cy.checkNotification('Data saved');
|
|
|
|
}
|