2021-05-13 07:17:09 -05:00
|
|
|
import { e2e } from '@grafana/e2e';
|
|
|
|
|
|
|
|
const dataSourceName = 'PromExemplar';
|
|
|
|
const addDataSource = () => {
|
|
|
|
e2e.flows.addDataSource({
|
|
|
|
type: 'Prometheus',
|
2021-07-14 08:04:23 -05:00
|
|
|
expectedAlertMessage: 'Bad Gateway',
|
2021-05-13 07:17:09 -05:00
|
|
|
name: dataSourceName,
|
|
|
|
form: () => {
|
|
|
|
e2e.components.DataSource.Prometheus.configPage.exemplarsAddButton().click();
|
|
|
|
e2e.components.DataSource.Prometheus.configPage.internalLinkSwitch().check({ force: true });
|
2021-10-12 23:09:35 -05:00
|
|
|
e2e.components.DataSourcePicker.inputV2().should('be.visible').click({ force: true });
|
2021-07-14 08:04:23 -05:00
|
|
|
|
|
|
|
e2e().contains('gdev-tempo').scrollIntoView().should('be.visible').click();
|
2021-05-13 07:17:09 -05:00
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2021-08-18 14:47:25 -05:00
|
|
|
describe('Exemplars', () => {
|
2021-05-13 07:17:09 -05:00
|
|
|
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', () => {
|
2021-10-12 06:16:09 -05:00
|
|
|
let intercept = 'prometheus';
|
|
|
|
e2e().intercept('/api/ds/query', (req) => {
|
|
|
|
if (intercept === 'prometheus') {
|
|
|
|
// For second intercept, we want to send tempo response
|
|
|
|
intercept = 'tempo';
|
|
|
|
req.reply({ fixture: 'exemplars-query-response.json' });
|
|
|
|
} else {
|
|
|
|
req.reply({ fixture: 'tempo-response.json' });
|
|
|
|
}
|
2021-05-13 07:17:09 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
e2e.pages.Explore.visit();
|
|
|
|
|
2021-10-12 23:09:35 -05:00
|
|
|
e2e.components.DataSourcePicker.input().should('be.visible').click();
|
2021-07-14 08:04:23 -05:00
|
|
|
e2e().contains(dataSourceName).scrollIntoView().should('be.visible').click();
|
2021-05-13 07:17:09 -05:00
|
|
|
e2e.components.TimePicker.openButton().click();
|
2021-10-12 06:16:09 -05:00
|
|
|
e2e.components.TimePicker.fromField().clear().type('2021-07-10 17:10:00');
|
|
|
|
e2e.components.TimePicker.toField().clear().type('2021-07-10 17:30:00');
|
2021-05-13 07:17:09 -05:00
|
|
|
e2e.components.TimePicker.applyTimeRange().click();
|
2021-10-12 06:16:09 -05:00
|
|
|
e2e.components.QueryField.container().should('be.visible').type('exemplar-query_bucket{shift}{enter}');
|
2021-05-13 07:17:09 -05:00
|
|
|
|
|
|
|
e2e.components.DataSource.Prometheus.exemplarMarker().first().trigger('mouseover');
|
|
|
|
e2e().contains('Query with gdev-tempo').click();
|
|
|
|
e2e.components.TraceViewer.spanBar().should('have.length', 11);
|
|
|
|
});
|
|
|
|
});
|