2023-09-08 16:51:59 +01:00
|
|
|
import { e2e } from '../utils';
|
2020-05-19 15:41:52 +02:00
|
|
|
|
2023-09-13 13:24:20 +01:00
|
|
|
describe('Query editor', () => {
|
|
|
|
|
beforeEach(() => {
|
2023-09-27 11:33:00 +01:00
|
|
|
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
|
2023-09-13 13:24:20 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('Undo should work in query editor for prometheus -- test CI.', () => {
|
2020-05-19 15:41:52 +02:00
|
|
|
e2e.pages.Explore.visit();
|
2021-11-26 16:38:48 +01:00
|
|
|
e2e.components.DataSourcePicker.container().should('be.visible').click();
|
2021-07-14 14:04:23 +01:00
|
|
|
|
|
|
|
|
cy.contains('gdev-prometheus').scrollIntoView().should('be.visible').click();
|
2022-03-23 07:28:19 +01:00
|
|
|
const queryText = `rate(http_requests_total{job="grafana"}[5m])`;
|
|
|
|
|
|
|
|
|
|
cy.contains('label', 'Code').click();
|
2020-05-19 15:41:52 +02:00
|
|
|
|
2021-11-08 14:20:48 +01:00
|
|
|
// we need to wait for the query-field being lazy-loaded, in two steps:
|
|
|
|
|
// it is a two-step process:
|
|
|
|
|
// 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);
|
2022-03-23 07:28:19 +01:00
|
|
|
e2e.components.QueryField.container().type(queryText, { parseSpecialCharSequences: false }).type('{backspace}');
|
2020-05-19 15:41:52 +02:00
|
|
|
|
|
|
|
|
cy.contains(queryText.slice(0, -1)).should('be.visible');
|
|
|
|
|
|
2020-09-24 18:47:25 +02:00
|
|
|
e2e.components.QueryField.container().type(e2e.typings.undo());
|
2020-05-19 15:41:52 +02:00
|
|
|
|
|
|
|
|
cy.contains(queryText).should('be.visible');
|
2022-03-23 07:28:19 +01:00
|
|
|
|
2023-01-04 14:59:53 +00:00
|
|
|
e2e.components.Alert.alertV2('error').should('not.be.visible');
|
2023-09-13 13:24:20 +01:00
|
|
|
});
|
2020-05-19 15:41:52 +02:00
|
|
|
});
|