@grafana/plugin-e2e 0.0.2-canary.610.88b3096.0 → 0.0.2
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 +2 -6
- 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/types.d.ts +1 -4
- 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.d.ts +0 -4
- package/dist/matchers/index.js +3 -5
- 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.d.ts +2 -2
- package/dist/models/DataSourceConfigPage.js +25 -131
- 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/dist/types.d.ts +1 -12
- package/package.json +2 -2
- package/dist/matchers/toHaveAlert.d.ts +0 -8
- package/dist/matchers/toHaveAlert.js +0 -75
|
@@ -1,70 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const test_1 = require("@playwright/test");
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
const toDisplayPreviews = async (variableEditPage, previewTexts) => {
|
|
6
|
+
let pass = false;
|
|
7
|
+
let actual;
|
|
8
|
+
let message = `To find preview of values: ${previewTexts.join(', ')}}`;
|
|
9
|
+
try {
|
|
10
|
+
await (0, test_1.expect)(variableEditPage.getByTestIdOrAriaLabel(variableEditPage.ctx.selectors.pages.Dashboard.Settings.Variables.Edit.General.previewOfValuesOption)).toContainText(previewTexts);
|
|
11
|
+
return {
|
|
12
|
+
pass: true,
|
|
13
|
+
actual: false,
|
|
14
|
+
message: () => message,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
return {
|
|
19
|
+
message: () => (0, utils_1.getMessage)(message, err instanceof Error ? err.toString() : 'Unknown error'),
|
|
20
|
+
pass,
|
|
21
|
+
actual,
|
|
22
|
+
};
|
|
36
23
|
}
|
|
37
24
|
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var test_1 = require("@playwright/test");
|
|
40
|
-
var utils_1 = require("./utils");
|
|
41
|
-
var toDisplayPreviews = function (variableEditPage, previewTexts) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
-
var pass, actual, message, err_1;
|
|
43
|
-
return __generator(this, function (_a) {
|
|
44
|
-
switch (_a.label) {
|
|
45
|
-
case 0:
|
|
46
|
-
pass = false;
|
|
47
|
-
message = "To find preview of values: ".concat(previewTexts.join(', '), "}");
|
|
48
|
-
_a.label = 1;
|
|
49
|
-
case 1:
|
|
50
|
-
_a.trys.push([1, 3, , 4]);
|
|
51
|
-
return [4, (0, test_1.expect)(variableEditPage.getByTestIdOrAriaLabel(variableEditPage.ctx.selectors.pages.Dashboard.Settings.Variables.Edit.General.previewOfValuesOption)).toContainText(previewTexts)];
|
|
52
|
-
case 2:
|
|
53
|
-
_a.sent();
|
|
54
|
-
return [2, {
|
|
55
|
-
pass: true,
|
|
56
|
-
actual: false,
|
|
57
|
-
message: function () { return message; },
|
|
58
|
-
}];
|
|
59
|
-
case 3:
|
|
60
|
-
err_1 = _a.sent();
|
|
61
|
-
return [2, {
|
|
62
|
-
message: function () { return (0, utils_1.getMessage)(message, err_1 instanceof Error ? err_1.toString() : 'Unknown error'); },
|
|
63
|
-
pass: pass,
|
|
64
|
-
actual: actual,
|
|
65
|
-
}];
|
|
66
|
-
case 4: return [2];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}); };
|
|
70
25
|
exports.default = toDisplayPreviews;
|
|
@@ -1,74 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const test_1 = require("@playwright/test");
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
const toHavePanelError = async (panelError, options) => {
|
|
6
|
+
let pass = true;
|
|
7
|
+
let actual;
|
|
8
|
+
let message = 'A panel error to be displayed';
|
|
9
|
+
try {
|
|
10
|
+
const numberOfErrors = await panelError.getPanelError().count();
|
|
11
|
+
await (0, test_1.expect)(numberOfErrors).toBe(1);
|
|
36
12
|
}
|
|
13
|
+
catch (_) {
|
|
14
|
+
message = (0, utils_1.getMessage)(message, 'No panel error was found on the page');
|
|
15
|
+
actual = await panelError.getPanelError().count();
|
|
16
|
+
pass = false;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
message: () => message,
|
|
20
|
+
pass,
|
|
21
|
+
actual,
|
|
22
|
+
};
|
|
37
23
|
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var test_1 = require("@playwright/test");
|
|
40
|
-
var utils_1 = require("./utils");
|
|
41
|
-
var toHavePanelError = function (panelError, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
-
var pass, actual, message, numberOfErrors, _1;
|
|
43
|
-
return __generator(this, function (_a) {
|
|
44
|
-
switch (_a.label) {
|
|
45
|
-
case 0:
|
|
46
|
-
pass = true;
|
|
47
|
-
message = 'A panel error to be displayed';
|
|
48
|
-
_a.label = 1;
|
|
49
|
-
case 1:
|
|
50
|
-
_a.trys.push([1, 4, , 6]);
|
|
51
|
-
return [4, panelError.getPanelError().count()];
|
|
52
|
-
case 2:
|
|
53
|
-
numberOfErrors = _a.sent();
|
|
54
|
-
return [4, (0, test_1.expect)(numberOfErrors).toBe(1)];
|
|
55
|
-
case 3:
|
|
56
|
-
_a.sent();
|
|
57
|
-
return [3, 6];
|
|
58
|
-
case 4:
|
|
59
|
-
_1 = _a.sent();
|
|
60
|
-
message = (0, utils_1.getMessage)(message, 'No panel error was found on the page');
|
|
61
|
-
return [4, panelError.getPanelError().count()];
|
|
62
|
-
case 5:
|
|
63
|
-
actual = _a.sent();
|
|
64
|
-
pass = false;
|
|
65
|
-
return [3, 6];
|
|
66
|
-
case 6: return [2, {
|
|
67
|
-
message: function () { return message; },
|
|
68
|
-
pass: pass,
|
|
69
|
-
actual: actual,
|
|
70
|
-
}];
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}); };
|
|
74
24
|
exports.default = toHavePanelError;
|
package/dist/matchers/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getMessage = void 0;
|
|
4
|
-
|
|
4
|
+
const getMessage = (expected, received) => `Expected: ${expected}\nReceived: ${received}`;
|
|
5
5
|
exports.getMessage = getMessage;
|
|
@@ -1,82 +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.AnnotationEditPage = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
4
|
+
const DataSourcePicker_1 = require("./DataSourcePicker");
|
|
5
|
+
const GrafanaPage_1 = require("./GrafanaPage");
|
|
6
|
+
class AnnotationEditPage extends GrafanaPage_1.GrafanaPage {
|
|
7
|
+
datasource;
|
|
8
|
+
constructor(ctx) {
|
|
9
|
+
super(ctx);
|
|
10
|
+
this.datasource = new DataSourcePicker_1.DataSourcePicker(ctx);
|
|
11
|
+
}
|
|
12
|
+
async runQuery(options) {
|
|
13
|
+
const responsePromise = this.ctx.page.waitForResponse((resp) => resp.url().includes(this.ctx.selectors.apis.DataSource.query), options);
|
|
14
|
+
await this.ctx.page.getByRole('button', { name: 'TEST' }).click();
|
|
15
|
+
return responsePromise;
|
|
63
16
|
}
|
|
64
|
-
|
|
65
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
-
var responsePromise;
|
|
67
|
-
var _this = this;
|
|
68
|
-
return __generator(this, function (_a) {
|
|
69
|
-
switch (_a.label) {
|
|
70
|
-
case 0:
|
|
71
|
-
responsePromise = this.ctx.page.waitForResponse(function (resp) { return resp.url().includes(_this.ctx.selectors.apis.DataSource.query); }, options);
|
|
72
|
-
return [4, this.ctx.page.getByRole('button', { name: 'TEST' }).click()];
|
|
73
|
-
case 1:
|
|
74
|
-
_a.sent();
|
|
75
|
-
return [2, responsePromise];
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
return AnnotationEditPage;
|
|
81
|
-
}(GrafanaPage_1.GrafanaPage));
|
|
17
|
+
}
|
|
82
18
|
exports.AnnotationEditPage = AnnotationEditPage;
|
|
@@ -1,19 +1,4 @@
|
|
|
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
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
3
|
if (k2 === undefined) k2 = k;
|
|
19
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -37,87 +22,29 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
37
22
|
__setModuleDefault(result, mod);
|
|
38
23
|
return result;
|
|
39
24
|
};
|
|
40
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
50
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
51
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
52
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
53
|
-
function step(op) {
|
|
54
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
55
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
56
|
-
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;
|
|
57
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
58
|
-
switch (op[0]) {
|
|
59
|
-
case 0: case 1: t = op; break;
|
|
60
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
61
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
62
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
63
|
-
default:
|
|
64
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
65
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
66
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
67
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
68
|
-
if (t[2]) _.ops.pop();
|
|
69
|
-
_.trys.pop(); continue;
|
|
70
|
-
}
|
|
71
|
-
op = body.call(thisArg, _);
|
|
72
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
73
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
26
|
exports.AnnotationPage = void 0;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return _super.call(this, ctx) || this;
|
|
27
|
+
const semver = __importStar(require("semver"));
|
|
28
|
+
const AnnotationEditPage_1 = require("./AnnotationEditPage");
|
|
29
|
+
const GrafanaPage_1 = require("./GrafanaPage");
|
|
30
|
+
class AnnotationPage extends GrafanaPage_1.GrafanaPage {
|
|
31
|
+
constructor(ctx) {
|
|
32
|
+
super(ctx);
|
|
85
33
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
switch (_a.label) {
|
|
90
|
-
case 0: return [4, this.ctx.page.goto(this.ctx.selectors.pages.AddDashboard.Settings.Annotations.List.url, {
|
|
91
|
-
waitUntil: 'networkidle',
|
|
92
|
-
})];
|
|
93
|
-
case 1:
|
|
94
|
-
_a.sent();
|
|
95
|
-
return [2];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
34
|
+
async goto() {
|
|
35
|
+
await this.ctx.page.goto(this.ctx.selectors.pages.AddDashboard.Settings.Annotations.List.url, {
|
|
36
|
+
waitUntil: 'networkidle',
|
|
98
37
|
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return [3, 4];
|
|
112
|
-
case 2: return [4, this.getByTestIdOrAriaLabel(Dashboard.Settings.Annotations.List.addAnnotationCTA).click()];
|
|
113
|
-
case 3:
|
|
114
|
-
_a.sent();
|
|
115
|
-
_a.label = 4;
|
|
116
|
-
case 4: return [2, new AnnotationEditPage_1.AnnotationEditPage(this.ctx)];
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
return AnnotationPage;
|
|
122
|
-
}(GrafanaPage_1.GrafanaPage));
|
|
38
|
+
}
|
|
39
|
+
async clickAddNew() {
|
|
40
|
+
const { Dashboard } = this.ctx.selectors.pages;
|
|
41
|
+
if (semver.gte(this.ctx.grafanaVersion, '8.3.0')) {
|
|
42
|
+
await this.getByTestIdOrAriaLabel(Dashboard.Settings.Annotations.List.addAnnotationCTAV2).click();
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
await this.getByTestIdOrAriaLabel(Dashboard.Settings.Annotations.List.addAnnotationCTA).click();
|
|
46
|
+
}
|
|
47
|
+
return new AnnotationEditPage_1.AnnotationEditPage(this.ctx);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
123
50
|
exports.AnnotationPage = AnnotationPage;
|
|
@@ -1,163 +1,57 @@
|
|
|
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.DashboardPage = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
4
|
+
const gte = require('semver/functions/gte');
|
|
5
|
+
const DataSourcePicker_1 = require("./DataSourcePicker");
|
|
6
|
+
const GrafanaPage_1 = require("./GrafanaPage");
|
|
7
|
+
const PanelEditPage_1 = require("./PanelEditPage");
|
|
8
|
+
const TimeRange_1 = require("./TimeRange");
|
|
9
|
+
class DashboardPage extends GrafanaPage_1.GrafanaPage {
|
|
10
|
+
dashboardUid;
|
|
11
|
+
dataSourcePicker;
|
|
12
|
+
timeRange;
|
|
13
|
+
constructor(ctx, dashboardUid) {
|
|
14
|
+
super(ctx);
|
|
15
|
+
this.dashboardUid = dashboardUid;
|
|
16
|
+
this.dataSourcePicker = new DataSourcePicker_1.DataSourcePicker(ctx);
|
|
17
|
+
this.timeRange = new TimeRange_1.TimeRange(ctx);
|
|
68
18
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (opts === null || opts === void 0 ? void 0 : opts.queryParams) {
|
|
78
|
-
url += "?".concat(opts.queryParams.toString());
|
|
79
|
-
}
|
|
80
|
-
return [4, this.ctx.page.goto(url, {
|
|
81
|
-
waitUntil: 'networkidle',
|
|
82
|
-
})];
|
|
83
|
-
case 1:
|
|
84
|
-
_a.sent();
|
|
85
|
-
if (!(opts === null || opts === void 0 ? void 0 : opts.timeRange)) return [3, 3];
|
|
86
|
-
return [4, this.timeRange.set(opts.timeRange)];
|
|
87
|
-
case 2:
|
|
88
|
-
_a.sent();
|
|
89
|
-
_a.label = 3;
|
|
90
|
-
case 3: return [2];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
DashboardPage.prototype.gotoPanelEditPage = function (panelId) {
|
|
96
|
-
var _a;
|
|
97
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
-
var url;
|
|
99
|
-
return __generator(this, function (_b) {
|
|
100
|
-
switch (_b.label) {
|
|
101
|
-
case 0:
|
|
102
|
-
url = this.ctx.selectors.pages.Dashboard.url((_a = this.dashboardUid) !== null && _a !== void 0 ? _a : '');
|
|
103
|
-
return [4, this.ctx.page.goto("".concat(url, "?editPanel=").concat(panelId), {
|
|
104
|
-
waitUntil: 'networkidle',
|
|
105
|
-
})];
|
|
106
|
-
case 1:
|
|
107
|
-
_b.sent();
|
|
108
|
-
return [2, new PanelEditPage_1.PanelEditPage(this.ctx)];
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
DashboardPage.prototype.addPanel = function () {
|
|
114
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
115
|
-
var _a, components, pages;
|
|
116
|
-
return __generator(this, function (_b) {
|
|
117
|
-
switch (_b.label) {
|
|
118
|
-
case 0:
|
|
119
|
-
_a = this.ctx.selectors, components = _a.components, pages = _a.pages;
|
|
120
|
-
if (!gte(this.ctx.grafanaVersion, '10.0.0')) return [3, 3];
|
|
121
|
-
return [4, this.getByTestIdOrAriaLabel(components.PageToolbar.itemButton(components.PageToolbar.itemButtonTitle)).click()];
|
|
122
|
-
case 1:
|
|
123
|
-
_b.sent();
|
|
124
|
-
return [4, this.getByTestIdOrAriaLabel(pages.AddDashboard.itemButton(pages.AddDashboard.itemButtonAddViz)).click()];
|
|
125
|
-
case 2:
|
|
126
|
-
_b.sent();
|
|
127
|
-
return [3, 5];
|
|
128
|
-
case 3: return [4, this.getByTestIdOrAriaLabel(pages.AddDashboard.addNewPanel).click()];
|
|
129
|
-
case 4:
|
|
130
|
-
_b.sent();
|
|
131
|
-
_b.label = 5;
|
|
132
|
-
case 5: return [2, new PanelEditPage_1.PanelEditPage(this.ctx)];
|
|
133
|
-
}
|
|
134
|
-
});
|
|
19
|
+
async goto(opts) {
|
|
20
|
+
const uid = opts?.uid || this.dashboardUid;
|
|
21
|
+
let url = uid ? this.ctx.selectors.pages.Dashboard.url(uid) : this.ctx.selectors.pages.AddDashboard.url;
|
|
22
|
+
if (opts?.queryParams) {
|
|
23
|
+
url += `?${opts.queryParams.toString()}`;
|
|
24
|
+
}
|
|
25
|
+
await this.ctx.page.goto(url, {
|
|
26
|
+
waitUntil: 'networkidle',
|
|
135
27
|
});
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return [2];
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
DashboardPage.prototype.refreshDashboard = function () {
|
|
150
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
-
return __generator(this, function (_a) {
|
|
152
|
-
switch (_a.label) {
|
|
153
|
-
case 0: return [4, this.ctx.page.getByTestId(this.ctx.selectors.components.RefreshPicker.runButtonV2).click()];
|
|
154
|
-
case 1:
|
|
155
|
-
_a.sent();
|
|
156
|
-
return [2];
|
|
157
|
-
}
|
|
158
|
-
});
|
|
28
|
+
if (opts?.timeRange) {
|
|
29
|
+
await this.timeRange.set(opts.timeRange);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async gotoPanelEditPage(panelId) {
|
|
33
|
+
const url = this.ctx.selectors.pages.Dashboard.url(this.dashboardUid ?? '');
|
|
34
|
+
await this.ctx.page.goto(`${url}?editPanel=${panelId}`, {
|
|
35
|
+
waitUntil: 'networkidle',
|
|
159
36
|
});
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
37
|
+
return new PanelEditPage_1.PanelEditPage(this.ctx);
|
|
38
|
+
}
|
|
39
|
+
async addPanel() {
|
|
40
|
+
const { components, pages } = this.ctx.selectors;
|
|
41
|
+
if (gte(this.ctx.grafanaVersion, '10.0.0')) {
|
|
42
|
+
await this.getByTestIdOrAriaLabel(components.PageToolbar.itemButton(components.PageToolbar.itemButtonTitle)).click();
|
|
43
|
+
await this.getByTestIdOrAriaLabel(pages.AddDashboard.itemButton(pages.AddDashboard.itemButtonAddViz)).click();
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
await this.getByTestIdOrAriaLabel(pages.AddDashboard.addNewPanel).click();
|
|
47
|
+
}
|
|
48
|
+
return new PanelEditPage_1.PanelEditPage(this.ctx);
|
|
49
|
+
}
|
|
50
|
+
async deleteDashboard() {
|
|
51
|
+
await this.ctx.request.delete(this.ctx.selectors.apis.Dashboard.delete(this.dashboardUid));
|
|
52
|
+
}
|
|
53
|
+
async refreshDashboard() {
|
|
54
|
+
await this.ctx.page.getByTestId(this.ctx.selectors.components.RefreshPicker.runButtonV2).click();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
163
57
|
exports.DashboardPage = DashboardPage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataSource, PluginTestCtx
|
|
1
|
+
import { DataSource, PluginTestCtx } from '../types';
|
|
2
2
|
import { GrafanaPage } from './GrafanaPage';
|
|
3
3
|
export declare class DataSourceConfigPage extends GrafanaPage {
|
|
4
4
|
private datasource;
|
|
@@ -6,5 +6,5 @@ export declare class DataSourceConfigPage extends GrafanaPage {
|
|
|
6
6
|
deleteDataSource(): Promise<void>;
|
|
7
7
|
goto(): Promise<void>;
|
|
8
8
|
mockHealthCheckResponse<T = any>(json: T, status?: number): Promise<void>;
|
|
9
|
-
saveAndTest(
|
|
9
|
+
saveAndTest(): Promise<import("playwright-core").Response>;
|
|
10
10
|
}
|