@grafana/plugin-e2e 0.26.0 → 0.26.1

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.
@@ -11,7 +11,7 @@ export type APIs = {
11
11
  query: string;
12
12
  health: (uid: string, id: string) => string;
13
13
  datasourceByUID: (uid: string) => string;
14
- proxy: (uid: string) => string;
14
+ proxy: (uid: string, id: string) => string;
15
15
  };
16
16
  Dashboard: {
17
17
  delete: (uid: string) => string;
@@ -175,10 +175,12 @@ export type Pages = {
175
175
  newButton: string;
176
176
  addVariableCTAV2: (variableName: string) => string;
177
177
  addVariableCTAV2Item: string;
178
+ table: string;
178
179
  };
179
180
  Edit: {
180
181
  url: (dashboardUid: string, editIndex: string) => string;
181
182
  General: {
183
+ selectionOptionsIncludeAllSwitch: string;
182
184
  generalTypeSelectV2: string;
183
185
  previewOfValuesOption: string;
184
186
  submitButton: string;
@@ -21,7 +21,8 @@ export declare const versionedAPIs: {
21
21
  "8.0.0": (uid: string) => string;
22
22
  };
23
23
  proxy: {
24
- "8.0.0": (uid: string) => string;
24
+ '9.4.0': (uid: string, _: string) => string;
25
+ "8.0.0": (_: string, id: string) => string;
25
26
  };
26
27
  };
27
28
  Dashboard: {
@@ -25,7 +25,8 @@ exports.versionedAPIs = {
25
25
  [constants_1.MIN_GRAFANA_VERSION]: (uid) => `/api/datasources/uid/${uid}`,
26
26
  },
27
27
  proxy: {
28
- [constants_1.MIN_GRAFANA_VERSION]: (uid) => `api/datasources/proxy/uid/${uid}`,
28
+ '9.4.0': (uid, _) => `api/datasources/proxy/uid/${uid}`,
29
+ [constants_1.MIN_GRAFANA_VERSION]: (_, id) => `/api/datasources/proxy/${id}`,
29
30
  },
30
31
  },
31
32
  Dashboard: {
@@ -112,6 +112,9 @@ export declare const versionedPages: {
112
112
  '10.4.0': string;
113
113
  "8.0.0": string;
114
114
  };
115
+ selectionOptionsIncludeAllSwitch: {
116
+ "8.0.0": string;
117
+ };
115
118
  };
116
119
  };
117
120
  };
@@ -118,6 +118,9 @@ exports.versionedPages = {
118
118
  '10.4.0': 'data-testid Variable editor Run Query button',
119
119
  [constants_1.MIN_GRAFANA_VERSION]: 'Variable editor Submit button',
120
120
  },
121
+ selectionOptionsIncludeAllSwitch: {
122
+ [constants_1.MIN_GRAFANA_VERSION]: 'Variable editor Form IncludeAll switch',
123
+ },
121
124
  },
122
125
  },
123
126
  },
@@ -45,7 +45,14 @@ class AnnotationEditPage extends GrafanaPage_1.GrafanaPage {
45
45
  const url = this.args.dashboard?.uid
46
46
  ? Dashboard.Settings.Annotations.Edit.url(this.args.dashboard.uid, this.args.id)
47
47
  : AddDashboard.Settings.Annotations.Edit.url(this.args.id);
48
- return super.navigate(url, options);
48
+ await super.navigate(url, options);
49
+ // In versions before 9.2.0, the annotation index is not part of the URL so there's no way to navigate to it directly.
50
+ // Instead, we have to click the nth row in the variable list to navigate to the edit page for a given annotation index.
51
+ if (semver.lt(this.ctx.grafanaVersion, '9.2.0') && this.args.id) {
52
+ const list = this.ctx.page.locator('tbody tr');
53
+ const variables = await list.all();
54
+ await variables[Number(this.args.id)].click();
55
+ }
49
56
  }
50
57
  /**
51
58
  * Executes the annotation query defined in the annotation page and returns the response promise
@@ -1,7 +1,30 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.ExplorePage = void 0;
4
- const semver = require('semver');
27
+ const semver = __importStar(require("semver"));
5
28
  const DataSourcePicker_1 = require("../components/DataSourcePicker");
6
29
  const GrafanaPage_1 = require("./GrafanaPage");
7
30
  const TimeRange_1 = require("../components/TimeRange");
@@ -1,7 +1,30 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.VariableEditPage = void 0;
4
- const gte = require('semver/functions/gte');
27
+ const semver = __importStar(require("semver"));
5
28
  const DataSourcePicker_1 = require("../components/DataSourcePicker");
6
29
  const GrafanaPage_1 = require("./GrafanaPage");
7
30
  class VariableEditPage extends GrafanaPage_1.GrafanaPage {
@@ -23,6 +46,13 @@ class VariableEditPage extends GrafanaPage_1.GrafanaPage {
23
46
  ? Dashboard.Settings.Variables.Edit.url(this.args.dashboard.uid, this.args.id)
24
47
  : AddDashboard.Settings.Variables.Edit.url(this.args.id);
25
48
  await super.navigate(url, options);
49
+ // In versions before 9.2.0, the variable index is not part of the URL so there's no way to navigate to it directly.
50
+ // Instead, we have to click the nth row in the variable list to navigate to the edit page for a given variable index.
51
+ if (semver.lt(this.ctx.grafanaVersion, '9.2.0') && this.args.id) {
52
+ const list = this.getByGrafanaSelector(this.ctx.selectors.pages.Dashboard.Settings.Variables.List.table).locator('tbody tr');
53
+ const variables = await list.all();
54
+ await variables[Number(this.args.id)].click();
55
+ }
26
56
  }
27
57
  /**
28
58
  * Sets the type of variable in the 'Variable type' dropdown to the given type
@@ -44,12 +74,16 @@ class VariableEditPage extends GrafanaPage_1.GrafanaPage {
44
74
  */
45
75
  async runQuery() {
46
76
  // in 9.2.0, the submit button got a new purpose. it no longer submits the form, but instead runs the query
47
- if (gte(this.ctx.grafanaVersion, '9.2.0')) {
77
+ if (semver.gte(this.ctx.grafanaVersion, '9.2.0')) {
48
78
  await this.getByGrafanaSelector(this.ctx.selectors.pages.Dashboard.Settings.Variables.Edit.General.submitButton).click();
49
79
  }
50
80
  else {
51
- // in 9.1.3, the submit button submits the form
52
- await this.ctx.page.keyboard.press('Tab');
81
+ // in version before 9.2.0, there's no submit button, so instead we click the "Include all" button to trigger the query
82
+ const queryDataRequest = this.waitForQueryDataRequest();
83
+ const includeAllSwitch = this.getByGrafanaSelector(this.ctx.selectors.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsIncludeAllSwitch).locator('..');
84
+ await includeAllSwitch.click();
85
+ await queryDataRequest;
86
+ await includeAllSwitch.click();
53
87
  }
54
88
  }
55
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-e2e",
3
- "version": "0.26.0",
3
+ "version": "0.26.1",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -55,5 +55,5 @@
55
55
  "start": "cls || clear"
56
56
  }
57
57
  },
58
- "gitHead": "c2f0cae29ad626e595146dd59abbadf7c21d6d37"
58
+ "gitHead": "e6b578f7f1dbd3d405ac150e71b625ed3db5c82b"
59
59
  }