test: remove timeout

This commit is contained in:
Javier Segarra 2025-03-24 11:15:25 +01:00
parent 48689374bc
commit 351f291086
3 changed files with 37 additions and 45 deletions

View File

@ -1,3 +1,5 @@
const clientFk = `[data-cy="recentOrderActions"] [data-cy="column-filter-clientFk"]`;
const departmentFk = `[data-cy="recentOrderActions"] [data-cy="column-filter-departmentFk"]`;
describe('Monitor Clients actions', () => {
beforeEach(() => {
cy.login('developer');
@ -6,12 +8,19 @@ describe('Monitor Clients actions', () => {
cy.intercept('GET', '**/SalesMonitors/ordersFilter*').as('ordersFilter');
cy.intercept('GET', '**/SalesMonitors/clientsFilter*').as('clientsFilter');
});
it.only('Should load layout', () => {
it('Should load layout', () => {
cy.get('.q-page').should('be.visible');
cy.firstRow('clientFk').find('span').should('have.class', 'link').click();
cy.dataCy('recentOrderActions').within(() => {
cy.firstRow('clientFk').find('span').should('have.class', 'link').click();
});
cy.dataCy('CustomerDescriptor').should('exist');
cy.firstRow('departmentFk', 2).find('span').should('have.class', 'link').click();
cy.dataCy('recentOrderActions').within(() => {
cy.firstRow('departmentFk', 2)
.find('span')
.should('have.class', 'link')
.click();
});
cy.dataCy('DepartmentDescriptor').should('exist');
cy.dataCy('clientsOnWebsite')
@ -22,40 +31,23 @@ describe('Monitor Clients actions', () => {
.should('have.text', 'Recent order actions');
cy.get('[data-cy="From_inputDate"]').should('have.value', '01/01/2001');
cy.get('[data-cy="To_inputDate"]').should('have.value', '01/01/2001');
cy.get('[data-cy="recentOrderActions"]')
.find('[data-cy="column-filter-clientFk"]')
.find(' [data-cy="_select"]')
.click();
cy.get('.q-menu :nth-child(1) >.q-item__section').click();
cy.get(`${clientFk} [data-cy="_select"]`).click();
cy.clickOption();
cy.countTableRows('eq', 0);
cy.get('[data-cy="recentOrderActions"]')
.find(
'[data-cy="column-filter-clientFk"] .q-field .q-field__control > :nth-child(2)',
)
.click();
cy.get('[data-cy="recentOrderActions"]')
.find('[data-cy="column-filter-departmentFk"]')
.find(' [data-cy="_select"]')
.click();
cy.get('[data-cy="recentOrderActions"]')
.find('[data-cy="column-filter-departmentFk"]')
.find(' [data-cy="_select"]')
.type('VIP');
cy.wait(1000);
cy.get('.q-menu :nth-child(1) >.q-item__section').click();
cy.countTableRows('eq', 13);
cy.get(`${clientFk} .q-field .q-field__control > :nth-child(2)`).click();
cy.get(`${departmentFk} [data-cy="_select"]`).type('VIP').trigger('enter');
cy.intercept('GET', '**/Departments*').as('filterDepartment');
cy.wait('@filterDepartment').then(() => {
cy.clickOption();
cy.countTableRows('eq', 13);
});
cy.get('[data-cy="recentOrderActions"]')
.find('[data-cy="column-filter-clientFk"]')
.find(' [data-cy="_select"]')
.click();
cy.get('[data-cy="recentOrderActions"]')
.find('[data-cy="column-filter-clientFk"]')
.find(' [data-cy="_select"]')
.type('bru');
cy.wait(1000);
cy.get('.q-menu :nth-child(1) >.q-item__section').click();
cy.countTableRows('eq', 3);
cy.get(`${clientFk} [data-cy="_select"]`).type('Bruce Banner');
cy.intercept('GET', '**/Clients*').as('filterClient');
cy.wait('@filterClient').then(() => {
cy.clickOption();
cy.countTableRows('eq', 3);
});
});
});

View File

@ -19,20 +19,17 @@ describe('Monitor Tickets Table', () => {
cy.get(firstRow('provinceFk')).click({ ctrlKey: true });
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
});
it('should filter by column headers and update URL params', () => {
it.only('should filter by column headers and update URL params', () => {
cy.intercept('GET', '**/SalesMonitors/salesFilter*').as('filterRequest');
cy.dataCy('column-filter-id').find(' [data-cy="_input"]').type('13');
cy.dataCy('column-filter-id').find('[data-cy="_input"]').type('13');
cy.dataCy('column-filter-id').find(' .q-icon').click();
cy.openRightMenu();
cy.dataCy('column-filter-clientFk')
.find('[data-cy="_select"]', { timeout: 3000 })
.type('1101', { timeout: 3000, force: true });
cy.get('[role="listbox"]')
.find('.q-item')
.find('.q-item__label')
.contains('Bruce Wayne')
.click();
cy.dataCy('column-filter-clientFk').find('[data-cy="_select"]').type('1101');
cy.intercept('GET', '**/Clients*').as('filterClient');
cy.wait('@filterClient').then(() => {
cy.clickOption();
});
});
it('should filter by filter panel', () => {
// Client id - clientFk

View File

@ -0,0 +1,3 @@
Cypress.Commands.add('clickOption', (index = 1) =>
cy.get(`.q-menu :nth-child(${index}) >.q-item__section`).click(),
);