@grafana/plugin-e2e 2.1.9-canary.2053.17240496040.0 → 2.1.9-canary.2053.17260056832.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,19 @@ 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
|
+
}
|
|
150
157
|
if (semver__namespace.gte(this.ctx.grafanaVersion, "10.0.0")) {
|
|
151
158
|
this.ctx.page.route(this.ctx.selectors.apis.Alerting.eval, async (route) => {
|
|
152
159
|
const response = await route.fetch();
|
|
153
160
|
if (!response.ok()) {
|
|
161
|
+
this.fullfilled = true;
|
|
154
162
|
return route.fulfill({ response });
|
|
155
163
|
}
|
|
156
164
|
let body = await response.json();
|
|
157
165
|
const statuses = Object.keys(body.results).map((key) => body.results[key].status);
|
|
166
|
+
this.fullfilled = true;
|
|
158
167
|
route.fulfill({
|
|
159
168
|
response,
|
|
160
169
|
status: statuses.every((status) => status >= 200 && status < 300) ? 200 : statuses[0]
|
|
@@ -165,17 +174,16 @@ class AlertRuleEditPage extends GrafanaPage.GrafanaPage {
|
|
|
165
174
|
(resp) => resp.url().includes(this.ctx.selectors.apis.Alerting.eval),
|
|
166
175
|
options
|
|
167
176
|
);
|
|
168
|
-
let evaluateButton;
|
|
177
|
+
let evaluateButton = this.getByGrafanaSelector(this.ctx.selectors.components.AlertRules.previewButton);
|
|
169
178
|
if (semver__namespace.lt(this.ctx.grafanaVersion, "11.1.0")) {
|
|
170
|
-
evaluateButton =
|
|
171
|
-
} else {
|
|
172
|
-
evaluateButton = await this.getByGrafanaSelector(this.ctx.selectors.components.AlertRules.previewButton);
|
|
179
|
+
evaluateButton = this.ctx.page.getByRole("button", { name: "Preview", exact: true });
|
|
173
180
|
}
|
|
174
181
|
const evalReq = this.ctx.page.waitForRequest((req) => req.url().includes(this.ctx.selectors.apis.Alerting.eval), {
|
|
175
182
|
timeout: 5e3
|
|
176
183
|
}).catch(async () => {
|
|
177
184
|
await evaluateButton.click();
|
|
178
185
|
});
|
|
186
|
+
await test.expect(evaluateButton).toBeVisible();
|
|
179
187
|
await evaluateButton.click();
|
|
180
188
|
await evalReq;
|
|
181
189
|
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.
|
|
3
|
+
"version": "2.1.9-canary.2053.17260056832.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": "
|
|
50
|
+
"gitHead": "e37895f0b543c6dafaea7683deceb9dd13afcf9d"
|
|
51
51
|
}
|