mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Add e2e test for exemplars flow (#33972)
* Add e2e test for exemplars flow
* Check if data source is created
* Lets see what is going on
* Try again
* Updating the image maybe?
* Revert "Updating the image maybe?"
This reverts commit 968b44b0d9.
* Try with force
* Use electron
* Wait for new url?
* Wait?????
* Should be good now
* Revert e2e recording
This commit is contained in:
72
e2e/suite1/specs/exemplars.spec.ts
Normal file
72
e2e/suite1/specs/exemplars.spec.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import { e2e } from '@grafana/e2e';
|
||||
|
||||
const dataSourceName = 'PromExemplar';
|
||||
const addDataSource = () => {
|
||||
e2e.flows.addDataSource({
|
||||
type: 'Prometheus',
|
||||
expectedAlertMessage: 'HTTP error Bad Gateway',
|
||||
name: dataSourceName,
|
||||
form: () => {
|
||||
e2e.components.DataSource.Prometheus.configPage.exemplarsAddButton().click();
|
||||
e2e.components.DataSource.Prometheus.configPage.internalLinkSwitch().check({ force: true });
|
||||
e2e.components.DataSourcePicker.container()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e.components.Select.input().should('be.visible').click({ force: true });
|
||||
|
||||
e2e().contains('gdev-tempo').scrollIntoView().should('be.visible').click();
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe('Exemplars', () => {
|
||||
beforeEach(() => {
|
||||
e2e.flows.login('admin', 'admin');
|
||||
|
||||
e2e()
|
||||
.request({ url: `/api/datasources/name/${dataSourceName}`, failOnStatusCode: false })
|
||||
.then((response) => {
|
||||
if (response.isOkStatusCode) {
|
||||
return;
|
||||
}
|
||||
addDataSource();
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to navigate to configured data source', () => {
|
||||
e2e().intercept('POST', '/api/v1/query_exemplars', {
|
||||
fixture: 'exemplars-query-response.json',
|
||||
});
|
||||
e2e().intercept('POST', '/api/v1/query_range', {
|
||||
fixture: 'prometheus-query-range-response.json',
|
||||
});
|
||||
e2e().intercept('POST', '/api/v1/query', {
|
||||
fixture: 'prometheus-query-response.json',
|
||||
});
|
||||
e2e().intercept('POST', '/api/ds/query', {
|
||||
fixture: 'tempo-response.json',
|
||||
});
|
||||
|
||||
e2e.pages.Explore.visit();
|
||||
|
||||
e2e.components.DataSourcePicker.container()
|
||||
.should('be.visible')
|
||||
.within(() => {
|
||||
e2e.components.Select.input().should('be.visible').click();
|
||||
|
||||
e2e().contains(dataSourceName).scrollIntoView().should('be.visible').click();
|
||||
});
|
||||
e2e.components.TimePicker.openButton().click();
|
||||
e2e.components.TimePicker.fromField().clear().type('2021-05-11 19:30:00');
|
||||
e2e.components.TimePicker.toField().clear().type('2021-05-11 21:40:00');
|
||||
e2e.components.TimePicker.applyTimeRange().click();
|
||||
e2e.components.QueryField.container().should('be.visible').type('exemplar-query{shift}{enter}');
|
||||
|
||||
e2e.components.DataSource.Prometheus.exemplarMarker().first().trigger('mouseover');
|
||||
e2e().contains('Query with gdev-tempo').click();
|
||||
|
||||
e2e().get('[aria-label="Node: app"]').should('be.visible');
|
||||
e2e.components.TraceViewer.spanBar().should('have.length', 11);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user