@grafana/plugin-e2e 3.8.0 → 3.9.0-canary.2621.26390068377.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +69 -49
- package/dist/index.js +12 -0
- package/dist/models/Components.js +18 -0
- package/dist/models/components/ColorPicker.js +9 -0
- package/dist/models/components/MultiSelect.js +12 -0
- package/dist/models/components/RadioGroup.js +14 -0
- package/dist/models/components/Select.js +11 -0
- package/dist/models/components/Switch.js +14 -0
- package/dist/models/components/UnitPicker.js +12 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -171,6 +171,58 @@ 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
|
+
|
|
174
226
|
declare class TimeRange extends ScopedComponent {
|
|
175
227
|
/**
|
|
176
228
|
* Opens the time picker and sets the time range to the provided values
|
|
@@ -178,6 +230,14 @@ declare class TimeRange extends ScopedComponent {
|
|
|
178
230
|
set({ from, to, zone }: TimeRangeArgs): Promise<void>;
|
|
179
231
|
}
|
|
180
232
|
|
|
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
|
+
|
|
181
241
|
/**
|
|
182
242
|
* Factory for components that are not attached to a specific page.
|
|
183
243
|
*
|
|
@@ -191,11 +251,19 @@ declare class TimeRange extends ScopedComponent {
|
|
|
191
251
|
* ```typescript
|
|
192
252
|
* await components.dataSourcePicker.set('prom');
|
|
193
253
|
* await components.dataSourcePicker.within(panel).set('prom');
|
|
254
|
+
* await components.select.within(fieldLabel).selectOption('Europe/Stockholm');
|
|
255
|
+
* await components.switch.within(fieldLabel).check();
|
|
194
256
|
* ```
|
|
195
257
|
*/
|
|
196
258
|
declare class Components {
|
|
197
259
|
readonly dataSourcePicker: DataSourcePicker;
|
|
198
260
|
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;
|
|
199
267
|
constructor(ctx: PluginTestCtx);
|
|
200
268
|
}
|
|
201
269
|
|
|
@@ -241,54 +309,6 @@ declare class Panel extends GrafanaPage {
|
|
|
241
309
|
getErrorIcon(): Locator;
|
|
242
310
|
}
|
|
243
311
|
|
|
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
|
-
|
|
292
312
|
declare class PanelEditOptionsGroup {
|
|
293
313
|
private ctx;
|
|
294
314
|
readonly element: Locator;
|
|
@@ -1561,5 +1581,5 @@ declare global {
|
|
|
1561
1581
|
}
|
|
1562
1582
|
}
|
|
1563
1583
|
|
|
1564
|
-
export { AnnotationEditPage, AnnotationPage, AppConfigPage, AppPage, Components, DEFAULT_A11Y_TAGS, DashboardPage, DataSourceConfigPage, DataSourcePicker, ExplorePage, GrafanaPage, Panel, PanelEditPage, PluginConfigPage, ScopedComponent, TimeRange, VariableEditPage, VariablePage, expect, isFeatureEnabled, isLegacyFeatureEnabled, test };
|
|
1584
|
+
export { AnnotationEditPage, AnnotationPage, AppConfigPage, AppPage, ColorPicker, Components, DEFAULT_A11Y_TAGS, DashboardPage, DataSourceConfigPage, DataSourcePicker, ExplorePage, GrafanaPage, MultiSelect, Panel, PanelEditPage, PluginConfigPage, RadioGroup, ScopedComponent, Select, Switch, TimeRange, UnitPicker, VariableEditPage, VariablePage, expect, isFeatureEnabled, isLegacyFeatureEnabled, test };
|
|
1565
1585
|
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,10 +45,16 @@ 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');
|
|
48
49
|
var DataSourcePicker = require('./models/components/DataSourcePicker.js');
|
|
50
|
+
var MultiSelect = require('./models/components/MultiSelect.js');
|
|
51
|
+
var RadioGroup = require('./models/components/RadioGroup.js');
|
|
49
52
|
var ScopedComponent = require('./models/components/ScopedComponent.js');
|
|
53
|
+
var Select = require('./models/components/Select.js');
|
|
54
|
+
var Switch = require('./models/components/Switch.js');
|
|
50
55
|
var Panel = require('./models/components/Panel.js');
|
|
51
56
|
var TimeRange = require('./models/components/TimeRange.js');
|
|
57
|
+
var UnitPicker = require('./models/components/UnitPicker.js');
|
|
52
58
|
var AnnotationEditPage = require('./models/pages/AnnotationEditPage.js');
|
|
53
59
|
var AnnotationPage = require('./models/pages/AnnotationPage.js');
|
|
54
60
|
var DashboardPage = require('./models/pages/DashboardPage.js');
|
|
@@ -121,10 +127,16 @@ exports.isFeatureEnabled = isFeatureToggleEnabled.isFeatureEnabled;
|
|
|
121
127
|
exports.isLegacyFeatureEnabled = isFeatureToggleEnabled.isLegacyFeatureEnabled;
|
|
122
128
|
exports.DEFAULT_A11Y_TAGS = scanForA11yViolations.DEFAULT_A11Y_TAGS;
|
|
123
129
|
exports.Components = Components.Components;
|
|
130
|
+
exports.ColorPicker = ColorPicker.ColorPicker;
|
|
124
131
|
exports.DataSourcePicker = DataSourcePicker.DataSourcePicker;
|
|
132
|
+
exports.MultiSelect = MultiSelect.MultiSelect;
|
|
133
|
+
exports.RadioGroup = RadioGroup.RadioGroup;
|
|
125
134
|
exports.ScopedComponent = ScopedComponent.ScopedComponent;
|
|
135
|
+
exports.Select = Select.Select;
|
|
136
|
+
exports.Switch = Switch.Switch;
|
|
126
137
|
exports.Panel = Panel.Panel;
|
|
127
138
|
exports.TimeRange = TimeRange.TimeRange;
|
|
139
|
+
exports.UnitPicker = UnitPicker.UnitPicker;
|
|
128
140
|
exports.AnnotationEditPage = AnnotationEditPage.AnnotationEditPage;
|
|
129
141
|
exports.AnnotationPage = AnnotationPage.AnnotationPage;
|
|
130
142
|
exports.DashboardPage = DashboardPage.DashboardPage;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var ColorPicker = require('./components/ColorPicker.js');
|
|
3
4
|
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');
|
|
4
9
|
var TimeRange = require('./components/TimeRange.js');
|
|
10
|
+
var UnitPicker = require('./components/UnitPicker.js');
|
|
5
11
|
|
|
6
12
|
var __defProp = Object.defineProperty;
|
|
7
13
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -10,8 +16,20 @@ class Components {
|
|
|
10
16
|
constructor(ctx) {
|
|
11
17
|
__publicField(this, "dataSourcePicker");
|
|
12
18
|
__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");
|
|
13
25
|
this.dataSourcePicker = new DataSourcePicker.DataSourcePicker(ctx);
|
|
14
26
|
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));
|
|
15
33
|
}
|
|
16
34
|
}
|
|
17
35
|
|
|
@@ -8,6 +8,15 @@ 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
|
+
}
|
|
11
20
|
async selectOption(rgbOrHex, options) {
|
|
12
21
|
await this.element.getByRole("button").click(options);
|
|
13
22
|
await this.getCustomTab().click(options);
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var semver = require('semver');
|
|
3
4
|
var Select = require('./Select.js');
|
|
4
5
|
var ComponentBase = require('./ComponentBase.js');
|
|
6
|
+
var utils = require('../utils.js');
|
|
5
7
|
|
|
6
8
|
class MultiSelect extends ComponentBase.ComponentBase {
|
|
7
9
|
constructor(ctx, element) {
|
|
8
10
|
super(ctx, element);
|
|
9
11
|
}
|
|
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)).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
|
+
}
|
|
10
22
|
async selectOptions(values, options) {
|
|
11
23
|
const menu = await Select.openSelect(this, options);
|
|
12
24
|
const selected = [];
|
|
@@ -2,11 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
var ComponentBase = require('./ComponentBase.js');
|
|
4
4
|
var semver = require('semver');
|
|
5
|
+
var utils = require('../utils.js');
|
|
5
6
|
|
|
6
7
|
class RadioGroup extends ComponentBase.ComponentBase {
|
|
7
8
|
constructor(ctx, element) {
|
|
8
9
|
super(ctx, element);
|
|
9
10
|
}
|
|
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
|
+
}
|
|
10
24
|
async check(labelOrValue, options) {
|
|
11
25
|
if (semver.gte(this.ctx.grafanaVersion, "10.2.0")) {
|
|
12
26
|
return this.element.getByLabel(labelOrValue, { exact: true }).check(options);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var semver = require('semver');
|
|
3
4
|
var ComponentBase = require('./ComponentBase.js');
|
|
4
5
|
var utils = require('../utils.js');
|
|
5
6
|
|
|
@@ -7,6 +8,16 @@ class Select extends ComponentBase.ComponentBase {
|
|
|
7
8
|
constructor(ctx, element) {
|
|
8
9
|
super(ctx, element);
|
|
9
10
|
}
|
|
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.Select.container)).first();
|
|
15
|
+
}
|
|
16
|
+
return base.locator('[class*="-grafana-select-value-container"]:not([class*="-grafana-select-value-container-multi"])').locator("xpath=..").first();
|
|
17
|
+
}
|
|
18
|
+
within(root) {
|
|
19
|
+
return new Select(this.ctx, Select.getContainer(this.ctx, root));
|
|
20
|
+
}
|
|
10
21
|
async selectOption(values, options) {
|
|
11
22
|
const menu = await openSelect(this, options);
|
|
12
23
|
await this.locator().page().keyboard.type(values);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var ComponentBase = require('./ComponentBase.js');
|
|
4
4
|
var semver = require('semver');
|
|
5
|
+
var utils = require('../utils.js');
|
|
5
6
|
|
|
6
7
|
var __defProp = Object.defineProperty;
|
|
7
8
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -12,6 +13,19 @@ class Switch extends ComponentBase.ComponentBase {
|
|
|
12
13
|
__publicField(this, "group");
|
|
13
14
|
this.group = group;
|
|
14
15
|
}
|
|
16
|
+
static getContainer(ctx, root) {
|
|
17
|
+
const base = root ?? ctx.page;
|
|
18
|
+
if (semver.gte(ctx.grafanaVersion, "13.1.0")) {
|
|
19
|
+
return base.locator(utils.resolveGrafanaSelector(ctx.selectors.components.Switch.container)).first();
|
|
20
|
+
}
|
|
21
|
+
if (semver.gte(ctx.grafanaVersion, "12.0.0")) {
|
|
22
|
+
return base.locator('div:has(> input[type="checkbox"][role="switch"])').first();
|
|
23
|
+
}
|
|
24
|
+
return base.locator('div:has(> input[type="checkbox"] + label)').first();
|
|
25
|
+
}
|
|
26
|
+
within(root) {
|
|
27
|
+
return new Switch(this.ctx, Switch.getContainer(this.ctx, root));
|
|
28
|
+
}
|
|
15
29
|
static getElement(ctx, group) {
|
|
16
30
|
if (semver.gte(ctx.grafanaVersion, "11.5.0")) {
|
|
17
31
|
return group.getByRole("switch");
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var semver = require('semver');
|
|
3
4
|
var ComponentBase = require('./ComponentBase.js');
|
|
5
|
+
var utils = require('../utils.js');
|
|
4
6
|
|
|
5
7
|
class UnitPicker extends ComponentBase.ComponentBase {
|
|
6
8
|
constructor(ctx, element) {
|
|
7
9
|
super(ctx, element);
|
|
8
10
|
}
|
|
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.UnitPicker.container)).first();
|
|
15
|
+
}
|
|
16
|
+
return base.locator('div:has(> div > [data-testid="input-wrapper"] input[placeholder="Choose"])').first();
|
|
17
|
+
}
|
|
18
|
+
within(root) {
|
|
19
|
+
return new UnitPicker(this.ctx, UnitPicker.getContainer(this.ctx, root));
|
|
20
|
+
}
|
|
9
21
|
async selectOption(value, options) {
|
|
10
22
|
await this.element.getByRole("textbox").click();
|
|
11
23
|
const option = await this.getOption(value, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/plugin-e2e",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0-canary.2621.26390068377.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"dotenv": "^17.2.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@grafana/e2e-selectors": "13.1.0-
|
|
52
|
+
"@grafana/e2e-selectors": "13.1.0-25893932881",
|
|
53
53
|
"semver": "^7.5.4",
|
|
54
54
|
"uuid": "^13.0.0",
|
|
55
55
|
"yaml": "^2.3.4"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "976ddfae24fc2549d0e749a2c9f15683b4707ee0"
|
|
58
58
|
}
|