2024-11-11 18:18:29 +00:00
|
|
|
/// <reference types="cypress" />
|
2024-11-17 18:24:46 +00:00
|
|
|
describe('TicketList', () => {
|
2024-11-11 18:18:29 +00:00
|
|
|
const firstRow = 'tbody > :nth-child(1)';
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.login('developer');
|
|
|
|
cy.viewport(1920, 1080);
|
|
|
|
cy.visit('/#/ticket/list');
|
|
|
|
});
|
|
|
|
|
|
|
|
const searchResults = (search) => {
|
|
|
|
cy.dataCy('vnSearchBar').find('input').focus();
|
|
|
|
if (search) cy.dataCy('vnSearchBar').find('input').type(search);
|
|
|
|
cy.dataCy('vnSearchBar').find('input').type('{enter}');
|
|
|
|
cy.dataCy('ticketListTable').should('exist');
|
|
|
|
cy.get(firstRow).should('exist');
|
|
|
|
};
|
|
|
|
|
|
|
|
it('should search results', () => {
|
|
|
|
cy.dataCy('ticketListTable').should('not.exist');
|
|
|
|
cy.get('.q-field__control').should('exist');
|
|
|
|
searchResults();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should open ticket sales', () => {
|
|
|
|
searchResults();
|
|
|
|
cy.window().then((win) => {
|
|
|
|
cy.stub(win, 'open').as('windowOpen');
|
|
|
|
});
|
|
|
|
cy.get(firstRow).find('.q-btn:first').click();
|
|
|
|
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should open ticket summary', () => {
|
|
|
|
searchResults();
|
|
|
|
cy.get(firstRow).find('.q-btn:last').click();
|
|
|
|
cy.dataCy('ticketSummary').should('exist');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Client list create new client', () => {
|
|
|
|
cy.dataCy('vnTableCreateBtn').should('exist');
|
|
|
|
cy.dataCy('vnTableCreateBtn').click();
|
|
|
|
const data = {
|
|
|
|
Customer: { val: 1, type: 'select' },
|
|
|
|
Warehouse: { val: 'Warehouse One', type: 'select' },
|
2024-11-18 13:41:27 +00:00
|
|
|
Address: { val: 'employee', type: 'select' },
|
2024-11-11 18:18:29 +00:00
|
|
|
Landed: { val: '01-01-2024', type: 'date' },
|
|
|
|
};
|
|
|
|
cy.fillInForm(data);
|
2024-12-03 14:35:24 +00:00
|
|
|
cy.dataCy('Agency_select').click();
|
|
|
|
cy.dataCy('FormModelPopup_save').click();
|
2024-11-11 18:18:29 +00:00
|
|
|
cy.checkNotification('Data created');
|
|
|
|
cy.url().should('match', /\/ticket\/\d+\/summary/);
|
|
|
|
});
|
|
|
|
});
|