@grafana/plugin-e2e 1.8.2 → 1.8.3-canary.1155.05d56c8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -106,6 +106,12 @@ export type Components = {
106
106
  Alert: {
107
107
  alertV2: (severity: string) => string;
108
108
  };
109
+ NavToolbar: {
110
+ editDashboard: {
111
+ backToDashboardButton: string;
112
+ editButton: string;
113
+ };
114
+ };
109
115
  PageToolbar: {
110
116
  item: (tooltip: string) => string;
111
117
  showMoreItems: string;
@@ -187,6 +187,16 @@ export declare const versionedComponents: {
187
187
  "8.0.0": (severity: string) => string;
188
188
  };
189
189
  };
190
+ NavToolbar: {
191
+ editDashboard: {
192
+ editButton: {
193
+ '11.1.0': string;
194
+ };
195
+ backToDashboardButton: {
196
+ '11.1.0': string;
197
+ };
198
+ };
199
+ };
190
200
  PageToolbar: {
191
201
  item: {
192
202
  "8.0.0": (tooltip: string) => string;
@@ -168,6 +168,16 @@ exports.versionedComponents = {
168
168
  [constants_1.MIN_GRAFANA_VERSION]: (severity) => `Alert ${severity}`,
169
169
  },
170
170
  },
171
+ NavToolbar: {
172
+ editDashboard: {
173
+ editButton: {
174
+ '11.1.0': 'data-testid Edit dashboard button',
175
+ },
176
+ backToDashboardButton: {
177
+ '11.1.0': 'data-testid Back to dashboard button',
178
+ },
179
+ },
180
+ },
171
181
  PageToolbar: {
172
182
  item: {
173
183
  [constants_1.MIN_GRAFANA_VERSION]: (tooltip) => `${tooltip}`,
@@ -37,6 +37,7 @@ export declare const versionedPages: {
37
37
  '9.5.0': (title: string) => string;
38
38
  };
39
39
  addNewPanel: {
40
+ '11.1.0': string;
40
41
  "8.0.0": string;
41
42
  };
42
43
  itemButtonAddViz: {
@@ -42,6 +42,7 @@ exports.versionedPages = {
42
42
  '9.5.0': (title) => `data-testid ${title}`,
43
43
  },
44
44
  addNewPanel: {
45
+ '11.1.0': 'data-testid Add new panel',
45
46
  [constants_1.MIN_GRAFANA_VERSION]: 'Add new panel',
46
47
  },
47
48
  itemButtonAddViz: {
@@ -98,11 +98,18 @@ class DashboardPage extends GrafanaPage_1.GrafanaPage {
98
98
  */
99
99
  async addPanel() {
100
100
  const { components, pages } = this.ctx.selectors;
101
+ // From Grafana 11.3.0, one needs to click the edit button before adding a new panel in already existing dashboards
102
+ if (semver.gte(this.ctx.grafanaVersion, '11.3.0') && this.dashboard?.uid) {
103
+ await this.getByGrafanaSelector(components.NavToolbar.editDashboard.editButton).click();
104
+ }
101
105
  if (semver.gte(this.ctx.grafanaVersion, '10.0.0')) {
102
106
  await this.getByGrafanaSelector(components.PageToolbar.itemButton(components.PageToolbar.itemButtonTitle)).click();
103
107
  await this.getByGrafanaSelector(pages.AddDashboard.itemButton(pages.AddDashboard.itemButtonAddViz)).click();
104
108
  }
105
109
  else {
110
+ if (this.dashboard?.uid) {
111
+ await this.getByGrafanaSelector(components.PageToolbar.item('Add panel')).click();
112
+ }
106
113
  await this.getByGrafanaSelector(pages.AddDashboard.addNewPanel).click();
107
114
  }
108
115
  const panelId = await this.ctx.page.evaluate(() => {
@@ -4,6 +4,7 @@ import { DataSourcePicker } from '../components/DataSourcePicker';
4
4
  import { GrafanaPage } from './GrafanaPage';
5
5
  import { TimeRange } from '../components/TimeRange';
6
6
  import { Panel } from '../components/Panel';
7
+ import { DashboardPage } from './DashboardPage';
7
8
  export declare class PanelEditPage extends GrafanaPage {
8
9
  readonly ctx: PluginTestCtx;
9
10
  readonly args: DashboardEditViewArgs<string>;
@@ -34,10 +35,17 @@ export declare class PanelEditPage extends GrafanaPage {
34
35
  * Returns the name of the visualization currently selected in the panel editor
35
36
  */
36
37
  getVisualizationName(): Locator;
38
+ /**
39
+ * Clicks the "Back to dashboard" button in the panel editor
40
+ * In versions prior to 11.3.0, this method clicks the "Apply" button instead
41
+ */
42
+ backToDashboard(): Promise<DashboardPage>;
37
43
  /**
38
44
  * Clicks the "Apply" button in the panel editor
45
+ *
46
+ * @deprecated use {@link PanelEditPage.backToDashboard} method instead.
39
47
  */
40
- apply(): Promise<void>;
48
+ apply(): Promise<DashboardPage>;
41
49
  /**
42
50
  * Returns the locator for the query editor row with the given refId
43
51
  */
@@ -31,6 +31,7 @@ const GrafanaPage_1 = require("./GrafanaPage");
31
31
  const TimeRange_1 = require("../components/TimeRange");
32
32
  const Panel_1 = require("../components/Panel");
33
33
  const utils_1 = require("../utils");
34
+ const DashboardPage_1 = require("./DashboardPage");
34
35
  class PanelEditPage extends GrafanaPage_1.GrafanaPage {
35
36
  ctx;
36
37
  args;
@@ -125,11 +126,26 @@ class PanelEditPage extends GrafanaPage_1.GrafanaPage {
125
126
  getVisualizationName() {
126
127
  return this.getByGrafanaSelector(this.ctx.selectors.components.PanelEditor.toggleVizPicker);
127
128
  }
129
+ /**
130
+ * Clicks the "Back to dashboard" button in the panel editor
131
+ * In versions prior to 11.3.0, this method clicks the "Apply" button instead
132
+ */
133
+ async backToDashboard() {
134
+ if (semver.gte(this.ctx.grafanaVersion, '11.3.0')) {
135
+ await this.getByGrafanaSelector(this.ctx.selectors.components.NavToolbar.editDashboard.backToDashboardButton).click();
136
+ }
137
+ else {
138
+ await this.ctx.page.getByTestId(this.ctx.selectors.components.PanelEditor.applyButton).click();
139
+ }
140
+ return new DashboardPage_1.DashboardPage(this.ctx, this.args);
141
+ }
128
142
  /**
129
143
  * Clicks the "Apply" button in the panel editor
144
+ *
145
+ * @deprecated use {@link PanelEditPage.backToDashboard} method instead.
130
146
  */
131
147
  async apply() {
132
- await this.ctx.page.getByTestId(this.ctx.selectors.components.PanelEditor.applyButton).click();
148
+ return this.backToDashboard();
133
149
  }
134
150
  /**
135
151
  * Returns the locator for the query editor row with the given refId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-e2e",
3
- "version": "1.8.2",
3
+ "version": "1.8.3-canary.1155.05d56c8.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -56,5 +56,5 @@
56
56
  "start": "cls || clear"
57
57
  }
58
58
  },
59
- "gitHead": "4e0a23205e6f92a34e398ed21c1999d7e868f933"
59
+ "gitHead": "05d56c8d6ea478772a9e336bee87c13e1d29c3e9"
60
60
  }