2023-09-08 10:51:59 -05:00
|
|
|
import { e2e } from '../utils';
|
2024-02-22 05:31:40 -06:00
|
|
|
import { waitForMonacoToLoad } from '../utils/support/monaco';
|
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
|
|
|
});
|
|
|
|
|
2024-04-17 13:53:22 -05:00
|
|
|
// x-ing to bypass this flaky test.
|
|
|
|
// Will rewrite in plugin-e2e with this issue
|
|
|
|
xit('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])`;
|
|
|
|
|
2024-04-15 16:45:23 -05:00
|
|
|
e2e.components.RadioButton.container().filter(':contains("Code")').should('be.visible').click();
|
2020-05-19 08:41:52 -05:00
|
|
|
|
2024-02-22 05:31:40 -06:00
|
|
|
waitForMonacoToLoad();
|
|
|
|
|
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
|
|
|
});
|