/// describe('Monitor Clients actions', () => { beforeEach(() => { cy.login('salesPerson'); cy.intercept('GET', '**/Departments**').as('departments'); cy.visit('/#/monitor/clients-actions'); cy.waitForElement('.q-page'); cy.wait('@departments').then((xhr) => { cy.window().then((win) => { const user = JSON.parse(win.sessionStorage.getItem('user')); const { where } = JSON.parse(xhr.request.query.filter); expect(where.id.like).to.include(user.departmentFk.toString()); }); }); cy.intercept('GET', '**/SalesMonitors/ordersFilter*').as('ordersFilter'); cy.intercept('GET', '**/SalesMonitors/clientsFilter*').as('clientsFilter'); }); it('Should filter by field', () => { cy.get('.q-page').should('be.visible'); cy.dataCy('clientsOnWebsite') .find('[data-cy="column-filter-departmentFk"] [data-cy="_select"]') .click(); cy.dataCy('recentOrderActions').within(() => { cy.getRowCol('clientFk').find('span').should('have.class', 'link').click(); }); cy.checkVisibleDescriptor('Customer'); cy.dataCy('recentOrderActions').within(() => { cy.getRowCol('departmentFk', 2) .find('span') .should('have.class', 'link') .click(); }); cy.checkVisibleDescriptor('Department'); cy.dataCy('clientsOnWebsite') .find('.q-ml-md') .should('have.text', 'Clients on website'); cy.dataCy('recentOrderActions') .find('.q-ml-md') .should('have.text', 'Recent order actions'); cy.dataCy('From_inputDate').should('have.value', '01/01/2001'); cy.dataCy('To_inputDate').should('have.value', '01/01/2001'); }); });