#8582 - test: e2e monitorTicket #1391

Merged
jsegarra merged 51 commits from e2e_monitor into dev 2025-04-15 21:04:49 +00:00
2 changed files with 155 additions and 213 deletions
Showing only changes of commit cfccc74710 - Show all commits

View File

@ -38,222 +38,156 @@ describe('Monitor Tickets Table', () => {
.find('.q-item__label')
.contains('Bruce Wayne')
.click();
cy.get(
'[data-cy="column-filter-clientFk"] > [data-v-532139db=""] > .column > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .q-icon',
).click();
cy.get(
'[data-cy="column-filter-id"] > [data-v-532139db=""] > .column > [dense="true"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="_input"]',
).clear('1');
cy.get(
'[data-cy="column-filter-clientFk"] > [data-v-532139db=""] > .column > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > [data-cy="_select"]',
).clear('1');
cy.get(
'[data-cy="column-filter-clientFk"] > [data-v-532139db=""] > .column > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > [data-cy="_select"]',
{ timeout: 3000 },
).type('1101');
cy.get('.q-item__label--caption').click();
cy.get(
'[data-cy="column-filter-salesPersonFk"] > [data-v-532139db=""] > .column > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > [data-cy="_select"]',
).click();
cy.get(
'#f_0ab28e51-61ef-42fd-98cf-5c145672132a_1 > .q-item__section > :nth-child(1)',
).click();
cy.get(
'[data-cy="column-filter-provinceFk"] > [data-v-532139db=""] > .column > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > [data-cy="_select"]',
).click();
cy.get('#f_7e2e6ebc-5a8e-40e6-a436-b301a249090e_2 > .q-item__section').click();
cy.get(
'[data-cy="column-filter-state"] > [data-v-532139db=""] > .column > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > [data-cy="_select"]',
).click();
cy.get('.q-table__top').click();
cy.get(
'[data-cy="column-filter-state"] > [data-v-532139db=""] > .column > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > [data-cy="_select"]',
).click();
cy.get(
'#f_e05db3bc-1bae-4398-8e06-a9395e8f9e30_13 > .q-item__section > :nth-child(1)',
).click();
cy.get('.q-ml-sm > .q-btn__content > .q-icon').click();
/* ==== End Cypress Studio ==== */
});
describe('should filter by filter panel', () => {
it('clientFk', () => {
// Client id - clientFk
cy.get('[data-cy="Client id_input"]').type('1101');
cy.searchInFilterPanel();
requestParams('clientFk', '1101');
countRows('eq', 7);
});
it('orderFk', () => {
// order id
cy.get('[data-cy="Order id_input"]').type(7);
cy.searchInFilterPanel();
requestParams('orderFk', '7');
countRows('eq', 1);
});
it('scopeDays', () => {
// Scope days
cy.get('[data-cy="Days onward_input"]').type(2);
cy.searchInFilterPanel();
requestParams('scopeDays', '2');
countRows('eq', 27);
});
it('salesPersonFk', () => {
// SalesPerson
cy.get('[data-cy="vnWorkerSelect"]').click();
cy.get('.q-item__label').contains('salesPersonNick').click();
cy.searchInFilterPanel();
requestParams('c.salesPersonFk', 18, { inWhere: true });
countRows('eq', 21);
});
// it('', () => {
// cy.get('.q-mt-xs > .q-item__section--side').click();
// requestParams(null);
// });
it('nickname', () => {
// Nickname
cy.get('[data-cy="Nickname_input"]').type('test');
cy.searchInFilterPanel();
requestParams('t.nickname', 'test', { inWhere: true, like: true });
countRows('eq', 2);
});
it('refFk', () => {
// Invoice
cy.get('[data-cy="Invoice_input"]').type('test');
cy.searchInFilterPanel();
requestParams('refFk', 'test');
countRows('eq', 0);
});
it('agencyModeFk', () => {
// Agency
cy.get('[data-cy="Agency_select"]').click();
cy.get('.q-item__label').contains('inhouse pickup').click();
cy.searchInFilterPanel();
requestParams('agencyModeFk', '1');
countRows('eq', 6);
});
// it('', () => {
// cy.get('.q-mt-xs > .q-item__section--side').click();
// requestParams(null);
// });
it('state', () => {
// State
cy.get('[data-cy="State_select"]').click();
cy.get('.q-item__label').contains('Libre').click();
cy.searchInFilterPanel();
requestParams('ts.stateFk', 2, { inWhere: true });
countRows('eq', 11);
});
it('alertLevel', () => {
// AlertLevel
cy.get('[data-cy="Grouped State_select"]').click();
cy.get('.q-item__label').contains('Free').click();
cy.searchInFilterPanel();
requestParams('alertLevel', '0');
countRows('eq', 16);
});
// it('', () => {
// cy.get('.q-mt-xs > .q-item__section--side').click();
// requestParams(null);
// });
it('countryFk', () => {
// Country
cy.get('[data-cy="Country_select"]').click();
cy.get('.q-item__label').contains('España').click();
cy.searchInFilterPanel();
requestParams('countryFk', '1');
countRows('eq', 26);
});
it('warehouseFk', () => {
// Province
cy.get('[data-cy="Province_select"]').click();
cy.get('.q-item__label').contains('Province one').click();
cy.searchInFilterPanel();
requestParams('warehouseFk', 1);
countRows('eq', 2);
});
it('department', () => {
// Department
cy.get('[data-cy="Department_select"]').click();
cy.get('.q-item__label').contains('VENTAS').click();
cy.searchInFilterPanel();
requestParams('d.name', 'VENTAS', { inWhere: true });
countRows('eq', 24);
});
it('packing', () => {
// ITP
cy.get('[data-cy="ITP_select"]').click();
cy.get('.q-item__label').contains('H').click();
cy.searchInFilterPanel();
requestParams('packing', 'H');
countRows('eq', 5);
});
});
it('Cols', () => {
cy.get(firstRow('totalProblems'));
cy.get(firstRow('id')).find('span').should('have.class', 'link').click();
cy.dataCy('TicketDescriptor').should('exist');
cy.get(firstRow('clientFk')).find('span').should('have.class', 'link').click();
cy.dataCy('CustomerDescriptor').should('exist');
cy.get(firstRow('salesPersonFk'))
.find('span')
.should('have.class', 'link')
.click();
cy.dataCy('WorkerDescriptor').should('exist');
cy.get(firstRow('zoneFk')).find('span').should('have.class', 'link').click();
cy.dataCy('ZoneDescriptor').should('exist');
cy.get(firstRow('shippedDate')).find('.q-badge');
cy.get(
':nth-child(1) > .q-table--col-auto-width > [data-cy="tableAction-0"] > .q-btn__content > .q-icon',
).click({ ctrlKey: true });
cy.get(
':nth-child(1) > .q-table--col-auto-width > [data-cy="tableAction-1"] > .q-btn__content > .q-icon',
).click();
cy.get('.summaryHeader').should('exist');
});
it.only('clear scopeDays', function () {
cy.get('[data-cy="Days onward_input"]').clear().type('2');
it('should filter by filter panel', () => {
// Client id - clientFk
cy.get('[data-cy="Client id_input"]').type('1101');
cy.searchInFilterPanel();
cy.get('.q-chip__content > span').should('have.text', '"2"');
cy.waitSpinner();
// Verify URL contains correct scopeDays value
cy.url().then((url) => {
const urlParams = new URLSearchParams(url.split('?')[1]);
const saleMonitorTickets = JSON.parse(
decodeURIComponent(urlParams.get('saleMonitorTickets')),
);
expect(saleMonitorTickets.scopeDays).to.equal(2);
});
cy.get('[data-cy="Days onward_input"]').clear();
requestParams('clientFk', '1101');
countRows('eq', 7);
//
cy.cleanFilterPanel();
// TODO: order id
cy.get('[data-cy="Order id_input"]').type(7);
cy.searchInFilterPanel();
cy.get('.q-chip__content > span').should('have.text', '"0"');
cy.waitSpinner();
// Verify URL after clearing
cy.url().then((url) => {
const urlParams = new URLSearchParams(url.split('?')[1]);
const saleMonitorTickets = JSON.parse(
decodeURIComponent(urlParams.get('saleMonitorTickets')),
);
expect(saleMonitorTickets.scopeDays).to.equal(0);
});
// requestParams('orderFk', '7');
cy.url().should('include', 'orderFk');
countRows('eq', 1);
//
cy.cleanFilterPanel();
// TODO: Scope days
// cy.get('[data-cy="Days onward_input"]').type(2);
// cy.searchInFilterPanel();
// requestParams('scopeDays', '2');
// countRows('eq', 27);
//
cy.cleanFilterPanel();
// Nickname
cy.get('[data-cy="Nickname_input"]').type('test');
cy.searchInFilterPanel();
// requestParams('nickname', 'test', { inWhere: true, like: false });
cy.url().should('include', 'nickname');
countRows('eq', 2);
//
cy.cleanFilterPanel();
// Invoice
cy.get('[data-cy="Invoice_input"]').type('test');
cy.searchInFilterPanel();
// requestParams('refFk', 'test');
cy.url().should('include', 'refFk');
countRows('eq', 0);
//
cy.cleanFilterPanel();
// Agency
cy.get('[data-cy="Agency_select"]').click();
cy.get('.q-item__label').contains('inhouse pickup').click();
cy.searchInFilterPanel();
// requestParams('agencyModeFk', '1');
cy.url().should('include', 'agencyModeFk');
countRows('eq', 6);
//
cy.cleanFilterPanel();
// State
cy.get('[data-cy="State_select"]').click();
cy.get('.q-item__label').contains('Libre').click();
cy.searchInFilterPanel();
// requestParams('ts.stateFk', 2, { inWhere: true });
cy.url().should('include', 'stateFk');
countRows('eq', 11);
//
cy.cleanFilterPanel();
// AlertLevel
cy.get('[data-cy="Grouped State_select"]').click();
cy.get('.q-item__label').contains('Free').click();
cy.searchInFilterPanel();
// requestParams('alertLevel', '0');
cy.url().should('include', 'alertLevel');
countRows('eq', 16);
//
cy.cleanFilterPanel();
// Country
cy.get('[data-cy="Country_select"]').click();
cy.get('.q-item__label').contains('España').click();
cy.searchInFilterPanel();
jsegarra marked this conversation as resolved Outdated

should open the descriptorProxy and SummaryPopup. (o algo así)

should open the descriptorProxy and SummaryPopup. (o algo así)
// requestParams('countryFk', '1');
cy.url().should('include', 'countryFk');
countRows('eq', 26);
//
cy.cleanFilterPanel();
// Province
cy.get('[data-cy="Warehouse_select"]').click();
cy.get('.q-item__label').contains('Warehouse Two').click();
cy.searchInFilterPanel();
// requestParams('warehouseFk', '2');
cy.url().should('include', 'warehouseFk');
countRows('eq', 1);
//
cy.cleanFilterPanel();
// Department
cy.selectOption('[data-cy="Department_select"]', 'EQUIPO ESPAÑA LEVANTE');
cy.searchInFilterPanel();
// requestParams('departmentFk', '150');
cy.url().should('include', 'departmentFk');
// countRows('eq', 27);
//
cy.cleanFilterPanel();
// ITP
cy.get('[data-cy="ITP_select"]').click();
cy.get('.q-item__label').contains('H').click();
cy.searchInFilterPanel();
// requestParams('packing', 'H');
cy.url().should('include', 'packing');
countRows('eq', 5);
});
});
it('Cols', () => {
cy.get(firstRow('totalProblems'));
cy.get(firstRow('id')).find('span').should('have.class', 'link').click();
cy.dataCy('TicketDescriptor').should('exist');
cy.get(firstRow('zoneFk')).find('span').should('have.class', 'link').click();
cy.dataCy('ZoneDescriptor').should('exist');
cy.get(firstRow('clientFk')).find('span').should('have.class', 'link').click();
cy.dataCy('CustomerDescriptor').should('exist');
cy.get(firstRow('departmentFk')).find('span').should('have.class', 'link').click();
cy.dataCy('DepartmentDescriptor').should('exist');
cy.get(firstRow('shippedDate')).find('.q-badge');
cy.get(
':nth-child(1) > .q-table--col-auto-width > [data-cy="tableAction-0"] > .q-btn__content > .q-icon',
).click({ ctrlKey: true });
cy.get(
':nth-child(1) > .q-table--col-auto-width > [data-cy="tableAction-1"] > .q-btn__content > .q-icon',
).click();
cy.get('.summaryHeader').should('exist');
});
it('clear scopeDays', function () {
cy.get('[data-cy="Days onward_input"]').clear().type('2');
cy.searchInFilterPanel();
cy.get('.q-chip__content > span').should('have.text', '"2"');
cy.waitSpinner();
// Verify URL contains correct scopeDays value
cy.url().then((url) => {
const urlParams = new URLSearchParams(url.split('?')[1]);
const saleMonitorTickets = JSON.parse(
decodeURIComponent(urlParams.get('saleMonitorTickets')),
);
expect(saleMonitorTickets.scopeDays).to.equal(2);
});
cy.get('[data-cy="Days onward_input"]').clear();
cy.searchInFilterPanel();
cy.get('.q-chip__content > span').should('have.text', '"0"');
cy.waitSpinner();
// Verify URL after clearing
cy.url().then((url) => {
const urlParams = new URLSearchParams(url.split('?')[1]);
const saleMonitorTickets = JSON.parse(
decodeURIComponent(urlParams.get('saleMonitorTickets')),
);
expect(saleMonitorTickets.scopeDays).to.equal(0);
});
});
function requestParams(key, value, options = { inWhere: false, like: false }) {

View File

@ -101,6 +101,13 @@ Cypress.Commands.add('waitSpinner', () => {
}
});
});
// Cypress.Commands.add('waitRightSpinner', () => {
// cy.get('body').then(($body) => {
// if ($body.find('.q-inner-loading').length) {
// cy.get('.q-inner-loading').should('not.be.visible');
// }
// });
// });
jsegarra marked this conversation as resolved Outdated

Quitar

Quitar
// Fill Inputs
Cypress.Commands.add('selectOption', (selector, option, timeout = 2500) => {
@ -306,6 +313,7 @@ Cypress.Commands.add('openRightMenu', (element) => {
Cypress.Commands.add('cleanFilterPanel', () => {
const element = 'clearFilters';
cy.get('#filterPanelForm').scrollIntoView();
if (element) cy.waitForElement(`[data-cy="${element}"]`);
cy.dataCy(element).click();
});