grafana/e2e/various-suite/filter-annotations.spec.ts
Ashley Harrison 0f2f25c5d9
Chore: Move to Cypress 12 and decouple cypress from @grafana/e2e (#74084)
* update drone to use cypress 12 image

* upgrade cypress to 12 in core

* cypress config actually valid

* update @grafana/e2e imports and add lint rule

* ignore grafana-e2e from betterer now it's deprecated

* fix remaining type errors

* fix failing tests

* remove unnecessary tsconfig

* remove unnecessary comment

* update enterprise suite commands to work

* add cypress config to CODEOWNERS

* export setTimeRange in utils

* remove @grafana/e2e from core deps

* try running the command through yarn

* move CMD to scripts

* Update cloud-data-sources e2e image

* Update paths

---------

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
2023-09-08 16:51:59 +01:00

62 lines
2.4 KiB
TypeScript

import { e2e } from '../utils';
const DASHBOARD_ID = 'ed155665';
e2e.scenario({
describeName: 'Annotations filtering',
itName: 'Tests switching filter type updates the UI accordingly',
addScenarioDataSource: false,
addScenarioDashBoard: false,
skipScenario: false,
scenario: () => {
e2e.flows.openDashboard({ uid: DASHBOARD_ID });
e2e.components.PageToolbar.item('Dashboard settings').click();
e2e.components.Tab.title('Annotations').click();
cy.contains('New query').click();
e2e.pages.Dashboard.Settings.Annotations.Settings.name().clear().type('Red - Panel two');
e2e.pages.Dashboard.Settings.Annotations.NewAnnotation.showInLabel()
.should('be.visible')
.within(() => {
// All panels
e2e.components.Annotations.annotationsTypeInput().click({ force: true }).type('All panels{enter}');
e2e.components.Annotations.annotationsChoosePanelInput().should('not.exist');
// All panels except
e2e.components.Annotations.annotationsTypeInput().click({ force: true }).type('All panels except{enter}');
e2e.components.Annotations.annotationsChoosePanelInput().should('be.visible');
// Selected panels
e2e.components.Annotations.annotationsTypeInput().click({ force: true }).type('Selected panels{enter}');
e2e.components.Annotations.annotationsChoosePanelInput()
.should('be.visible')
.click({ force: true })
.type('Panel two{enter}');
});
e2e.pages.Dashboard.Settings.Annotations.NewAnnotation.previewInDashboard().click({ force: true });
e2e.pages.Dashboard.SubMenu.Annotations.annotationsWrapper()
.should('be.visible')
.within(() => {
e2e.pages.Dashboard.SubMenu.Annotations.annotationLabel('Red - Panel two').should('be.visible');
e2e.pages.Dashboard.SubMenu.Annotations.annotationToggle('Red - Panel two')
.should('be.checked')
.uncheck({ force: true })
.should('not.be.checked')
.check({ force: true });
e2e.pages.Dashboard.SubMenu.Annotations.annotationLabel('Red, only panel 1').should('be.visible');
e2e.pages.Dashboard.SubMenu.Annotations.annotationToggle('Red, only panel 1').should('be.checked');
});
e2e().wait(3000);
e2e.components.Panels.Panel.title('Panel one')
.should('exist')
.within(() => {
e2e.pages.Dashboard.Annotations.marker().should('exist').should('have.length', 4);
});
},
});