Prometheus: Enable new visual query builder by default (#46634)

* Prometheus: Enable new query builder by default

* Updated e2e test

* Fixed e2e
pull/46742/head^2
Torkel Ödegaard 3 years ago committed by GitHub
parent e0aaff86ae
commit e10c4397dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      conf/defaults.ini
  2. 3
      e2e/various-suite/exemplars.spec.ts
  3. 13
      e2e/various-suite/query-editor.spec.ts
  4. 1
      packages/grafana-e2e-selectors/src/selectors/components.ts

@ -1114,6 +1114,9 @@ license_path =
# enable = feature1,feature2 # enable = feature1,feature2
enable = enable =
# The new prometheus visual query builder
promQueryBuilder = true
# feature1 = true # feature1 = true
# feature2 = false # feature2 = false

@ -49,6 +49,9 @@ describe('Exemplars', () => {
e2e.components.DataSourcePicker.container().should('be.visible').click(); e2e.components.DataSourcePicker.container().should('be.visible').click();
e2e().contains(dataSourceName).scrollIntoView().should('be.visible').click(); e2e().contains(dataSourceName).scrollIntoView().should('be.visible').click();
// Switch to code editor
cy.contains('label', 'Code').click();
// we need to wait for the query-field being lazy-loaded, in two steps: // 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. first we wait for the text 'Loading...' to appear
// 1. then we wait for the text 'Loading...' to disappear // 1. then we wait for the text 'Loading...' to disappear

@ -11,7 +11,9 @@ e2e.scenario({
e2e.components.DataSourcePicker.container().should('be.visible').click(); e2e.components.DataSourcePicker.container().should('be.visible').click();
cy.contains('gdev-prometheus').scrollIntoView().should('be.visible').click(); cy.contains('gdev-prometheus').scrollIntoView().should('be.visible').click();
const queryText = 'http_requests_total'; const queryText = `rate(http_requests_total{job="grafana"}[5m])`;
cy.contains('label', 'Code').click();
// we need to wait for the query-field being lazy-loaded, in two steps: // we need to wait for the query-field being lazy-loaded, in two steps:
// it is a two-step process: // it is a two-step process:
@ -20,13 +22,18 @@ e2e.scenario({
const monacoLoadingText = 'Loading...'; const monacoLoadingText = 'Loading...';
e2e.components.QueryField.container().should('be.visible').should('have.text', monacoLoadingText); 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.QueryField.container().should('be.visible').should('not.have.text', monacoLoadingText);
e2e.components.QueryField.container().type(queryText, { parseSpecialCharSequences: false }).type('{backspace}');
e2e.components.QueryField.container().type(queryText).type('{backspace}');
cy.contains(queryText.slice(0, -1)).should('be.visible'); cy.contains(queryText.slice(0, -1)).should('be.visible');
e2e.components.QueryField.container().type(e2e.typings.undo()); e2e.components.QueryField.container().type(e2e.typings.undo());
cy.contains(queryText).should('be.visible'); cy.contains(queryText).should('be.visible');
cy.get('body').click();
cy.contains('label', 'Builder').click();
cy.get('[data-testid="operations.0.wrapper"]').should('be.visible');
}, },
}); });

@ -171,6 +171,7 @@ export const Components = {
QueryEditorRow: { QueryEditorRow: {
actionButton: (title: string) => `${title} query operation action`, actionButton: (title: string) => `${title} query operation action`,
title: (refId: string) => `Query editor row title ${refId}`, title: (refId: string) => `Query editor row title ${refId}`,
container: (refId: string) => `Query editor row ${refId}`,
}, },
AlertTab: { AlertTab: {
content: 'Alert editor tab content', content: 'Alert editor tab content',

Loading…
Cancel
Save