@grafana/plugin-e2e 2.1.9-canary.2053.17240496040.0 → 2.1.9-canary.2053.17260068442.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.
package/dist/index.d.ts CHANGED
@@ -427,6 +427,7 @@ declare class AlertRuleQuery extends GrafanaPage {
427
427
  declare class AlertRuleEditPage extends GrafanaPage {
428
428
  readonly ctx: PluginTestCtx;
429
429
  readonly args?: AlertRuleArgs | undefined;
430
+ private fullfilled;
430
431
  constructor(ctx: PluginTestCtx, args?: AlertRuleArgs | undefined);
431
432
  /**
432
433
  * Navigates to the annotation edit page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
@@ -435,8 +436,8 @@ declare class AlertRuleEditPage extends GrafanaPage {
435
436
  /**
436
437
  * Returns a locator for hte alert rule name field
437
438
  */
438
- get alertRuleNameField(): Locator;
439
- get advancedModeSwitch(): Locator;
439
+ get alertRuleNameField(): _playwright_test.Locator;
440
+ get advancedModeSwitch(): _playwright_test.Locator;
440
441
  isAdvancedModeSupported(): Promise<boolean>;
441
442
  enableAdvancedQueryMode(): Promise<void>;
442
443
  disableAdvancedQueryMode(): Promise<void>;
@@ -25,12 +25,16 @@ function _interopNamespaceDefault(e) {
25
25
 
26
26
  var semver__namespace = /*#__PURE__*/_interopNamespaceDefault(semver);
27
27
 
28
+ var __defProp = Object.defineProperty;
29
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
30
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
28
31
  const QUERY_AND_EXPRESSION_STEP_ID = "2";
29
32
  class AlertRuleEditPage extends GrafanaPage.GrafanaPage {
30
33
  constructor(ctx, args) {
31
34
  super(ctx, args);
32
35
  this.ctx = ctx;
33
36
  this.args = args;
37
+ __publicField(this, "fullfilled", false);
34
38
  }
35
39
  /**
36
40
  * Navigates to the annotation edit page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
@@ -147,14 +151,20 @@ class AlertRuleEditPage extends GrafanaPage.GrafanaPage {
147
151
  */
148
152
  async evaluate(options) {
149
153
  await this.ctx.page.waitForTimeout(1e3);
154
+ if (this.fullfilled) {
155
+ await this.ctx.page.unroute(this.ctx.selectors.apis.Alerting.eval);
156
+ this.fullfilled = false;
157
+ }
150
158
  if (semver__namespace.gte(this.ctx.grafanaVersion, "10.0.0")) {
151
159
  this.ctx.page.route(this.ctx.selectors.apis.Alerting.eval, async (route) => {
152
160
  const response = await route.fetch();
153
161
  if (!response.ok()) {
162
+ this.fullfilled = true;
154
163
  return route.fulfill({ response });
155
164
  }
156
165
  let body = await response.json();
157
166
  const statuses = Object.keys(body.results).map((key) => body.results[key].status);
167
+ this.fullfilled = true;
158
168
  route.fulfill({
159
169
  response,
160
170
  status: statuses.every((status) => status >= 200 && status < 300) ? 200 : statuses[0]
@@ -165,17 +175,16 @@ class AlertRuleEditPage extends GrafanaPage.GrafanaPage {
165
175
  (resp) => resp.url().includes(this.ctx.selectors.apis.Alerting.eval),
166
176
  options
167
177
  );
168
- let evaluateButton;
178
+ let evaluateButton = this.getByGrafanaSelector(this.ctx.selectors.components.AlertRules.previewButton);
169
179
  if (semver__namespace.lt(this.ctx.grafanaVersion, "11.1.0")) {
170
- evaluateButton = await this.ctx.page.getByRole("button", { name: "Preview", exact: true });
171
- } else {
172
- evaluateButton = await this.getByGrafanaSelector(this.ctx.selectors.components.AlertRules.previewButton);
180
+ evaluateButton = this.ctx.page.getByRole("button", { name: "Preview", exact: true });
173
181
  }
174
182
  const evalReq = this.ctx.page.waitForRequest((req) => req.url().includes(this.ctx.selectors.apis.Alerting.eval), {
175
183
  timeout: 5e3
176
184
  }).catch(async () => {
177
185
  await evaluateButton.click();
178
186
  });
187
+ await test.expect(evaluateButton).toBeVisible();
179
188
  await evaluateButton.click();
180
189
  await evalReq;
181
190
  return responsePromise;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-e2e",
3
- "version": "2.1.9-canary.2053.17240496040.0",
3
+ "version": "2.1.9-canary.2053.17260068442.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -47,5 +47,5 @@
47
47
  "uuid": "^11.0.2",
48
48
  "yaml": "^2.3.4"
49
49
  },
50
- "gitHead": "5f8dce1c79bcc41cd8a0843c37a6d6e1c1932d55"
50
+ "gitHead": "54426211cce602c2bf75a7043b109bd9f9f479e0"
51
51
  }