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