diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts index e861cb100bbbd..3d7882176f64e 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts @@ -114,88 +114,88 @@ describe('Service inventory', () => { }); }); - // describe('Table search', () => { - // beforeEach(() => { - // cy.loginAsEditorUser(); - // }); - - // it('Toggles fast filter when clicking on link', () => { - // cy.visitKibana(serviceInventoryHref); - // cy.get('[data-test-subj="tableSearchInput"]').should('not.exist'); - // cy.contains('Enable fast filter').click(); - // cy.get('[data-test-subj="tableSearchInput"]').should('exist'); - // cy.contains('Try it').should('not.exist'); - // cy.contains('opbeans-node'); - // cy.contains('opbeans-java'); - // cy.contains('opbeans-rum'); - // cy.get('[data-test-subj="tableSearchInput"]').type('java'); - // cy.contains('opbeans-node').should('not.exist'); - // cy.contains('opbeans-java'); - // cy.contains('opbeans-rum').should('not.exist'); - // cy.get('[data-test-subj="tableSearchInput"]').clear(); - // cy.contains('opbeans-node'); - // cy.contains('opbeans-java'); - // cy.contains('opbeans-rum'); - // cy.contains('Disable fast filter').click(); - // cy.contains('Try it').should('exist'); - // cy.get('[data-test-subj="tableSearchInput"]').should('not.exist'); - // }); - // }); - - // describe('Table search with viewer user', () => { - // beforeEach(() => { - // cy.loginAsViewerUser(); - // }); - - // it('Should not be able to turn it on', () => { - // cy.visitKibana(serviceInventoryHref); - // cy.get('[data-test-subj="tableSearchInput"]').should('not.exist'); - // cy.get('[data-test-subj="apmLink"]').should('be.disabled'); - // }); - // }); - - // describe('Check detailed statistics API with multiple services', () => { - // before(() => { - // // clean previous data created - // synthtrace.clean(); - // const { rangeFrom, rangeTo } = timeRange; - // synthtrace.index( - // generateMultipleServicesData({ - // from: new Date(rangeFrom).getTime(), - // to: new Date(rangeTo).getTime(), - // }) - // ); - // }); - - // beforeEach(() => { - // cy.loginAsViewerUser(); - // }); - - // after(() => { - // synthtrace.clean(); - // }); - - // it('calls detailed API with visible items only', () => { - // cy.intercept('POST', '/internal/apm/services/detailed_statistics?*').as( - // 'detailedStatisticsRequest' - // ); - // cy.intercept('GET', '/internal/apm/services?*').as('mainStatisticsRequest'); - - // cy.visitKibana(`${serviceInventoryHref}&pageSize=10&sortField=serviceName&sortDirection=asc`); - // cy.wait('@mainStatisticsRequest'); - // cy.contains('Services'); - // cy.get('.euiPagination__list').children().should('have.length', 5); - // cy.wait('@detailedStatisticsRequest').then((payload) => { - // expect(payload.request.body.serviceNames).eql( - // JSON.stringify(['0', '1', '10', '11', '12', '13', '14', '15', '16', '17']) - // ); - // }); - // cy.getByTestSubj('pagination-button-1').click(); - // cy.wait('@detailedStatisticsRequest').then((payload) => { - // expect(payload.request.body.serviceNames).eql( - // JSON.stringify(['18', '19', '2', '20', '21', '22', '23', '24', '25', '26']) - // ); - // }); - // }); - // }); + describe('Table search', () => { + beforeEach(() => { + cy.loginAsEditorUser(); + }); + + it('Toggles fast filter when clicking on link', () => { + cy.visitKibana(serviceInventoryHref); + cy.get('[data-test-subj="tableSearchInput"]').should('not.exist'); + cy.contains('Enable fast filter').click(); + cy.get('[data-test-subj="tableSearchInput"]').should('exist'); + cy.contains('Try it').should('not.exist'); + cy.contains('opbeans-node'); + cy.contains('opbeans-java'); + cy.contains('opbeans-rum'); + cy.get('[data-test-subj="tableSearchInput"]').type('java'); + cy.contains('opbeans-node').should('not.exist'); + cy.contains('opbeans-java'); + cy.contains('opbeans-rum').should('not.exist'); + cy.get('[data-test-subj="tableSearchInput"]').clear(); + cy.contains('opbeans-node'); + cy.contains('opbeans-java'); + cy.contains('opbeans-rum'); + cy.contains('Disable fast filter').click(); + cy.contains('Try it').should('exist'); + cy.get('[data-test-subj="tableSearchInput"]').should('not.exist'); + }); + }); + + describe('Table search with viewer user', () => { + beforeEach(() => { + cy.loginAsViewerUser(); + }); + + it('Should not be able to turn it on', () => { + cy.visitKibana(serviceInventoryHref); + cy.get('[data-test-subj="tableSearchInput"]').should('not.exist'); + cy.get('[data-test-subj="apmLink"]').should('be.disabled'); + }); + }); + + describe('Check detailed statistics API with multiple services', () => { + before(() => { + // clean previous data created + synthtrace.clean(); + const { rangeFrom, rangeTo } = timeRange; + synthtrace.index( + generateMultipleServicesData({ + from: new Date(rangeFrom).getTime(), + to: new Date(rangeTo).getTime(), + }) + ); + }); + + beforeEach(() => { + cy.loginAsViewerUser(); + }); + + after(() => { + synthtrace.clean(); + }); + + it('calls detailed API with visible items only', () => { + cy.intercept('POST', '/internal/apm/services/detailed_statistics?*').as( + 'detailedStatisticsRequest' + ); + cy.intercept('GET', '/internal/apm/services?*').as('mainStatisticsRequest'); + + cy.visitKibana(`${serviceInventoryHref}&pageSize=10&sortField=serviceName&sortDirection=asc`); + cy.wait('@mainStatisticsRequest'); + cy.contains('Services'); + cy.get('.euiPagination__list').children().should('have.length', 5); + cy.wait('@detailedStatisticsRequest').then((payload) => { + expect(payload.request.body.serviceNames).eql( + JSON.stringify(['0', '1', '10', '11', '12', '13', '14', '15', '16', '17']) + ); + }); + cy.getByTestSubj('pagination-button-1').click(); + cy.wait('@detailedStatisticsRequest').then((payload) => { + expect(payload.request.body.serviceNames).eql( + JSON.stringify(['18', '19', '2', '20', '21', '22', '23', '24', '25', '26']) + ); + }); + }); + }); });