mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
* checks for empty URLs added * check for TimeSeriesTypeNot to fix InfluxDB alerts * log a warning when a data frame is ignored * fix: add brittle Prometheus URL input selector needs a proper aria-label or test-data-id selector * test: add URL input aria-label needs to use the grafana/e2e-selectors package * test: run ci * add URL validation for specific data sources, e2e tests * Update pkg/api/datasource/validation.go Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com> * delete duplicated logs * delete unnecessary leading newline Co-authored-by: gillesdemey <gilles.de.mey@gmail.com> Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
70 lines
2.7 KiB
TypeScript
70 lines
2.7 KiB
TypeScript
import { e2e } from '@grafana/e2e';
|
|
import { selectors } from '@grafana/e2e-selectors';
|
|
|
|
const dataSourceName = 'PromExemplar';
|
|
const addDataSource = () => {
|
|
e2e.flows.addDataSource({
|
|
type: 'Prometheus',
|
|
expectedAlertMessage: 'Error reading Prometheus',
|
|
name: dataSourceName,
|
|
form: () => {
|
|
e2e.components.DataSource.Prometheus.configPage.exemplarsAddButton().click();
|
|
e2e.components.DataSource.Prometheus.configPage.internalLinkSwitch().check({ force: true });
|
|
e2e.components.DataSource.DataSourceHttpSettings.urlInput().type('http://prom-url:9090');
|
|
e2e.components.DataSourcePicker.inputV2().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: `${e2e.env('BASE_URL')}/api/datasources/name/${dataSourceName}`, failOnStatusCode: false })
|
|
.then((response) => {
|
|
if (response.isOkStatusCode) {
|
|
return;
|
|
}
|
|
addDataSource();
|
|
});
|
|
});
|
|
|
|
it('should be able to navigate to configured data source', () => {
|
|
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' });
|
|
}
|
|
});
|
|
|
|
e2e.pages.Explore.visit();
|
|
|
|
e2e.components.DataSourcePicker.container().should('be.visible').click();
|
|
e2e().contains(dataSourceName).scrollIntoView().should('be.visible').click();
|
|
|
|
// we need to wait for the query-field being lazy-loaded, in two steps:
|
|
// 1. first we wait for the text 'Loading...' to appear
|
|
// 1. then we wait for the text 'Loading...' to disappear
|
|
const monacoLoadingText = 'Loading...';
|
|
e2e.components.QueryField.container().should('be.visible').should('have.text', monacoLoadingText);
|
|
e2e.components.QueryField.container().should('be.visible').should('not.have.text', monacoLoadingText);
|
|
|
|
e2e.components.TimePicker.openButton().click();
|
|
e2e.components.TimePicker.fromField().clear().type('2021-07-10 17:10:00');
|
|
e2e.components.TimePicker.toField().clear().type('2021-07-10 17:30:00');
|
|
e2e.components.TimePicker.applyTimeRange().click();
|
|
e2e.components.QueryField.container().should('be.visible').type('exemplar-query_bucket{shift}{enter}');
|
|
|
|
e2e.components.DataSource.Prometheus.exemplarMarker().first().trigger('mouseover');
|
|
e2e().contains('Query with gdev-tempo').click();
|
|
e2e.components.TraceViewer.spanBar().should('have.length', 11);
|
|
});
|
|
});
|