test: enhance monitor client actions and ticket tests with Cypress intercepts
This commit is contained in:
parent
5f2e2421a8
commit
80fb1eaf6a
|
@ -1,20 +1,30 @@
|
|||
const clientFk = `[data-cy="recentOrderActions"] [data-cy="column-filter-clientFk"]`;
|
||||
/// <reference types="cypress" />
|
||||
|
||||
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.checkVisibleDescriptor('Customer');
|
||||
|
||||
cy.dataCy('recentOrderActions').within(() => {
|
||||
cy.getRowCol('departmentFk', 2)
|
||||
|
@ -22,14 +32,12 @@ describe('Monitor Clients actions', () => {
|
|||
.should('have.class', 'link')
|
||||
.click();
|
||||
});
|
||||
|
||||
cy.checkVisibleDescriptor('Department');
|
||||
|
||||
cy.dataCy('clientsOnWebsite')
|
||||
.find('.q-ml-md')
|
||||
.should('have.text', 'Clients on website');
|
||||
cy.dataCy('clientsOnWebsite')
|
||||
.find('[data-cy="column-filter-departmentFk"] [data-cy="_select"]')
|
||||
.should('have.value', 'EQUIPO ESPAÑA VIP');
|
||||
cy.dataCy('recentOrderActions')
|
||||
.find('.q-ml-md')
|
||||
.should('have.text', 'Recent order actions');
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('Monitor Tickets Table', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
|
|
Loading…
Reference in New Issue