1 import { e2e } from '@grafana/e2e';
2 import { Then, When } from 'cypress-cucumber-preprocessor/steps';
3 import 'cypress-iframe';
6 cy.frameLoaded('#iframe');
10 Then('I should see the grafana panel {string}', (panels: string) => {
11 getIframe().within(() => {
12 for (const panel of panels.split(', ')) {
13 cy.get('.grafana-app')
16 e2e.components.Panels.Panel.title(panel).should('be.visible');
22 When('I view the grafana panel {string}', (panels: string) => {
23 getIframe().within(() => {
24 for (const panel of panels.split(', ')) {
25 cy.get('.grafana-app')
28 e2e.components.Panels.Panel.title(panel).should('be.visible').click();
29 e2e.components.Panels.Panel.headerItems('View').should('be.visible').click();
35 Then('I should not see {string} in the panel {string}', (value: string, panels: string) => {
36 getIframe().within(() => {
37 for (const panel of panels.split(', ')) {
38 cy.get('.grafana-app')
41 cy.get(`[aria-label="${panel} panel"]`)
44 cy.get('span').first().should('not.have.text', value);
52 'I should see the legends {string} in the graph {string}',
53 (legends: string, panels: string) => {
54 getIframe().within(() => {
55 for (const panel of panels.split(', ')) {
56 cy.get('.grafana-app')
59 cy.get(`[aria-label="${panel} panel"]`)
62 for (const legend of legends.split(', ')) {
63 cy.get('a').contains(legend);
72 Then('I should not see No Data in the graph {string}', (panels: string) => {
73 getIframe().within(() => {
74 for (const panel of panels.split(', ')) {
75 cy.get('.grafana-app')
78 cy.get(`[aria-label="${panel} panel"]`)
81 cy.get('div.datapoints-warning').should('not.exist');