#8582 - test: e2e monitorTicket #1391

Merged
jsegarra merged 51 commits from e2e_monitor into dev 2025-04-15 21:04:49 +00:00
5 changed files with 43 additions and 50 deletions
Showing only changes of commit cf8923a2d4 - Show all commits

View File

@ -706,14 +706,6 @@ const rowCtrlClickFunction = computed(() => {
dense
:options="tableModes.filter((mode) => !mode.disable)"
/>
<QBtn
data-cy="vnTable_filter_btn"
icon="filter_alt"
class="bg-vn-section-color q-ml-sm"
dense
@click="stateStore.toggleRightDrawer()"
/>
</template>
<template #header-cell="{ col }">
jsegarra marked this conversation as resolved Outdated

Este icono solo funciona en monitores, en invoice-in, clientes... no es posible meterlo en la barra de busqueda como el resto de secciones? con un slot o algo.

Este icono solo funciona en monitores, en invoice-in, clientes... no es posible meterlo en la barra de busqueda como el resto de secciones? con un slot o algo.

No se por que está
No veo que yo salga en los commits y hay 26...lo quito

No se por que está No veo que yo salga en los commits y hay 26...lo quito
<QTh

View File

@ -12,11 +12,11 @@ describe('Monitor Clients actions', () => {
cy.get('.q-page').should('be.visible');
cy.dataCy('recentOrderActions').within(() => {
cy.firstRow('clientFk').find('span').should('have.class', 'link').click();
cy.getRowCol('clientFk').find('span').should('have.class', 'link').click();
});
cy.dataCy('CustomerDescriptor').should('exist');
cy.dataCy('recentOrderActions').within(() => {
cy.firstRow('departmentFk', 2)
cy.getRowCol('departmentFk', 2)
.find('span')
.should('have.class', 'link')
.click();
@ -33,7 +33,7 @@ describe('Monitor Clients actions', () => {
cy.dataCy('To_inputDate').should('have.value', '01/01/2001');
cy.get(`${clientFk} [data-cy="_select"]`).click();
cy.clickOption();
cy.countTableRows('eq', 0);
cy.countTableRows('eq', 3);
cy.get(`${clientFk} .q-field .q-field__control > :nth-child(2)`).click();
Review

Estos dos tests que comprueban el título no le veo sentido.

Estos dos tests que comprueban el título no le veo sentido.
Review

Validan que las tablas tiene titulo de cabecera.
Me pareció interesante y es una validación que no ralentiza los tests.
Es cierto que no lo validamos pero creo que no hay mas casos como este.
Por darle más valor al test

Validan que las tablas tiene titulo de cabecera. Me pareció interesante y es una validación que no ralentiza los tests. Es cierto que no lo validamos pero creo que no hay mas casos como este. Por darle más valor al test
cy.get(`${departmentFk} [data-cy="_select"]`).type('VIP').trigger('enter');

View File

@ -1,13 +1,11 @@
const firstRow = (field, index = 1) =>
`:nth-child(${index}) > [data-col-field="${field}"]`;
describe('Monitor Tickets Table', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/#/monitor/tickets');
cy.waitForElement('.q-page');
cy.intercept('GET', '**/SalesMonitors/salesFilter*').as('filterRequest');
cy.openFilterPanel();
cy.openRightMenu();
});
it('should open new tab when ctrl+click on client link', () => {
cy.intercept('GET', '**/SalesMonitors/salesFilter*').as('filterRequest');
@ -16,7 +14,7 @@ describe('Monitor Tickets Table', () => {
cy.stub(win, 'open').as('windowOpen');
});
cy.get(firstRow('provinceFk')).click({ ctrlKey: true });
cy.getRowCol('provinceFk').click({ ctrlKey: true });
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
});
it('should filter by column headers and update URL params', () => {
@ -33,40 +31,42 @@ describe('Monitor Tickets Table', () => {
});
it('should filter by filter panel', () => {
jorgep marked this conversation as resolved Outdated

Juan dijo que no testeáramos los filtros de cada sección , de todas maneras aquí solo estas comprobando que se han añadido/quitado los parámetros en la url(Parece más de VnFilterPanel). Sería ver que los datos han sido filtrados. El de daysAgo como tiene lógica si se podría testear.

Juan dijo que no testeáramos los filtros de cada sección , de todas maneras aquí solo estas comprobando que se han añadido/quitado los parámetros en la url(Parece más de VnFilterPanel). Sería ver que los datos han sido filtrados. El de daysAgo como tiene lógica si se podría testear.

En la reunión dijimos de no crear una tarea para hacer el test de todos los filtros, pero eso no quita que se haga donde haga falta no?
De todas maneras, veo correcto lo que comentas de que esa comprobación debería ser de MonitorTicketFilter usando vitest.
Si te parece, creo tarea para esto ultimo

En la reunión dijimos de no crear una tarea para hacer el test de todos los filtros, pero eso no quita que se haga donde haga falta no? De todas maneras, veo correcto lo que comentas de que esa comprobación debería ser de MonitorTicketFilter usando vitest. Si te parece, creo tarea para esto ultimo

Lo que te diga @juan

Lo que te diga @juan

Lo he quitado, asi que no haria falta revisar nada mas

Lo he quitado, asi que no haria falta revisar nada mas

Sigues validando filtros, lo que te diga Juan

Sigues validando filtros, lo que te diga Juan

He hablado con Javi y Juan al respecto
Te adjunto una foto
Pero ya no deberían estar validándose

He hablado con Javi y Juan al respecto Te adjunto una foto Pero ya no deberían estar validándose

Solo hay 1, creo que es asumible

Solo hay 1, creo que es asumible

Alex dice en la foto que si es de vnTable no se validen. Juan y Javi que han dicho?

Alex dice en la foto que si es de vnTable no se validen. Juan y Javi que han dicho?
// Client id - clientFk
cy.get('[data-cy="Client id_input"]').type('1101');
cy.dataCy('Client id_input').type('1101');
cy.searchInFilterPanel();
cy.url().should('include', 'clientFk');
cy.countTableRows('eq', 7);
//
cy.cleanFilterPanel();
cy.get('[data-cy="Order id_input"]').type(7);
// Order id - orderFk
cy.dataCy('Order id_input').type(7);
cy.searchInFilterPanel();
cy.url().should('include', 'orderFk');
cy.countTableRows('eq', 1);
//
cy.cleanFilterPanel();
cy.get('[data-cy="Days onward_input"]').type(2);
// Days onward - scopeDays
cy.dataCy('Days onward_input').type(2);
cy.searchInFilterPanel();
cy.url().should('include', 'scopeDays');
cy.countTableRows('eq', 27);
//
cy.cleanFilterPanel();
// Nickname
cy.get('[data-cy="Nickname_input"]').type('test');
cy.dataCy('Nickname_input').type('test');
cy.searchInFilterPanel();
cy.url().should('include', 'nickname');
cy.countTableRows('eq', 2);
//
cy.cleanFilterPanel();
// Invoice
cy.get('[data-cy="Invoice_input"]').type('test');
cy.dataCy('Invoice_input').type('test');
cy.searchInFilterPanel();
cy.url().should('include', 'refFk');
cy.countTableRows('eq', 0);
//
cy.cleanFilterPanel();
// Agency
cy.get('[data-cy="Agency_select"]').click();
cy.dataCy('Agency_select').click();
cy.get('.q-item__label').contains('inhouse pickup').click();
cy.searchInFilterPanel();
cy.url().should('include', 'agencyModeFk');
@ -74,7 +74,7 @@ describe('Monitor Tickets Table', () => {
//
cy.cleanFilterPanel();
// State
cy.get('[data-cy="State_select"]').click();
cy.dataCy('State_select').click();
cy.get('.q-item__label').contains('Libre').click();
cy.searchInFilterPanel();
cy.url().should('include', 'stateFk');
@ -82,7 +82,7 @@ describe('Monitor Tickets Table', () => {
//
cy.cleanFilterPanel();
// AlertLevel
cy.get('[data-cy="Grouped State_select"]').click();
cy.dataCy('Grouped State_select').click();
cy.get('.q-item__label').contains('Free').click();
cy.searchInFilterPanel();
cy.url().should('include', 'alertLevel');
@ -90,7 +90,7 @@ describe('Monitor Tickets Table', () => {
//
cy.cleanFilterPanel();
// Country
cy.get('[data-cy="Country_select"]').click();
cy.dataCy('Country_select').click();
cy.get('.q-item__label').contains('España').click();
cy.searchInFilterPanel();
cy.url().should('include', 'countryFk');
@ -98,7 +98,7 @@ describe('Monitor Tickets Table', () => {
//
cy.cleanFilterPanel();
// Province
cy.get('[data-cy="Warehouse_select"]').click();
cy.dataCy('Warehouse_select').click();
cy.get('.q-item__label').contains('Warehouse Two').click();
cy.searchInFilterPanel();
cy.url().should('include', 'warehouseFk');
@ -112,7 +112,7 @@ describe('Monitor Tickets Table', () => {
//
cy.cleanFilterPanel();
// ITP
cy.get('[data-cy="ITP_select"]').click();
cy.dataCy('ITP_select').click();
cy.get('.q-item__label').contains('H').click();
cy.searchInFilterPanel();
cy.url().should('include', 'packing');
@ -120,23 +120,20 @@ describe('Monitor Tickets Table', () => {
});
it('Cols', () => {
cy.get(firstRow('totalProblems'));
cy.getRowCol('totalProblems');
cy.get(firstRow('id')).find('span').should('have.class', 'link').click();
cy.getRowCol('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.getRowCol('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.getRowCol('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.getRowCol('departmentFk').find('span').should('have.class', 'link').click();
cy.dataCy('DepartmentDescriptor').should('exist');
cy.get(firstRow('shippedDate')).find('.q-badge');
cy.getRowCol('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 });

View File

@ -1,3 +1,14 @@
Cypress.Commands.add('firstRow', (field, index = 1) =>
cy.get(`:nth-child(${index}) > [data-col-field="${field}"]`),
Cypress.Commands.add('getRow', (index = 1) =>
cy.get(`.vnTable .q-virtual-scroll__content tr:nth-child(${index})`),
jsegarra marked this conversation as resolved Outdated

mejor hacer .vnTable .q virtual-scroll__content resto del selector creo yo... Ser un poco más especifico y si se puede cambiar el idice de fila, ya no lo llamaría firstRow, select row o algo así.

mejor hacer .vnTable .q virtual-scroll__content resto del selector creo yo... Ser un poco más especifico y si se puede cambiar el idice de fila, ya no lo llamaría firstRow, select row o algo así.
);
Cypress.Commands.add('getRowCol', (field, index = 1) =>
cy.getRow(index).find(`[data-col-field="${field}"]`),
);
Cypress.Commands.add('vnTableCreateBtn', () =>
cy.dataCy('vnTableCreateBtn').should('exist').click(),
);
Cypress.Commands.add('waitTableScrollLoad', () =>
cy.waitForElement('[data-q-vs-anchor]'),
);

View File

@ -352,25 +352,18 @@ Cypress.Commands.add('openListSummary', (row) => {
cy.get('.card-list-body .actions .q-btn:nth-child(2)').eq(row).click();
});
Cypress.Commands.add('openRightMenu', (element) => {
if (element) cy.waitForElement(element);
cy.get('[data-cy="toggle-right-drawer"]').click();
Cypress.Commands.add('openRightMenu', (element = 'toggle-right-drawer') => {
if (element) cy.waitForElement(`[data-cy="${element}"]`);
cy.dataCy(element).click();
});
Cypress.Commands.add('cleanFilterPanel', () => {
const element = 'clearFilters';
Cypress.Commands.add('cleanFilterPanel', (element = 'clearFilters') => {
cy.get('#filterPanelForm').scrollIntoView();
if (element) cy.waitForElement(`[data-cy="${element}"]`);
cy.dataCy(element).click();
});
Cypress.Commands.add('searchInFilterPanel', () => {
const element = 'search';
if (element) cy.waitForElement(`[data-cy="${element}"]`);
cy.dataCy(element).click();
});
Cypress.Commands.add('openFilterPanel', () => {
const element = 'vnTable_filter_btn';
Cypress.Commands.add('searchInFilterPanel', (element = 'vnFilterPanel_search') => {
if (element) cy.waitForElement(`[data-cy="${element}"]`);
cy.dataCy(element).click();
});