@grafana/plugin-e2e 3.9.0-canary.2621.26576348885.0 → 3.9.1
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/fixtures/alertRuleEditPage.js +2 -21
- package/dist/fixtures/commands/createDataSource.js +1 -2
- package/dist/fixtures/commands/gotoAlertRuleEditPage.js +2 -21
- package/dist/fixtures/page.js +2 -2
- package/dist/index.d.ts +117 -69
- package/dist/index.js +7 -12
- package/dist/models/Components.js +0 -18
- package/dist/models/components/ColorPicker.js +4 -13
- package/dist/models/components/DataSourcePicker.js +2 -21
- package/dist/models/components/MultiSelect.js +0 -12
- package/dist/models/components/Panel.js +4 -23
- package/dist/models/components/PanelEditOptionsGroup.js +4 -4
- package/dist/models/components/RadioGroup.js +2 -16
- package/dist/models/components/Select.js +0 -11
- package/dist/models/components/Switch.js +3 -17
- package/dist/models/components/TimeRange.js +2 -21
- package/dist/models/components/UnitPicker.js +0 -12
- package/dist/models/pages/AlertRuleEditPage.js +4 -23
- package/dist/models/pages/AnnotationEditPage.js +3 -22
- package/dist/models/pages/AnnotationPage.js +2 -21
- package/dist/models/pages/DashboardPage.js +9 -28
- package/dist/models/pages/ExplorePage.js +3 -22
- package/dist/models/pages/PanelEditPage.js +8 -27
- package/dist/models/pages/VariableEditPage.js +3 -22
- package/dist/utils/version.js +107 -0
- package/package.json +4 -7
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var version = require('../utils/version.js');
|
|
4
4
|
var AlertRuleEditPage = require('../models/pages/AlertRuleEditPage.js');
|
|
5
5
|
|
|
6
|
-
function _interopNamespaceDefault(e) {
|
|
7
|
-
var n = Object.create(null);
|
|
8
|
-
if (e) {
|
|
9
|
-
Object.keys(e).forEach(function (k) {
|
|
10
|
-
if (k !== 'default') {
|
|
11
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () { return e[k]; }
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
n.default = e;
|
|
20
|
-
return Object.freeze(n);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
var semver__namespace = /*#__PURE__*/_interopNamespaceDefault(semver);
|
|
24
|
-
|
|
25
6
|
const alertRuleEditPage = async ({ page, selectors, grafanaVersion, request }, use, testInfo) => {
|
|
26
|
-
if (
|
|
7
|
+
if (version.lt(grafanaVersion, "9.5.0")) {
|
|
27
8
|
console.log(
|
|
28
9
|
"Testing alert rules with plugin-e2e is only supported for Grafana 9.5.0 and later. Checkout https://grafana.com/developers/plugin-tools/e2e-test-a-plugin/test-a-data-source-plugin/annotation-queries#test-the-entire-annotation-query-execution-flow to see how to skip tests for a range of Grafana versions."
|
|
29
10
|
);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var uuid = require('uuid');
|
|
4
3
|
var test = require('@playwright/test');
|
|
5
4
|
|
|
6
5
|
const createDataSourceViaAPI = async (grafanaAPIClient, datasource) => {
|
|
7
6
|
const { type, name } = datasource;
|
|
8
|
-
const dsName = name ?? `${type}-${
|
|
7
|
+
const dsName = name ?? `${type}-${crypto.randomUUID()}`;
|
|
9
8
|
const existingDataSource = await grafanaAPIClient.getDataSourceByName(dsName);
|
|
10
9
|
if (existingDataSource.ok()) {
|
|
11
10
|
const json = await existingDataSource.json();
|
|
@@ -1,30 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var version = require('../../utils/version.js');
|
|
4
4
|
var AlertRuleEditPage = require('../../models/pages/AlertRuleEditPage.js');
|
|
5
5
|
|
|
6
|
-
function _interopNamespaceDefault(e) {
|
|
7
|
-
var n = Object.create(null);
|
|
8
|
-
if (e) {
|
|
9
|
-
Object.keys(e).forEach(function (k) {
|
|
10
|
-
if (k !== 'default') {
|
|
11
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () { return e[k]; }
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
n.default = e;
|
|
20
|
-
return Object.freeze(n);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
var semver__namespace = /*#__PURE__*/_interopNamespaceDefault(semver);
|
|
24
|
-
|
|
25
6
|
const gotoAlertRuleEditPage = async ({ request, page, selectors, grafanaVersion }, use, testInfo) => {
|
|
26
7
|
await use(async (args) => {
|
|
27
|
-
if (
|
|
8
|
+
if (version.lt(grafanaVersion, "9.5.0")) {
|
|
28
9
|
console.log(
|
|
29
10
|
"Testing alert rules with plugin-e2e is only supported for Grafana 9.4.0 and later. Checkout https://grafana.com/developers/plugin-tools/e2e-test-a-plugin/test-a-data-source-plugin/annotation-queries#test-the-entire-annotation-query-execution-flow to see how to skip tests for a range of Grafana versions."
|
|
30
11
|
);
|
package/dist/fixtures/page.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var version = require('../utils/version.js');
|
|
4
4
|
var options = require('../options.js');
|
|
5
5
|
var openFeature = require('./openFeature.js');
|
|
6
6
|
var overrideGrafanaBootData = require('./scripts/overrideGrafanaBootData.js');
|
|
@@ -17,7 +17,7 @@ const page = async ({ page: page2, featureToggles, openFeature: openFeature$1, u
|
|
|
17
17
|
console.error("Failed to set feature toggles", error);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
if (hasOpenFeature &&
|
|
20
|
+
if (hasOpenFeature && version.gte(grafanaVersion, "12.1.0")) {
|
|
21
21
|
await openFeature.setupOpenFeatureRoutes(page2, mergedFlags, openFeature$1.latency ?? 0, selectors);
|
|
22
22
|
}
|
|
23
23
|
await page2.goto("/");
|
package/dist/index.d.ts
CHANGED
|
@@ -171,58 +171,6 @@ declare class AppPage extends GrafanaPage {
|
|
|
171
171
|
goto(options?: AppPageNavigateOptions): Promise<void>;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
type LocatorParams = Parameters<Locator['locator']>;
|
|
175
|
-
declare abstract class ComponentBase {
|
|
176
|
-
readonly ctx: PluginTestCtx;
|
|
177
|
-
protected readonly element: Locator;
|
|
178
|
-
constructor(ctx: PluginTestCtx, element: Locator);
|
|
179
|
-
locator(selectorOrLocator?: LocatorParams[0], options?: LocatorParams[1]): Locator;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
type SelectOptionsType = Parameters<Locator['selectOption']>[1];
|
|
183
|
-
type CheckOptionsType = Parameters<Locator['check']>[0];
|
|
184
|
-
|
|
185
|
-
declare class ColorPicker extends ComponentBase {
|
|
186
|
-
constructor(ctx: PluginTestCtx, element: Locator);
|
|
187
|
-
static getContainer(ctx: PluginTestCtx, root?: Locator): Locator;
|
|
188
|
-
within(root: Locator): ColorPicker;
|
|
189
|
-
selectOption(rgbOrHex: string, options?: SelectOptionsType): Promise<void>;
|
|
190
|
-
private getCustomTab;
|
|
191
|
-
private getContainer;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
declare class MultiSelect extends ComponentBase {
|
|
195
|
-
constructor(ctx: PluginTestCtx, element: Locator);
|
|
196
|
-
static getContainer(ctx: PluginTestCtx, root?: Locator): Locator;
|
|
197
|
-
within(root: Locator): MultiSelect;
|
|
198
|
-
selectOptions(values: string[], options?: SelectOptionsType): Promise<string[]>;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
declare class RadioGroup extends ComponentBase {
|
|
202
|
-
constructor(ctx: PluginTestCtx, element: Locator);
|
|
203
|
-
static getContainer(ctx: PluginTestCtx, root?: Locator): Locator;
|
|
204
|
-
within(root: Locator): RadioGroup;
|
|
205
|
-
check(labelOrValue: string, options?: CheckOptionsType): Promise<void>;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
declare class Select extends ComponentBase {
|
|
209
|
-
constructor(ctx: PluginTestCtx, element: Locator);
|
|
210
|
-
static getContainer(ctx: PluginTestCtx, root?: Locator): Locator;
|
|
211
|
-
within(root: Locator): Select;
|
|
212
|
-
selectOption(values: string, options?: SelectOptionsType): Promise<string>;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
declare class Switch extends ComponentBase {
|
|
216
|
-
private group;
|
|
217
|
-
constructor(ctx: PluginTestCtx, group: Locator);
|
|
218
|
-
static getContainer(ctx: PluginTestCtx, root?: Locator): Locator;
|
|
219
|
-
within(root: Locator): Switch;
|
|
220
|
-
private static getElement;
|
|
221
|
-
check(options?: CheckOptionsType): Promise<void>;
|
|
222
|
-
uncheck(options?: CheckOptionsType): Promise<void>;
|
|
223
|
-
private getSwitch;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
174
|
declare class TimeRange extends ScopedComponent {
|
|
227
175
|
/**
|
|
228
176
|
* Opens the time picker and sets the time range to the provided values
|
|
@@ -230,14 +178,6 @@ declare class TimeRange extends ScopedComponent {
|
|
|
230
178
|
set({ from, to, zone }: TimeRangeArgs): Promise<void>;
|
|
231
179
|
}
|
|
232
180
|
|
|
233
|
-
declare class UnitPicker extends ComponentBase {
|
|
234
|
-
constructor(ctx: PluginTestCtx, element: Locator);
|
|
235
|
-
static getContainer(ctx: PluginTestCtx, root?: Locator): Locator;
|
|
236
|
-
within(root: Locator): UnitPicker;
|
|
237
|
-
selectOption(value: string, options?: SelectOptionsType): Promise<void>;
|
|
238
|
-
private getOption;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
181
|
/**
|
|
242
182
|
* Factory for components that are not attached to a specific page.
|
|
243
183
|
*
|
|
@@ -251,19 +191,11 @@ declare class UnitPicker extends ComponentBase {
|
|
|
251
191
|
* ```typescript
|
|
252
192
|
* await components.dataSourcePicker.set('prom');
|
|
253
193
|
* await components.dataSourcePicker.within(panel).set('prom');
|
|
254
|
-
* await components.select.within(fieldLabel).selectOption('Europe/Stockholm');
|
|
255
|
-
* await components.switch.within(fieldLabel).check();
|
|
256
194
|
* ```
|
|
257
195
|
*/
|
|
258
196
|
declare class Components {
|
|
259
197
|
readonly dataSourcePicker: DataSourcePicker;
|
|
260
198
|
readonly timeRangePicker: TimeRange;
|
|
261
|
-
readonly select: Select;
|
|
262
|
-
readonly multiSelect: MultiSelect;
|
|
263
|
-
readonly switch: Switch;
|
|
264
|
-
readonly radioGroup: RadioGroup;
|
|
265
|
-
readonly unitPicker: UnitPicker;
|
|
266
|
-
readonly colorPicker: ColorPicker;
|
|
267
199
|
constructor(ctx: PluginTestCtx);
|
|
268
200
|
}
|
|
269
201
|
|
|
@@ -309,6 +241,54 @@ declare class Panel extends GrafanaPage {
|
|
|
309
241
|
getErrorIcon(): Locator;
|
|
310
242
|
}
|
|
311
243
|
|
|
244
|
+
type LocatorParams = Parameters<Locator['locator']>;
|
|
245
|
+
declare abstract class ComponentBase {
|
|
246
|
+
readonly ctx: PluginTestCtx;
|
|
247
|
+
protected readonly element: Locator;
|
|
248
|
+
constructor(ctx: PluginTestCtx, element: Locator);
|
|
249
|
+
locator(selectorOrLocator?: LocatorParams[0], options?: LocatorParams[1]): Locator;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
type SelectOptionsType = Parameters<Locator['selectOption']>[1];
|
|
253
|
+
type CheckOptionsType = Parameters<Locator['check']>[0];
|
|
254
|
+
|
|
255
|
+
declare class ColorPicker extends ComponentBase {
|
|
256
|
+
constructor(ctx: PluginTestCtx, element: Locator);
|
|
257
|
+
selectOption(rgbOrHex: string, options?: SelectOptionsType): Promise<void>;
|
|
258
|
+
private getCustomTab;
|
|
259
|
+
private getContainer;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
declare class UnitPicker extends ComponentBase {
|
|
263
|
+
constructor(ctx: PluginTestCtx, element: Locator);
|
|
264
|
+
selectOption(value: string, options?: SelectOptionsType): Promise<void>;
|
|
265
|
+
private getOption;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
declare class Select extends ComponentBase {
|
|
269
|
+
constructor(ctx: PluginTestCtx, element: Locator);
|
|
270
|
+
selectOption(values: string, options?: SelectOptionsType): Promise<string>;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
declare class MultiSelect extends ComponentBase {
|
|
274
|
+
constructor(ctx: PluginTestCtx, element: Locator);
|
|
275
|
+
selectOptions(values: string[], options?: SelectOptionsType): Promise<string[]>;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
declare class Switch extends ComponentBase {
|
|
279
|
+
private group;
|
|
280
|
+
constructor(ctx: PluginTestCtx, group: Locator);
|
|
281
|
+
private static getElement;
|
|
282
|
+
check(options?: CheckOptionsType): Promise<void>;
|
|
283
|
+
uncheck(options?: CheckOptionsType): Promise<void>;
|
|
284
|
+
private getSwitch;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
declare class RadioGroup extends ComponentBase {
|
|
288
|
+
constructor(ctx: PluginTestCtx, element: Locator);
|
|
289
|
+
check(labelOrValue: string, options?: CheckOptionsType): Promise<void>;
|
|
290
|
+
}
|
|
291
|
+
|
|
312
292
|
declare class PanelEditOptionsGroup {
|
|
313
293
|
private ctx;
|
|
314
294
|
readonly element: Locator;
|
|
@@ -1464,6 +1444,74 @@ declare const isFeatureEnabled: (page: Page, featureToggle: string) => Promise<b
|
|
|
1464
1444
|
|
|
1465
1445
|
declare const DEFAULT_A11Y_TAGS: string[];
|
|
1466
1446
|
|
|
1447
|
+
/**
|
|
1448
|
+
* Returns true when version `a` is greater than or equal to version `b`.
|
|
1449
|
+
*
|
|
1450
|
+
* Follows semver precedence rules: a release has higher precedence than any
|
|
1451
|
+
* pre-release of the same `MAJOR.MINOR.PATCH` (`1.2.3` > `1.2.3-anything`).
|
|
1452
|
+
* Pre-release identifiers are compared dot-separated, numerics numerically
|
|
1453
|
+
* and non-numerics lexicographically (`1.2.3-2` < `1.2.3-10`).
|
|
1454
|
+
*
|
|
1455
|
+
* @param a - A semantic version string in the form `MAJOR.MINOR.PATCH[-PRE]`.
|
|
1456
|
+
* @param b - A semantic version string in the form `MAJOR.MINOR.PATCH[-PRE]`.
|
|
1457
|
+
*/
|
|
1458
|
+
declare const gte: (a: string, b: string) => boolean;
|
|
1459
|
+
/**
|
|
1460
|
+
* Returns true when version `a` is strictly less than version `b`.
|
|
1461
|
+
*
|
|
1462
|
+
* Follows semver precedence rules: a release has higher precedence than any
|
|
1463
|
+
* pre-release of the same `MAJOR.MINOR.PATCH` (`1.2.3-anything` < `1.2.3`).
|
|
1464
|
+
* Pre-release identifiers are compared dot-separated, numerics numerically
|
|
1465
|
+
* and non-numerics lexicographically.
|
|
1466
|
+
*
|
|
1467
|
+
* @param a - A semantic version string in the form `MAJOR.MINOR.PATCH[-PRE]`.
|
|
1468
|
+
* @param b - A semantic version string in the form `MAJOR.MINOR.PATCH[-PRE]`.
|
|
1469
|
+
*/
|
|
1470
|
+
declare const lt: (a: string, b: string) => boolean;
|
|
1471
|
+
/**
|
|
1472
|
+
* Returns true when version `a` is less than or equal to version `b`.
|
|
1473
|
+
*
|
|
1474
|
+
* Follows semver precedence rules. See {@link lt} for details.
|
|
1475
|
+
*
|
|
1476
|
+
* @param a - A semantic version string in the form `MAJOR.MINOR.PATCH[-PRE]`.
|
|
1477
|
+
* @param b - A semantic version string in the form `MAJOR.MINOR.PATCH[-PRE]`.
|
|
1478
|
+
*/
|
|
1479
|
+
declare const lte: (a: string, b: string) => boolean;
|
|
1480
|
+
/**
|
|
1481
|
+
* Returns true when version `a` is strictly greater than version `b`.
|
|
1482
|
+
*
|
|
1483
|
+
* Follows semver precedence rules. See {@link gte} for details.
|
|
1484
|
+
*
|
|
1485
|
+
* @param a - A semantic version string in the form `MAJOR.MINOR.PATCH[-PRE]`.
|
|
1486
|
+
* @param b - A semantic version string in the form `MAJOR.MINOR.PATCH[-PRE]`.
|
|
1487
|
+
*/
|
|
1488
|
+
declare const gt: (a: string, b: string) => boolean;
|
|
1489
|
+
/**
|
|
1490
|
+
* Returns true when version `a` is equal to version `b` per semver precedence.
|
|
1491
|
+
*
|
|
1492
|
+
* Build metadata (after `+`) is ignored. `1.2.3` and `1.2.3-pre` are not equal.
|
|
1493
|
+
*
|
|
1494
|
+
* @param a - A semantic version string in the form `MAJOR.MINOR.PATCH[-PRE]`.
|
|
1495
|
+
* @param b - A semantic version string in the form `MAJOR.MINOR.PATCH[-PRE]`.
|
|
1496
|
+
*/
|
|
1497
|
+
declare const eq: (a: string, b: string) => boolean;
|
|
1498
|
+
/**
|
|
1499
|
+
* Returns true when `version` satisfies the given range expression.
|
|
1500
|
+
*
|
|
1501
|
+
* Supports a small subset of semver range syntax suitable for Grafana version checks:
|
|
1502
|
+
* - Exact: `"1.2.3"` (equivalent to `=1.2.3`)
|
|
1503
|
+
* - Comparators: `">=1.2.3"`, `">1.2.3"`, `"<=1.2.3"`, `"<1.2.3"`, `"=1.2.3"`
|
|
1504
|
+
* - Conjunction (AND) via whitespace: `">=1.2.3 <2.0.0"`
|
|
1505
|
+
* - Disjunction (OR) via `||`: `">=1.2.3 <2.0.0 || >=3.0.0"`
|
|
1506
|
+
*
|
|
1507
|
+
* Caret (`^`) and tilde (`~`) prefixes and hyphen ranges are not supported.
|
|
1508
|
+
* Unrecognized comparator prefixes cause that comparator to evaluate to false.
|
|
1509
|
+
*
|
|
1510
|
+
* @param version - A semantic version string in the form `MAJOR.MINOR.PATCH[-PRE]`.
|
|
1511
|
+
* @param range - A range expression using the syntax described above.
|
|
1512
|
+
*/
|
|
1513
|
+
declare const satisfies: (version: string, range: string) => boolean;
|
|
1514
|
+
|
|
1467
1515
|
declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & InternalFixtures & PluginFixture, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & PluginOptions>;
|
|
1468
1516
|
declare const expect: _playwright_test.Expect<{
|
|
1469
1517
|
toHaveAlert: (grafanaPage: GrafanaPage, severity: AlertVariant, options?: AlertPageOptions) => Promise<{
|
|
@@ -1581,5 +1629,5 @@ declare global {
|
|
|
1581
1629
|
}
|
|
1582
1630
|
}
|
|
1583
1631
|
|
|
1584
|
-
export { AnnotationEditPage, AnnotationPage, AppConfigPage, AppPage,
|
|
1632
|
+
export { AnnotationEditPage, AnnotationPage, AppConfigPage, AppPage, Components, DEFAULT_A11Y_TAGS, DashboardPage, DataSourceConfigPage, DataSourcePicker, ExplorePage, GrafanaPage, Panel, PanelEditPage, PluginConfigPage, ScopedComponent, TimeRange, VariableEditPage, VariablePage, eq, expect, gt, gte, isFeatureEnabled, isLegacyFeatureEnabled, lt, lte, satisfies, test };
|
|
1585
1633
|
export type { A11yViolationsOptions, AlertPageOptions, AlertRule, AlertRuleArgs, AlertVariant$1 as AlertVariant, AppPageNavigateOptions, AxeScanContext, ContainTextOptions, CreateDataSourceArgs, CreateDataSourcePageArgs, Credentials, Dashboard, DashboardEditViewArgs, DashboardPageArgs, DataSourceSettings, E2ESelectorGroups, FeatureFlagValue, GotoAppConfigPageArgs, GotoAppPageArgs, GrafanaPageArgs, InternalFixtures, NavigateOptions, OrgRole, PlaywrightArgs, PluginFixture, PluginOptions, PluginPageArgs, PluginTestCtx, ReadProvisionedAlertRuleArgs, ReadProvisionedDashboardArgs, ReadProvisionedDataSourceArgs, RequestOptions, TimeRangeArgs, TriggerRequestOptions, User, UserPreferences, Visualization, getByGrafanaSelectorOptions };
|
package/dist/index.js
CHANGED
|
@@ -45,16 +45,10 @@ var toHaveChecked = require('./matchers/toHaveChecked.js');
|
|
|
45
45
|
var toHaveColor = require('./matchers/toHaveColor.js');
|
|
46
46
|
var toHavePanelErrors = require('./matchers/toHavePanelErrors.js');
|
|
47
47
|
var Components = require('./models/Components.js');
|
|
48
|
-
var ColorPicker = require('./models/components/ColorPicker.js');
|
|
49
48
|
var DataSourcePicker = require('./models/components/DataSourcePicker.js');
|
|
50
|
-
var MultiSelect = require('./models/components/MultiSelect.js');
|
|
51
|
-
var RadioGroup = require('./models/components/RadioGroup.js');
|
|
52
49
|
var ScopedComponent = require('./models/components/ScopedComponent.js');
|
|
53
|
-
var Select = require('./models/components/Select.js');
|
|
54
|
-
var Switch = require('./models/components/Switch.js');
|
|
55
50
|
var Panel = require('./models/components/Panel.js');
|
|
56
51
|
var TimeRange = require('./models/components/TimeRange.js');
|
|
57
|
-
var UnitPicker = require('./models/components/UnitPicker.js');
|
|
58
52
|
var AnnotationEditPage = require('./models/pages/AnnotationEditPage.js');
|
|
59
53
|
var AnnotationPage = require('./models/pages/AnnotationPage.js');
|
|
60
54
|
var DashboardPage = require('./models/pages/DashboardPage.js');
|
|
@@ -67,6 +61,7 @@ var VariablePage = require('./models/pages/VariablePage.js');
|
|
|
67
61
|
var AppConfigPage = require('./models/pages/AppConfigPage.js');
|
|
68
62
|
var PluginConfigPage = require('./models/pages/PluginConfigPage.js');
|
|
69
63
|
var AppPage = require('./models/pages/AppPage.js');
|
|
64
|
+
var version = require('./utils/version.js');
|
|
70
65
|
|
|
71
66
|
const testWithInternal = test$1.test.extend({
|
|
72
67
|
bootData: bootData.bootData
|
|
@@ -127,16 +122,10 @@ exports.isFeatureEnabled = isFeatureToggleEnabled.isFeatureEnabled;
|
|
|
127
122
|
exports.isLegacyFeatureEnabled = isFeatureToggleEnabled.isLegacyFeatureEnabled;
|
|
128
123
|
exports.DEFAULT_A11Y_TAGS = scanForA11yViolations.DEFAULT_A11Y_TAGS;
|
|
129
124
|
exports.Components = Components.Components;
|
|
130
|
-
exports.ColorPicker = ColorPicker.ColorPicker;
|
|
131
125
|
exports.DataSourcePicker = DataSourcePicker.DataSourcePicker;
|
|
132
|
-
exports.MultiSelect = MultiSelect.MultiSelect;
|
|
133
|
-
exports.RadioGroup = RadioGroup.RadioGroup;
|
|
134
126
|
exports.ScopedComponent = ScopedComponent.ScopedComponent;
|
|
135
|
-
exports.Select = Select.Select;
|
|
136
|
-
exports.Switch = Switch.Switch;
|
|
137
127
|
exports.Panel = Panel.Panel;
|
|
138
128
|
exports.TimeRange = TimeRange.TimeRange;
|
|
139
|
-
exports.UnitPicker = UnitPicker.UnitPicker;
|
|
140
129
|
exports.AnnotationEditPage = AnnotationEditPage.AnnotationEditPage;
|
|
141
130
|
exports.AnnotationPage = AnnotationPage.AnnotationPage;
|
|
142
131
|
exports.DashboardPage = DashboardPage.DashboardPage;
|
|
@@ -149,5 +138,11 @@ exports.VariablePage = VariablePage.VariablePage;
|
|
|
149
138
|
exports.AppConfigPage = AppConfigPage.AppConfigPage;
|
|
150
139
|
exports.PluginConfigPage = PluginConfigPage.PluginConfigPage;
|
|
151
140
|
exports.AppPage = AppPage.AppPage;
|
|
141
|
+
exports.eq = version.eq;
|
|
142
|
+
exports.gt = version.gt;
|
|
143
|
+
exports.gte = version.gte;
|
|
144
|
+
exports.lt = version.lt;
|
|
145
|
+
exports.lte = version.lte;
|
|
146
|
+
exports.satisfies = version.satisfies;
|
|
152
147
|
exports.expect = expect;
|
|
153
148
|
exports.test = test;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var ColorPicker = require('./components/ColorPicker.js');
|
|
4
3
|
var DataSourcePicker = require('./components/DataSourcePicker.js');
|
|
5
|
-
var MultiSelect = require('./components/MultiSelect.js');
|
|
6
|
-
var RadioGroup = require('./components/RadioGroup.js');
|
|
7
|
-
var Select = require('./components/Select.js');
|
|
8
|
-
var Switch = require('./components/Switch.js');
|
|
9
4
|
var TimeRange = require('./components/TimeRange.js');
|
|
10
|
-
var UnitPicker = require('./components/UnitPicker.js');
|
|
11
5
|
|
|
12
6
|
var __defProp = Object.defineProperty;
|
|
13
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -16,20 +10,8 @@ class Components {
|
|
|
16
10
|
constructor(ctx) {
|
|
17
11
|
__publicField(this, "dataSourcePicker");
|
|
18
12
|
__publicField(this, "timeRangePicker");
|
|
19
|
-
__publicField(this, "select");
|
|
20
|
-
__publicField(this, "multiSelect");
|
|
21
|
-
__publicField(this, "switch");
|
|
22
|
-
__publicField(this, "radioGroup");
|
|
23
|
-
__publicField(this, "unitPicker");
|
|
24
|
-
__publicField(this, "colorPicker");
|
|
25
13
|
this.dataSourcePicker = new DataSourcePicker.DataSourcePicker(ctx);
|
|
26
14
|
this.timeRangePicker = new TimeRange.TimeRange(ctx);
|
|
27
|
-
this.select = new Select.Select(ctx, Select.Select.getContainer(ctx));
|
|
28
|
-
this.multiSelect = new MultiSelect.MultiSelect(ctx, MultiSelect.MultiSelect.getContainer(ctx));
|
|
29
|
-
this.switch = new Switch.Switch(ctx, Switch.Switch.getContainer(ctx));
|
|
30
|
-
this.radioGroup = new RadioGroup.RadioGroup(ctx, RadioGroup.RadioGroup.getContainer(ctx));
|
|
31
|
-
this.unitPicker = new UnitPicker.UnitPicker(ctx, UnitPicker.UnitPicker.getContainer(ctx));
|
|
32
|
-
this.colorPicker = new ColorPicker.ColorPicker(ctx, ColorPicker.ColorPicker.getContainer(ctx));
|
|
33
15
|
}
|
|
34
16
|
}
|
|
35
17
|
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var ComponentBase = require('./ComponentBase.js');
|
|
4
|
-
var
|
|
4
|
+
var version = require('../../utils/version.js');
|
|
5
5
|
var utils = require('../utils.js');
|
|
6
6
|
|
|
7
7
|
class ColorPicker extends ComponentBase.ComponentBase {
|
|
8
8
|
constructor(ctx, element) {
|
|
9
9
|
super(ctx, element);
|
|
10
10
|
}
|
|
11
|
-
static getContainer(ctx, root) {
|
|
12
|
-
if (root) {
|
|
13
|
-
return root;
|
|
14
|
-
}
|
|
15
|
-
return ctx.page.locator('[data-testid*="colorswatch"]').locator("xpath=..").first();
|
|
16
|
-
}
|
|
17
|
-
within(root) {
|
|
18
|
-
return new ColorPicker(this.ctx, root);
|
|
19
|
-
}
|
|
20
11
|
async selectOption(rgbOrHex, options) {
|
|
21
12
|
await this.element.getByRole("button").click(options);
|
|
22
13
|
await this.getCustomTab().click(options);
|
|
@@ -25,17 +16,17 @@ class ColorPicker extends ComponentBase.ComponentBase {
|
|
|
25
16
|
await colorInput.fill(rgbOrHex, options);
|
|
26
17
|
}
|
|
27
18
|
getCustomTab() {
|
|
28
|
-
if (
|
|
19
|
+
if (version.gte(this.ctx.grafanaVersion, "11.6.0")) {
|
|
29
20
|
return this.getContainer().getByRole("tab", { name: "Custom", exact: true });
|
|
30
21
|
}
|
|
31
22
|
return this.getContainer().getByRole("button", { name: "Custom", exact: true });
|
|
32
23
|
}
|
|
33
24
|
getContainer() {
|
|
34
25
|
const { grafanaVersion, page, selectors } = this.ctx;
|
|
35
|
-
if (
|
|
26
|
+
if (version.gte(grafanaVersion, "11.5.0")) {
|
|
36
27
|
return page.locator(utils.resolveGrafanaSelector(selectors.components.Portal.container));
|
|
37
28
|
}
|
|
38
|
-
if (
|
|
29
|
+
if (version.gte(grafanaVersion, "8.7.0")) {
|
|
39
30
|
return page.locator("#grafana-portal-container");
|
|
40
31
|
}
|
|
41
32
|
return page.locator("body > div").last();
|
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var version = require('../../utils/version.js');
|
|
4
4
|
var test = require('@playwright/test');
|
|
5
5
|
var ScopedComponent = require('./ScopedComponent.js');
|
|
6
6
|
|
|
7
|
-
function _interopNamespaceDefault(e) {
|
|
8
|
-
var n = Object.create(null);
|
|
9
|
-
if (e) {
|
|
10
|
-
Object.keys(e).forEach(function (k) {
|
|
11
|
-
if (k !== 'default') {
|
|
12
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () { return e[k]; }
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
n.default = e;
|
|
21
|
-
return Object.freeze(n);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
var semver__namespace = /*#__PURE__*/_interopNamespaceDefault(semver);
|
|
25
|
-
|
|
26
7
|
class DataSourcePicker extends ScopedComponent.ScopedComponent {
|
|
27
8
|
/**
|
|
28
9
|
* Sets the data source picker to the provided name
|
|
@@ -31,7 +12,7 @@ class DataSourcePicker extends ScopedComponent.ScopedComponent {
|
|
|
31
12
|
let datasourcePicker = (this.root || this.ctx.page).getByTestId(
|
|
32
13
|
this.ctx.selectors.components.DataSourcePicker.inputV2
|
|
33
14
|
);
|
|
34
|
-
if (
|
|
15
|
+
if (version.lt(this.ctx.grafanaVersion, "10.1.0")) {
|
|
35
16
|
datasourcePicker = this.getByGrafanaSelector(this.ctx.selectors.components.DataSourcePicker.container, {
|
|
36
17
|
root: this.root
|
|
37
18
|
}).locator("input");
|
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var semver = require('semver');
|
|
4
3
|
var Select = require('./Select.js');
|
|
5
4
|
var ComponentBase = require('./ComponentBase.js');
|
|
6
|
-
var utils = require('../utils.js');
|
|
7
5
|
|
|
8
6
|
class MultiSelect extends ComponentBase.ComponentBase {
|
|
9
7
|
constructor(ctx, element) {
|
|
10
8
|
super(ctx, element);
|
|
11
9
|
}
|
|
12
|
-
static getContainer(ctx, root) {
|
|
13
|
-
const base = root ?? ctx.page;
|
|
14
|
-
if (semver.gte(ctx.grafanaVersion, "13.1.0")) {
|
|
15
|
-
return base.locator(utils.resolveGrafanaSelector(ctx.selectors.components.MultiSelect.container)).locator("xpath=..").first();
|
|
16
|
-
}
|
|
17
|
-
return base.locator('[class*="-grafana-select-value-container-multi"]').locator("xpath=..").first();
|
|
18
|
-
}
|
|
19
|
-
within(root) {
|
|
20
|
-
return new MultiSelect(this.ctx, MultiSelect.getContainer(this.ctx, root));
|
|
21
|
-
}
|
|
22
10
|
async selectOptions(values, options) {
|
|
23
11
|
const menu = await Select.openSelect(this, options);
|
|
24
12
|
const selected = [];
|
|
@@ -1,27 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var version = require('../../utils/version.js');
|
|
4
4
|
var GrafanaPage = require('../pages/GrafanaPage.js');
|
|
5
5
|
|
|
6
|
-
function _interopNamespaceDefault(e) {
|
|
7
|
-
var n = Object.create(null);
|
|
8
|
-
if (e) {
|
|
9
|
-
Object.keys(e).forEach(function (k) {
|
|
10
|
-
if (k !== 'default') {
|
|
11
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () { return e[k]; }
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
n.default = e;
|
|
20
|
-
return Object.freeze(n);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
var semver__namespace = /*#__PURE__*/_interopNamespaceDefault(semver);
|
|
24
|
-
|
|
25
6
|
const ERROR_STATUS = "error";
|
|
26
7
|
class Panel extends GrafanaPage.GrafanaPage {
|
|
27
8
|
constructor(ctx, locator) {
|
|
@@ -47,7 +28,7 @@ class Panel extends GrafanaPage.GrafanaPage {
|
|
|
47
28
|
*/
|
|
48
29
|
get data() {
|
|
49
30
|
const panel = this.locator;
|
|
50
|
-
if (
|
|
31
|
+
if (version.lt(this.ctx.grafanaVersion, "12.2.0")) {
|
|
51
32
|
return panel.locator('[role="cell"]');
|
|
52
33
|
}
|
|
53
34
|
return panel.locator('[role="gridcell"]');
|
|
@@ -66,7 +47,7 @@ class Panel extends GrafanaPage.GrafanaPage {
|
|
|
66
47
|
this.ctx.selectors.components.Panels.Panel.menuItems(options?.parentItem ?? "")
|
|
67
48
|
);
|
|
68
49
|
let menuItem = this.getByGrafanaSelector(this.ctx.selectors.components.Panels.Panel.menuItems(item));
|
|
69
|
-
if (
|
|
50
|
+
if (version.lt(this.ctx.grafanaVersion, "9.5.0")) {
|
|
70
51
|
panelMenu = this.locator.getByRole("heading");
|
|
71
52
|
parentMenuItem = this.ctx.page.getByText(options?.parentItem ?? "");
|
|
72
53
|
menuItem = this.ctx.page.getByRole("menu").getByText(item);
|
|
@@ -112,7 +93,7 @@ class Panel extends GrafanaPage.GrafanaPage {
|
|
|
112
93
|
*/
|
|
113
94
|
getErrorIcon() {
|
|
114
95
|
let selector = this.ctx.selectors.components.Panels.Panel.status(ERROR_STATUS);
|
|
115
|
-
if (
|
|
96
|
+
if (version.lt(this.ctx.grafanaVersion, "9.5.0")) {
|
|
116
97
|
selector = this.ctx.selectors.components.Panels.Panel.headerCornerInfo(ERROR_STATUS);
|
|
117
98
|
}
|
|
118
99
|
return this.getByGrafanaSelector(selector, {
|
|
@@ -5,7 +5,7 @@ var UnitPicker = require('./UnitPicker.js');
|
|
|
5
5
|
var Select = require('./Select.js');
|
|
6
6
|
var MultiSelect = require('./MultiSelect.js');
|
|
7
7
|
var Switch = require('./Switch.js');
|
|
8
|
-
var
|
|
8
|
+
var version = require('../../utils/version.js');
|
|
9
9
|
var RadioGroup = require('./RadioGroup.js');
|
|
10
10
|
var utils = require('../utils.js');
|
|
11
11
|
|
|
@@ -34,7 +34,7 @@ class PanelEditOptionsGroup {
|
|
|
34
34
|
await this.getOptionsGroupToggle().click();
|
|
35
35
|
}
|
|
36
36
|
getRadioGroup(label) {
|
|
37
|
-
if (
|
|
37
|
+
if (version.gte(this.ctx.grafanaVersion, "10.2.0")) {
|
|
38
38
|
return new RadioGroup.RadioGroup(this.ctx, this.getFieldLocator(label).getByRole("radiogroup"));
|
|
39
39
|
}
|
|
40
40
|
return new RadioGroup.RadioGroup(this.ctx, this.getFieldLocator(label));
|
|
@@ -49,7 +49,7 @@ class PanelEditOptionsGroup {
|
|
|
49
49
|
return this.getFieldLocator(label).getByRole("spinbutton");
|
|
50
50
|
}
|
|
51
51
|
getSliderInput(label) {
|
|
52
|
-
if (
|
|
52
|
+
if (version.gte(this.ctx.grafanaVersion, "9.1.0") && version.lt(this.ctx.grafanaVersion, "13.1.0-25389005429")) {
|
|
53
53
|
return this.getNumberInput(label);
|
|
54
54
|
}
|
|
55
55
|
return this.getTextInput(label);
|
|
@@ -74,7 +74,7 @@ class PanelEditOptionsGroup {
|
|
|
74
74
|
}
|
|
75
75
|
getOptionsGroupToggle() {
|
|
76
76
|
const selector = utils.resolveGrafanaSelector(this.ctx.selectors.components.OptionsGroup.toggle(this.groupLabel));
|
|
77
|
-
if (
|
|
77
|
+
if (version.gte(this.ctx.grafanaVersion, "10.0.0")) {
|
|
78
78
|
return this.element.locator(selector);
|
|
79
79
|
}
|
|
80
80
|
return this.element.locator(selector).getByRole("button");
|
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var ComponentBase = require('./ComponentBase.js');
|
|
4
|
-
var
|
|
5
|
-
var utils = require('../utils.js');
|
|
4
|
+
var version = require('../../utils/version.js');
|
|
6
5
|
|
|
7
6
|
class RadioGroup extends ComponentBase.ComponentBase {
|
|
8
7
|
constructor(ctx, element) {
|
|
9
8
|
super(ctx, element);
|
|
10
9
|
}
|
|
11
|
-
static getContainer(ctx, root) {
|
|
12
|
-
const base = root ?? ctx.page;
|
|
13
|
-
if (semver.gte(ctx.grafanaVersion, "13.1.0")) {
|
|
14
|
-
return base.locator(utils.resolveGrafanaSelector(ctx.selectors.components.RadioGroup.container)).first();
|
|
15
|
-
}
|
|
16
|
-
if (semver.gte(ctx.grafanaVersion, "10.0.0")) {
|
|
17
|
-
return base.locator('[role="radiogroup"]').first();
|
|
18
|
-
}
|
|
19
|
-
return base.locator('div:has(> input[type="radio"]), div:has(> div > input[type="radio"])').first();
|
|
20
|
-
}
|
|
21
|
-
within(root) {
|
|
22
|
-
return new RadioGroup(this.ctx, RadioGroup.getContainer(this.ctx, root));
|
|
23
|
-
}
|
|
24
10
|
async check(labelOrValue, options) {
|
|
25
|
-
if (
|
|
11
|
+
if (version.gte(this.ctx.grafanaVersion, "10.2.0")) {
|
|
26
12
|
return this.element.getByLabel(labelOrValue, { exact: true }).check(options);
|
|
27
13
|
}
|
|
28
14
|
return this.element.getByText(labelOrValue, { exact: true }).check(options);
|