-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding e2e tests * adding e2e tests * adding e2e tests * fixing ci * fixing ci * fixing e2e and jest Co-authored-by: Cauê Marcondes <55978943+cauemarcondes@users.noreply.github.com>
- Loading branch information
1 parent
078f3e0
commit 187d24b
Showing
10 changed files
with
322 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
145 changes: 145 additions & 0 deletions
145
...ns/apm/ftr_e2e/cypress/integration/read_only_user/service_overview/header_filters.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import url from 'url'; | ||
import archives_metadata from '../../../fixtures/es_archiver/archives_metadata'; | ||
import { esArchiverLoad, esArchiverUnload } from '../../../tasks/es_archiver'; | ||
|
||
const { start, end } = archives_metadata['apm_8.0.0']; | ||
|
||
const serviceOverviewPath = '/app/apm/services/kibana/overview'; | ||
const baseUrl = url.format({ | ||
pathname: serviceOverviewPath, | ||
query: { rangeFrom: start, rangeTo: end }, | ||
}); | ||
|
||
const apisToIntercept = [ | ||
{ | ||
endpoint: '/api/apm/services/kibana/transactions/charts/latency', | ||
as: 'latencyChartRequest', | ||
}, | ||
{ | ||
endpoint: '/api/apm/services/kibana/throughput', | ||
as: 'throughputChartRequest', | ||
}, | ||
{ | ||
endpoint: '/api/apm/services/kibana/transactions/charts/error_rate', | ||
as: 'errorRateChartRequest', | ||
}, | ||
{ | ||
endpoint: | ||
'/api/apm/services/kibana/transactions/groups/detailed_statistics', | ||
as: 'transactionGroupsDetailedRequest', | ||
}, | ||
{ | ||
endpoint: | ||
'/api/apm/services/kibana/service_overview_instances/detailed_statistics', | ||
as: 'instancesDetailedRequest', | ||
}, | ||
{ | ||
endpoint: | ||
'/api/apm/services/kibana/service_overview_instances/main_statistics', | ||
as: 'instancesMainStatisticsRequest', | ||
}, | ||
{ | ||
endpoint: '/api/apm/services/kibana/error_groups/main_statistics', | ||
as: 'errorGroupsMainStatisticsRequest', | ||
}, | ||
{ | ||
endpoint: '/api/apm/services/kibana/transaction/charts/breakdown', | ||
as: 'transactonBreakdownRequest', | ||
}, | ||
{ | ||
endpoint: '/api/apm/services/kibana/transactions/groups/main_statistics', | ||
as: 'transactionsGroupsMainStatisticsRequest', | ||
}, | ||
]; | ||
|
||
describe('Service overview - header filters', () => { | ||
before(() => { | ||
esArchiverLoad('apm_8.0.0'); | ||
}); | ||
after(() => { | ||
esArchiverUnload('apm_8.0.0'); | ||
}); | ||
beforeEach(() => { | ||
cy.loginAsReadOnlyUser(); | ||
}); | ||
describe('Filtering by transaction type', () => { | ||
it('changes url when selecting different value', () => { | ||
cy.visit(baseUrl); | ||
cy.contains('Kibana'); | ||
cy.url().should('not.include', 'transactionType'); | ||
cy.get('[data-test-subj="headerFilterTransactionType"]').should( | ||
'have.value', | ||
'request' | ||
); | ||
cy.get('[data-test-subj="headerFilterTransactionType"]').select( | ||
'taskManager' | ||
); | ||
cy.url().should('include', 'transactionType=taskManager'); | ||
cy.get('[data-test-subj="headerFilterTransactionType"]').should( | ||
'have.value', | ||
'taskManager' | ||
); | ||
}); | ||
|
||
it('calls APIs with correct transaction type', () => { | ||
apisToIntercept.map(({ endpoint, as }) => { | ||
cy.intercept('GET', endpoint).as(as); | ||
}); | ||
cy.visit(baseUrl); | ||
cy.contains('Kibana'); | ||
cy.get('[data-test-subj="headerFilterTransactionType"]').should( | ||
'have.value', | ||
'request' | ||
); | ||
|
||
cy.expectAPIsToHaveBeenCalledWith({ | ||
apisIntercepted: apisToIntercept.map(({ as }) => `@${as}`), | ||
value: 'transactionType=request', | ||
}); | ||
|
||
cy.get('[data-test-subj="headerFilterTransactionType"]').select( | ||
'taskManager' | ||
); | ||
cy.url().should('include', 'transactionType=taskManager'); | ||
cy.get('[data-test-subj="headerFilterTransactionType"]').should( | ||
'have.value', | ||
'taskManager' | ||
); | ||
cy.expectAPIsToHaveBeenCalledWith({ | ||
apisIntercepted: apisToIntercept.map(({ as }) => `@${as}`), | ||
value: 'transactionType=taskManager', | ||
}); | ||
}); | ||
}); | ||
|
||
describe('Filtering by kuerybar', () => { | ||
it('filters by transaction.name', () => { | ||
cy.visit( | ||
url.format({ | ||
pathname: '/app/apm/services/opbeans-java/overview', | ||
query: { rangeFrom: start, rangeTo: end }, | ||
}) | ||
); | ||
cy.contains('opbeans-java'); | ||
cy.get('[data-test-subj="headerFilterKuerybar"]').type('transaction.n'); | ||
cy.contains('transaction.name'); | ||
cy.get('[data-test-subj="suggestionContainer"]') | ||
.find('li') | ||
.first() | ||
.click(); | ||
cy.get('[data-test-subj="headerFilterKuerybar"]').type(':'); | ||
cy.get('[data-test-subj="suggestionContainer"]') | ||
.find('li') | ||
.first() | ||
.click(); | ||
cy.get('[data-test-subj="suggestionContainer"]').realPress('{enter}'); | ||
cy.url().should('include', '&kuery=transaction.name'); | ||
}); | ||
}); | ||
}); |
114 changes: 114 additions & 0 deletions
114
...s/apm/ftr_e2e/cypress/integration/read_only_user/service_overview/instances_table.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import url from 'url'; | ||
import archives_metadata from '../../../fixtures/es_archiver/archives_metadata'; | ||
import { esArchiverLoad, esArchiverUnload } from '../../../tasks/es_archiver'; | ||
|
||
const { start, end } = archives_metadata['apm_8.0.0']; | ||
|
||
const serviceOverviewPath = '/app/apm/services/opbeans-java/overview'; | ||
const baseUrl = url.format({ | ||
pathname: serviceOverviewPath, | ||
query: { rangeFrom: start, rangeTo: end }, | ||
}); | ||
|
||
const apisToIntercept = [ | ||
{ | ||
endpoint: | ||
'/api/apm/services/opbeans-java/service_overview_instances/main_statistics', | ||
as: 'instancesMainRequest', | ||
}, | ||
{ | ||
endpoint: | ||
'/api/apm/services/opbeans-java/service_overview_instances/detailed_statistics', | ||
as: 'instancesDetailsRequest', | ||
}, | ||
{ | ||
endpoint: | ||
'/api/apm/services/opbeans-java/service_overview_instances/details/02950c4c5fbb0fda1cc98c47bf4024b473a8a17629db6530d95dcee68bd54c6c', | ||
as: 'instanceDetailsRequest', | ||
}, | ||
{ | ||
endpoint: | ||
'/api/apm/services/opbeans-java/service_overview_instances/details/02950c4c5fbb0fda1cc98c47bf4024b473a8a17629db6530d95dcee68bd54c6c', | ||
as: 'instanceDetailsRequest', | ||
}, | ||
]; | ||
|
||
describe('Instances table', () => { | ||
beforeEach(() => { | ||
cy.loginAsReadOnlyUser(); | ||
}); | ||
describe('when data is not loaded', () => { | ||
it('shows empty message', () => { | ||
cy.visit(baseUrl); | ||
cy.contains('opbeans-java'); | ||
cy.get('[data-test-subj="serviceInstancesTableContainer"]').contains( | ||
'No items found' | ||
); | ||
}); | ||
}); | ||
|
||
describe('when data is loaded', () => { | ||
before(() => { | ||
esArchiverLoad('apm_8.0.0'); | ||
}); | ||
after(() => { | ||
esArchiverUnload('apm_8.0.0'); | ||
}); | ||
const serviceNodeName = | ||
'02950c4c5fbb0fda1cc98c47bf4024b473a8a17629db6530d95dcee68bd54c6c'; | ||
it('has data in the table', () => { | ||
cy.visit(baseUrl); | ||
cy.contains('opbeans-java'); | ||
cy.contains(serviceNodeName); | ||
}); | ||
it('shows instance details', () => { | ||
apisToIntercept.map(({ endpoint, as }) => { | ||
cy.intercept('GET', endpoint).as(as); | ||
}); | ||
|
||
cy.visit(baseUrl); | ||
cy.contains('opbeans-java'); | ||
|
||
cy.wait('@instancesMainRequest'); | ||
cy.contains(serviceNodeName); | ||
|
||
cy.wait('@instancesDetailsRequest'); | ||
cy.get( | ||
`[data-test-subj="instanceDetailsButton_${serviceNodeName}"]` | ||
).realClick(); | ||
cy.get('[data-test-subj="loadingSpinner"]').should('be.visible'); | ||
cy.wait('@instanceDetailsRequest').then(() => { | ||
cy.contains('Service'); | ||
}); | ||
}); | ||
it('shows actions available', () => { | ||
apisToIntercept.map(({ endpoint, as }) => { | ||
cy.intercept('GET', endpoint).as(as); | ||
}); | ||
|
||
cy.visit(baseUrl); | ||
cy.contains('opbeans-java'); | ||
|
||
cy.wait('@instancesMainRequest'); | ||
cy.contains(serviceNodeName); | ||
|
||
cy.wait('@instancesDetailsRequest'); | ||
cy.get( | ||
`[data-test-subj="instanceActionsButton_${serviceNodeName}"]` | ||
).realClick(); | ||
cy.contains('Pod logs'); | ||
cy.contains('Pod metrics'); | ||
cy.contains('Container logs'); | ||
cy.contains('Container metrics'); | ||
cy.contains('Filter overview by instance'); | ||
cy.contains('Metrics'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.