@grafana/plugin-e2e 1.9.0-canary.1140.8d70b63.0 → 1.9.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: {
@@ -59,11 +60,13 @@ export declare const versionedPages: {
59
60
  List: {
60
61
  url: {
61
62
  "8.0.0": string;
63
+ '11.3.0': string;
62
64
  };
63
65
  };
64
66
  Edit: {
65
67
  url: {
66
- "8.0.0": (annotationIndex: string) => string;
68
+ "8.0.0": (variableIndex: string) => string;
69
+ '11.3.0': (variableIndex: string) => string;
67
70
  };
68
71
  };
69
72
  };
@@ -100,6 +103,7 @@ export declare const versionedPages: {
100
103
  List: {
101
104
  url: {
102
105
  "8.0.0": (dashboardUid: string) => string;
106
+ '11.3.0': (dashboardUid: string) => string;
103
107
  };
104
108
  newButton: {
105
109
  "8.0.0": string;
@@ -117,6 +121,7 @@ export declare const versionedPages: {
117
121
  Edit: {
118
122
  url: {
119
123
  "8.0.0": (dashboardUid: string, editIndex: string) => string;
124
+ '11.3.0': (dashboardUid: string, editIndex: string) => string;
120
125
  };
121
126
  General: {
122
127
  generalTypeSelectV2: {
@@ -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: {
@@ -64,11 +65,13 @@ exports.versionedPages = {
64
65
  List: {
65
66
  url: {
66
67
  [constants_1.MIN_GRAFANA_VERSION]: '/dashboard/new?orgId=1&editview=templating',
68
+ '11.3.0': '/dashboard/new?orgId=1&editview=variables',
67
69
  },
68
70
  },
69
71
  Edit: {
70
72
  url: {
71
- [constants_1.MIN_GRAFANA_VERSION]: (annotationIndex) => `/dashboard/new?orgId=1&editview=templating&editIndex=${annotationIndex}`,
73
+ [constants_1.MIN_GRAFANA_VERSION]: (variableIndex) => `/dashboard/new?orgId=1&editview=templating&editIndex=${variableIndex}`,
74
+ '11.3.0': (variableIndex) => `/dashboard/new?orgId=1&editview=variables&editIndex=${variableIndex}`,
72
75
  },
73
76
  },
74
77
  },
@@ -106,6 +109,7 @@ exports.versionedPages = {
106
109
  List: {
107
110
  url: {
108
111
  [constants_1.MIN_GRAFANA_VERSION]: (dashboardUid) => `/d/${dashboardUid}?editview=templating`,
112
+ '11.3.0': (dashboardUid) => `/d/${dashboardUid}?editview=variables`,
109
113
  },
110
114
  newButton: {
111
115
  [constants_1.MIN_GRAFANA_VERSION]: 'Variable editor New variable button',
@@ -123,6 +127,7 @@ exports.versionedPages = {
123
127
  Edit: {
124
128
  url: {
125
129
  [constants_1.MIN_GRAFANA_VERSION]: (dashboardUid, editIndex) => `/d/${dashboardUid}?editview=templating&editIndex=${editIndex}`,
130
+ '11.3.0': (dashboardUid, editIndex) => `/d/${dashboardUid}?editview=variables&editIndex=${editIndex}`,
126
131
  },
127
132
  General: {
128
133
  generalTypeSelectV2: {
@@ -1,4 +1,6 @@
1
- import { PageFixture } from '../types';
1
+ import { TestFixture, Page } from '@playwright/test';
2
+ import { PlaywrightArgs } from '../types';
3
+ type PageFixture = TestFixture<Page, PlaywrightArgs>;
2
4
  /**
3
5
  * This fixture ensures the feature toggles defined in the Playwright config are being used in Grafana frontend.
4
6
  * If Grafana version >= 10.1.0, feature toggles are read from to the 'grafana.featureToggles' key in the browser's localStorage.
@@ -11,3 +13,4 @@ import { PageFixture } from '../types';
11
13
  * The script is evaluated after the document was created but before any of its scripts were run.
12
14
  */
13
15
  export declare const page: PageFixture;
16
+ export {};
@@ -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,29 @@ 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 if (semver.gte(this.ctx.grafanaVersion, '9.0.0')) {
138
+ await this.ctx.page.getByTestId(this.ctx.selectors.components.PanelEditor.applyButton).click();
139
+ }
140
+ else {
141
+ await this.ctx.page.getByLabel('panel editor apply').click();
142
+ }
143
+ return new DashboardPage_1.DashboardPage(this.ctx, this.args);
144
+ }
128
145
  /**
129
146
  * Clicks the "Apply" button in the panel editor
147
+ *
148
+ * @deprecated use {@link PanelEditPage.backToDashboard} method instead.
130
149
  */
131
150
  async apply() {
132
- await this.ctx.page.getByTestId(this.ctx.selectors.components.PanelEditor.applyButton).click();
151
+ return this.backToDashboard();
133
152
  }
134
153
  /**
135
154
  * Returns the locator for the query editor row with the given refId
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Locator, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Response, TestInfo, TestFixture, Page } from '@playwright/test';
1
+ import { Locator, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Response, TestInfo } from '@playwright/test';
2
2
  import { E2ESelectors } from './e2e-selectors/types';
3
3
  import { AnnotationEditPage } from './models/pages/AnnotationEditPage';
4
4
  import { AppConfigPage } from './models/pages/AppConfigPage';
@@ -287,7 +287,6 @@ export type PluginTestCtx = {
287
287
  * Playwright args used when defining fixtures
288
288
  */
289
289
  export type PlaywrightArgs = PluginFixture & PluginOptions & PlaywrightTestArgs & PlaywrightTestOptions & PlaywrightWorkerArgs & PlaywrightWorkerOptions;
290
- export type PageFixture = TestFixture<Page, PlaywrightArgs>;
291
290
  /**
292
291
  * The data source settings
293
292
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-e2e",
3
- "version": "1.9.0-canary.1140.8d70b63.0",
3
+ "version": "1.9.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": "8d70b63cb978c9f71ccf9bbe3d8af62323ca67be"
59
+ "gitHead": "6e147dcb3af44550009cad0be302b319899c9d51"
60
60
  }