@grafana/plugin-e2e 0.22.0 → 0.22.1-canary.739.9a473be.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.
@@ -167,10 +167,12 @@ export type Pages = {
167
167
  newButton: string;
168
168
  addVariableCTAV2: (variableName: string) => string;
169
169
  addVariableCTAV2Item: string;
170
+ table: string;
170
171
  };
171
172
  Edit: {
172
173
  url: (dashboardUid: string, editIndex: string) => string;
173
174
  General: {
175
+ selectionOptionsIncludeAllSwitch: string;
174
176
  generalTypeSelectV2: string;
175
177
  previewOfValuesOption: string;
176
178
  submitButton: string;
@@ -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
  },
@@ -1,6 +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.AnnotationEditPage = void 0;
27
+ const semver = __importStar(require("semver"));
4
28
  const DataSourcePicker_1 = require("../components/DataSourcePicker");
5
29
  const GrafanaPage_1 = require("./GrafanaPage");
6
30
  class AnnotationEditPage extends GrafanaPage_1.GrafanaPage {
@@ -21,7 +45,14 @@ class AnnotationEditPage extends GrafanaPage_1.GrafanaPage {
21
45
  const url = this.args.dashboard?.uid
22
46
  ? Dashboard.Settings.Annotations.Edit.url(this.args.dashboard.uid, this.args.id)
23
47
  : AddDashboard.Settings.Annotations.Edit.url(this.args.id);
24
- 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
+ }
25
56
  }
26
57
  /**
27
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.getByTestIdOrAriaLabel(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.getByTestIdOrAriaLabel(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.getByTestIdOrAriaLabel(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.22.0",
3
+ "version": "0.22.1-canary.739.9a473be.0",
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": "56f2047fa1f6bb46dd5471cdc43ae42cba0d6057"
58
+ "gitHead": "9a473be5a93dbf3ba6cd900fa93ea90e85df54ee"
59
59
  }