@grafana/plugin-e2e 0.0.1 → 0.0.2-canary.608.15a86bf.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/api.d.ts +1 -1
- package/dist/api.js +4 -4
- package/dist/e2e-selectors/resolver.js +12 -12
- package/dist/e2e-selectors/resolver.test.js +17 -19
- package/dist/e2e-selectors/versioned/apis.js +24 -26
- package/dist/e2e-selectors/versioned/components.js +78 -83
- package/dist/e2e-selectors/versioned/pages.js +40 -47
- package/dist/fixtures/annotationEditPage.js +6 -58
- package/dist/fixtures/commands/createDataSource.js +28 -102
- package/dist/fixtures/commands/createDataSourceConfigPage.js +12 -77
- package/dist/fixtures/commands/login.js +10 -80
- package/dist/fixtures/commands/readProvision.js +9 -63
- package/dist/fixtures/explorePage.js +5 -55
- package/dist/fixtures/grafanaVersion.js +7 -59
- package/dist/fixtures/index.js +11 -11
- package/dist/fixtures/newDashboardPage.js +5 -55
- package/dist/fixtures/panelEditPage.js +3 -52
- package/dist/fixtures/selectors.js +10 -58
- package/dist/fixtures/variableEditPage.js +6 -58
- package/dist/matchers/index.js +3 -3
- package/dist/matchers/toBeOK.js +20 -65
- package/dist/matchers/toDisplayPreviews.js +21 -66
- package/dist/matchers/toHavePanelError.js +20 -70
- package/dist/matchers/utils.js +1 -1
- package/dist/models/AnnotationEditPage.js +13 -77
- package/dist/models/AnnotationPage.js +21 -94
- package/dist/models/DashboardPage.js +50 -156
- package/dist/models/DataSourceConfigPage.js +25 -128
- package/dist/models/DataSourcePicker.js +13 -81
- package/dist/models/ExplorePage.d.ts +1 -1
- package/dist/models/ExplorePage.js +34 -123
- package/dist/models/GrafanaPage.js +33 -137
- package/dist/models/PanelEditPage.d.ts +1 -1
- package/dist/models/PanelEditPage.js +37 -132
- package/dist/models/TimeRange.js +25 -114
- package/dist/models/VariableEditPage.js +25 -104
- package/dist/models/VariablePage.js +22 -101
- package/dist/selectorEngine.js +8 -8
- package/package.json +2 -2
|
@@ -1,135 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
3
|
exports.DataSourceConfigPage = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return _this;
|
|
4
|
+
const GrafanaPage_1 = require("./GrafanaPage");
|
|
5
|
+
class DataSourceConfigPage extends GrafanaPage_1.GrafanaPage {
|
|
6
|
+
datasource;
|
|
7
|
+
constructor(ctx, datasource) {
|
|
8
|
+
super(ctx);
|
|
9
|
+
this.datasource = datasource;
|
|
62
10
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
_a.sent();
|
|
70
|
-
return [2];
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
DataSourceConfigPage.prototype.goto = function () {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
77
|
-
return __generator(this, function (_a) {
|
|
78
|
-
switch (_a.label) {
|
|
79
|
-
case 0: return [4, this.ctx.page.goto(this.ctx.selectors.pages.EditDataSource.url(this.datasource.uid), {
|
|
80
|
-
waitUntil: 'load',
|
|
81
|
-
})];
|
|
82
|
-
case 1:
|
|
83
|
-
_a.sent();
|
|
84
|
-
return [2];
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
DataSourceConfigPage.prototype.mockHealthCheckResponse = function (json, status) {
|
|
90
|
-
if (status === void 0) { status = 200; }
|
|
91
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
-
var _this = this;
|
|
93
|
-
return __generator(this, function (_a) {
|
|
94
|
-
switch (_a.label) {
|
|
95
|
-
case 0: return [4, this.ctx.page.route("".concat(this.ctx.selectors.apis.DataSource.health), function (route) { return __awaiter(_this, void 0, void 0, function () {
|
|
96
|
-
return __generator(this, function (_a) {
|
|
97
|
-
switch (_a.label) {
|
|
98
|
-
case 0: return [4, route.fulfill({ json: json, status: status })];
|
|
99
|
-
case 1:
|
|
100
|
-
_a.sent();
|
|
101
|
-
return [2];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}); })];
|
|
105
|
-
case 1:
|
|
106
|
-
_a.sent();
|
|
107
|
-
return [2];
|
|
108
|
-
}
|
|
109
|
-
});
|
|
11
|
+
async deleteDataSource() {
|
|
12
|
+
await this.ctx.request.delete(this.ctx.selectors.apis.DataSource.delete(this.datasource.uid));
|
|
13
|
+
}
|
|
14
|
+
async goto() {
|
|
15
|
+
await this.ctx.page.goto(this.ctx.selectors.pages.EditDataSource.url(this.datasource.uid), {
|
|
16
|
+
waitUntil: 'load',
|
|
110
17
|
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
var _this = this;
|
|
116
|
-
return __generator(this, function (_a) {
|
|
117
|
-
switch (_a.label) {
|
|
118
|
-
case 0:
|
|
119
|
-
responsePromise = this.ctx.page.waitForResponse(function (resp) {
|
|
120
|
-
var _a, _b;
|
|
121
|
-
return resp
|
|
122
|
-
.url()
|
|
123
|
-
.includes(_this.ctx.selectors.apis.DataSource.health((_a = _this.datasource.uid) !== null && _a !== void 0 ? _a : '', (_b = _this.datasource.id.toString()) !== null && _b !== void 0 ? _b : ''));
|
|
124
|
-
});
|
|
125
|
-
return [4, this.getByTestIdOrAriaLabel(this.ctx.selectors.pages.DataSource.saveAndTest).click()];
|
|
126
|
-
case 1:
|
|
127
|
-
_a.sent();
|
|
128
|
-
return [2, responsePromise];
|
|
129
|
-
}
|
|
130
|
-
});
|
|
18
|
+
}
|
|
19
|
+
async mockHealthCheckResponse(json, status = 200) {
|
|
20
|
+
await this.ctx.page.route(`${this.ctx.selectors.apis.DataSource.health}`, async (route) => {
|
|
21
|
+
await route.fulfill({ json, status });
|
|
131
22
|
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
23
|
+
}
|
|
24
|
+
async saveAndTest() {
|
|
25
|
+
const responsePromise = this.ctx.page.waitForResponse((resp) => resp
|
|
26
|
+
.url()
|
|
27
|
+
.includes(this.ctx.selectors.apis.DataSource.health(this.datasource.uid ?? '', this.datasource.id.toString() ?? '')));
|
|
28
|
+
await this.getByTestIdOrAriaLabel(this.ctx.selectors.pages.DataSource.saveAndTest).click();
|
|
29
|
+
return responsePromise;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
135
32
|
exports.DataSourceConfigPage = DataSourceConfigPage;
|
|
@@ -1,86 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
3
|
exports.DataSourcePicker = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
4
|
+
const GrafanaPage_1 = require("./GrafanaPage");
|
|
5
|
+
class DataSourcePicker extends GrafanaPage_1.GrafanaPage {
|
|
6
|
+
constructor(ctx) {
|
|
7
|
+
super(ctx);
|
|
8
|
+
}
|
|
9
|
+
async set(name) {
|
|
10
|
+
await this.getByTestIdOrAriaLabel(this.ctx.selectors.components.DataSourcePicker.container)
|
|
11
|
+
.locator('input')
|
|
12
|
+
.fill(name);
|
|
13
|
+
await this.ctx.page.keyboard.press('ArrowDown');
|
|
14
|
+
await this.ctx.page.keyboard.press('ArrowUp');
|
|
15
|
+
await this.ctx.page.keyboard.press('Enter');
|
|
60
16
|
}
|
|
61
|
-
|
|
62
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
return __generator(this, function (_a) {
|
|
64
|
-
switch (_a.label) {
|
|
65
|
-
case 0: return [4, this.getByTestIdOrAriaLabel(this.ctx.selectors.components.DataSourcePicker.container)
|
|
66
|
-
.locator('input')
|
|
67
|
-
.fill(name)];
|
|
68
|
-
case 1:
|
|
69
|
-
_a.sent();
|
|
70
|
-
return [4, this.ctx.page.keyboard.press('ArrowDown')];
|
|
71
|
-
case 2:
|
|
72
|
-
_a.sent();
|
|
73
|
-
return [4, this.ctx.page.keyboard.press('ArrowUp')];
|
|
74
|
-
case 3:
|
|
75
|
-
_a.sent();
|
|
76
|
-
return [4, this.ctx.page.keyboard.press('Enter')];
|
|
77
|
-
case 4:
|
|
78
|
-
_a.sent();
|
|
79
|
-
return [2];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
return DataSourcePicker;
|
|
85
|
-
}(GrafanaPage_1.GrafanaPage));
|
|
17
|
+
}
|
|
86
18
|
exports.DataSourcePicker = DataSourcePicker;
|
|
@@ -8,5 +8,5 @@ export declare class ExplorePage extends GrafanaPage {
|
|
|
8
8
|
constructor(ctx: PluginTestCtx);
|
|
9
9
|
goto(options?: NavigateOptions): Promise<void>;
|
|
10
10
|
getQueryEditorRow(refId: string): Promise<Locator>;
|
|
11
|
-
runQuery(options?: RequestOptions): Promise<import("playwright
|
|
11
|
+
runQuery(options?: RequestOptions): Promise<import("@playwright/test").Response>;
|
|
12
12
|
}
|
|
@@ -1,130 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
3
|
exports.ExplorePage = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
const DataSourcePicker_1 = require("./DataSourcePicker");
|
|
6
|
+
const GrafanaPage_1 = require("./GrafanaPage");
|
|
7
|
+
const TimeRange_1 = require("./TimeRange");
|
|
8
|
+
class ExplorePage extends GrafanaPage_1.GrafanaPage {
|
|
9
|
+
datasource;
|
|
10
|
+
timeRange;
|
|
11
|
+
constructor(ctx) {
|
|
12
|
+
super(ctx);
|
|
13
|
+
this.datasource = new DataSourcePicker_1.DataSourcePicker(ctx);
|
|
14
|
+
this.timeRange = new TimeRange_1.TimeRange(ctx);
|
|
66
15
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
_a.sent();
|
|
74
|
-
return [2];
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
ExplorePage.prototype.getQueryEditorRow = function (refId) {
|
|
80
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
-
var locator;
|
|
82
|
-
return __generator(this, function (_a) {
|
|
83
|
-
switch (_a.label) {
|
|
84
|
-
case 0:
|
|
85
|
-
locator = this.getByTestIdOrAriaLabel(this.ctx.selectors.components.QueryEditorRows.rows).filter({
|
|
86
|
-
has: this.getByTestIdOrAriaLabel(this.ctx.selectors.components.QueryEditorRow.title(refId)),
|
|
87
|
-
});
|
|
88
|
-
return [4, (0, test_1.expect)(locator).toBeVisible()];
|
|
89
|
-
case 1:
|
|
90
|
-
_a.sent();
|
|
91
|
-
return [2, locator];
|
|
92
|
-
}
|
|
93
|
-
});
|
|
16
|
+
async goto(options) {
|
|
17
|
+
await super.navigate(this.ctx.selectors.pages.Explore.url, options);
|
|
18
|
+
}
|
|
19
|
+
async getQueryEditorRow(refId) {
|
|
20
|
+
const locator = this.getByTestIdOrAriaLabel(this.ctx.selectors.components.QueryEditorRows.rows).filter({
|
|
21
|
+
has: this.getByTestIdOrAriaLabel(this.ctx.selectors.components.QueryEditorRow.title(refId)),
|
|
94
22
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
responsePromise = this.ctx.page.waitForResponse(function (resp) { return resp.url().includes(_this.ctx.selectors.apis.DataSource.query); }, options);
|
|
105
|
-
_a.label = 1;
|
|
106
|
-
case 1:
|
|
107
|
-
_a.trys.push([1, 3, , 6]);
|
|
108
|
-
return [4, this.getByTestIdOrAriaLabel(components.RefreshPicker.runButtonV2).click({
|
|
109
|
-
timeout: 1000,
|
|
110
|
-
})];
|
|
111
|
-
case 2:
|
|
112
|
-
_a.sent();
|
|
113
|
-
return [3, 6];
|
|
114
|
-
case 3:
|
|
115
|
-
_1 = _a.sent();
|
|
116
|
-
return [4, this.getByTestIdOrAriaLabel(components.PageToolbar.item(components.PageToolbar.shotMoreItems)).click()];
|
|
117
|
-
case 4:
|
|
118
|
-
_a.sent();
|
|
119
|
-
return [4, this.getByTestIdOrAriaLabel(components.RefreshPicker.runButtonV2).last().click()];
|
|
120
|
-
case 5:
|
|
121
|
-
_a.sent();
|
|
122
|
-
return [3, 6];
|
|
123
|
-
case 6: return [2, responsePromise];
|
|
124
|
-
}
|
|
23
|
+
await (0, test_1.expect)(locator).toBeVisible();
|
|
24
|
+
return locator;
|
|
25
|
+
}
|
|
26
|
+
async runQuery(options) {
|
|
27
|
+
const components = this.ctx.selectors.components;
|
|
28
|
+
const responsePromise = this.ctx.page.waitForResponse((resp) => resp.url().includes(this.ctx.selectors.apis.DataSource.query), options);
|
|
29
|
+
try {
|
|
30
|
+
await this.getByTestIdOrAriaLabel(components.RefreshPicker.runButtonV2).click({
|
|
31
|
+
timeout: 1000,
|
|
125
32
|
});
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
33
|
+
}
|
|
34
|
+
catch (_) {
|
|
35
|
+
await this.getByTestIdOrAriaLabel(components.PageToolbar.item(components.PageToolbar.shotMoreItems)).click();
|
|
36
|
+
await this.getByTestIdOrAriaLabel(components.RefreshPicker.runButtonV2).last().click();
|
|
37
|
+
}
|
|
38
|
+
return responsePromise;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
130
41
|
exports.ExplorePage = ExplorePage;
|
|
@@ -1,150 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
3
|
exports.GrafanaPage = void 0;
|
|
51
|
-
|
|
52
|
-
|
|
4
|
+
class GrafanaPage {
|
|
5
|
+
ctx;
|
|
6
|
+
constructor(ctx) {
|
|
53
7
|
this.ctx = ctx;
|
|
54
8
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
return [4, this.ctx.page.goto(url, __assign({ waitUntil: 'networkidle' }, options))];
|
|
64
|
-
case 1:
|
|
65
|
-
_a.sent();
|
|
66
|
-
return [2];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
9
|
+
async navigate(url, options) {
|
|
10
|
+
if (options?.queryParams) {
|
|
11
|
+
url += `?${options.queryParams.toString()}`;
|
|
12
|
+
}
|
|
13
|
+
await this.ctx.page.goto(url, {
|
|
14
|
+
waitUntil: 'networkidle',
|
|
15
|
+
...options,
|
|
69
16
|
});
|
|
70
|
-
}
|
|
71
|
-
|
|
17
|
+
}
|
|
18
|
+
getByTestIdOrAriaLabel(selector, root) {
|
|
72
19
|
if (selector.startsWith('data-testid')) {
|
|
73
20
|
return (root || this.ctx.page).getByTestId(selector);
|
|
74
21
|
}
|
|
75
|
-
return (root || this.ctx.page).locator(
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var _this = this;
|
|
81
|
-
return __generator(this, function (_a) {
|
|
82
|
-
switch (_a.label) {
|
|
83
|
-
case 0: return [4, this.ctx.page.route(this.ctx.selectors.apis.DataSource.queryPattern, function (route) { return __awaiter(_this, void 0, void 0, function () {
|
|
84
|
-
return __generator(this, function (_a) {
|
|
85
|
-
switch (_a.label) {
|
|
86
|
-
case 0: return [4, route.fulfill({ json: json, status: status })];
|
|
87
|
-
case 1:
|
|
88
|
-
_a.sent();
|
|
89
|
-
return [2];
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}); })];
|
|
93
|
-
case 1:
|
|
94
|
-
_a.sent();
|
|
95
|
-
return [2];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
22
|
+
return (root || this.ctx.page).locator(`[aria-label="${selector}"]`);
|
|
23
|
+
}
|
|
24
|
+
async mockQueryDataResponse(json, status = 200) {
|
|
25
|
+
await this.ctx.page.route(this.ctx.selectors.apis.DataSource.queryPattern, async (route) => {
|
|
26
|
+
await route.fulfill({ json, status });
|
|
98
27
|
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var _this = this;
|
|
104
|
-
return __generator(this, function (_a) {
|
|
105
|
-
switch (_a.label) {
|
|
106
|
-
case 0: return [4, this.ctx.page.route("".concat(this.ctx.selectors.apis.DataSource.resourceUIDPattern, "/").concat(path), function (route) { return __awaiter(_this, void 0, void 0, function () {
|
|
107
|
-
return __generator(this, function (_a) {
|
|
108
|
-
switch (_a.label) {
|
|
109
|
-
case 0: return [4, route.fulfill({ json: json, status: status })];
|
|
110
|
-
case 1:
|
|
111
|
-
_a.sent();
|
|
112
|
-
return [2];
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}); })];
|
|
116
|
-
case 1:
|
|
117
|
-
_a.sent();
|
|
118
|
-
return [4, this.ctx.page.route("".concat(this.ctx.selectors.apis.DataSource.resourcePattern, "/").concat(path), function (route) { return __awaiter(_this, void 0, void 0, function () {
|
|
119
|
-
return __generator(this, function (_a) {
|
|
120
|
-
switch (_a.label) {
|
|
121
|
-
case 0: return [4, route.fulfill({ json: json, status: status })];
|
|
122
|
-
case 1:
|
|
123
|
-
_a.sent();
|
|
124
|
-
return [2];
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}); })];
|
|
128
|
-
case 2:
|
|
129
|
-
_a.sent();
|
|
130
|
-
return [2];
|
|
131
|
-
}
|
|
132
|
-
});
|
|
28
|
+
}
|
|
29
|
+
async mockResourceResponse(path, json, status = 200) {
|
|
30
|
+
await this.ctx.page.route(`${this.ctx.selectors.apis.DataSource.resourceUIDPattern}/${path}`, async (route) => {
|
|
31
|
+
await route.fulfill({ json, status });
|
|
133
32
|
});
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
-
var _this = this;
|
|
138
|
-
return __generator(this, function (_a) {
|
|
139
|
-
return [2, this.ctx.page.waitForRequest(function (request) {
|
|
140
|
-
if (request.url().includes(_this.ctx.selectors.apis.DataSource.query) && request.method() === 'POST') {
|
|
141
|
-
return cb ? cb(request) : true;
|
|
142
|
-
}
|
|
143
|
-
return false;
|
|
144
|
-
})];
|
|
145
|
-
});
|
|
33
|
+
await this.ctx.page.route(`${this.ctx.selectors.apis.DataSource.resourcePattern}/${path}`, async (route) => {
|
|
34
|
+
await route.fulfill({ json, status });
|
|
146
35
|
});
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
36
|
+
}
|
|
37
|
+
async waitForQueryDataRequest(cb) {
|
|
38
|
+
return this.ctx.page.waitForRequest((request) => {
|
|
39
|
+
if (request.url().includes(this.ctx.selectors.apis.DataSource.query) && request.method() === 'POST') {
|
|
40
|
+
return cb ? cb(request) : true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
150
46
|
exports.GrafanaPage = GrafanaPage;
|
|
@@ -11,5 +11,5 @@ export declare class PanelEditPage extends GrafanaPage implements PanelError {
|
|
|
11
11
|
apply(): Promise<void>;
|
|
12
12
|
getQueryEditorRow(refId: string): Promise<Locator>;
|
|
13
13
|
getPanelError(): Locator;
|
|
14
|
-
refreshPanel(options?: RequestOptions): Promise<import("playwright
|
|
14
|
+
refreshPanel(options?: RequestOptions): Promise<import("@playwright/test").Response>;
|
|
15
15
|
}
|