@grafana/plugin-e2e 1.7.2 → 1.8.0-canary.1111.faecd66.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.
@@ -31,7 +31,7 @@ class AlertRuleEditPage extends GrafanaPage_1.GrafanaPage {
31
31
  ctx;
32
32
  args;
33
33
  constructor(ctx, args) {
34
- super(ctx);
34
+ super(ctx, args);
35
35
  this.ctx = ctx;
36
36
  this.args = args;
37
37
  }
@@ -32,7 +32,7 @@ class AnnotationEditPage extends GrafanaPage_1.GrafanaPage {
32
32
  args;
33
33
  datasource;
34
34
  constructor(ctx, args) {
35
- super(ctx);
35
+ super(ctx, args);
36
36
  this.ctx = ctx;
37
37
  this.args = args;
38
38
  this.datasource = new DataSourcePicker_1.DataSourcePicker(ctx);
@@ -31,7 +31,7 @@ class AnnotationPage extends GrafanaPage_1.GrafanaPage {
31
31
  ctx;
32
32
  dashboard;
33
33
  constructor(ctx, dashboard) {
34
- super(ctx);
34
+ super(ctx, dashboard);
35
35
  this.ctx = ctx;
36
36
  this.dashboard = dashboard;
37
37
  }
@@ -30,7 +30,7 @@ class AppPage extends GrafanaPage_1.GrafanaPage {
30
30
  ctx;
31
31
  args;
32
32
  constructor(ctx, args) {
33
- super(ctx);
33
+ super(ctx, args);
34
34
  this.ctx = ctx;
35
35
  this.args = args;
36
36
  }
@@ -36,7 +36,7 @@ class DashboardPage extends GrafanaPage_1.GrafanaPage {
36
36
  dataSourcePicker;
37
37
  timeRange;
38
38
  constructor(ctx, dashboard) {
39
- super(ctx);
39
+ super(ctx, dashboard);
40
40
  this.ctx = ctx;
41
41
  this.dashboard = dashboard;
42
42
  this.dataSourcePicker = new DataSourcePicker_1.DataSourcePicker(ctx);
@@ -1,14 +1,15 @@
1
1
  import { Locator } from '@playwright/test';
2
- import { NavigateOptions, PluginTestCtx, RequestOptions } from '../../types';
2
+ import { GrafanaPageArgs, NavigateOptions, PluginTestCtx, RequestOptions } from '../../types';
3
3
  import { DataSourcePicker } from '../components/DataSourcePicker';
4
4
  import { GrafanaPage } from './GrafanaPage';
5
5
  import { Panel } from '../components/Panel';
6
6
  export declare class ExplorePage extends GrafanaPage {
7
+ readonly args?: GrafanaPageArgs | undefined;
7
8
  datasource: DataSourcePicker;
8
9
  timeRange: any;
9
10
  timeSeriesPanel: Panel;
10
11
  tablePanel: Panel;
11
- constructor(ctx: PluginTestCtx);
12
+ constructor(ctx: PluginTestCtx, args?: GrafanaPageArgs | undefined);
12
13
  private getPanelLocators;
13
14
  /**
14
15
  * Navigates to the explore page.
@@ -34,12 +34,14 @@ const TABLE_PANEL_SELECTOR_SUFFIX = 'Table';
34
34
  const TIME_SERIES_PANEL_TEXT = 'Graph Lines Bars Points';
35
35
  const TABLE_PANEL_TEXT = 'Table';
36
36
  class ExplorePage extends GrafanaPage_1.GrafanaPage {
37
+ args;
37
38
  datasource;
38
39
  timeRange;
39
40
  timeSeriesPanel;
40
41
  tablePanel;
41
- constructor(ctx) {
42
- super(ctx);
42
+ constructor(ctx, args) {
43
+ super(ctx, args);
44
+ this.args = args;
43
45
  this.datasource = new DataSourcePicker_1.DataSourcePicker(ctx);
44
46
  this.timeRange = new TimeRange_1.TimeRange(ctx);
45
47
  this.timeSeriesPanel = new Panel_1.Panel(this.ctx, this.getPanelLocators(TIME_SERIES_PANEL_SELECTOR_SUFFIX, TIME_SERIES_PANEL_TEXT));
@@ -1,5 +1,5 @@
1
1
  import { Locator, Request, Response } from '@playwright/test';
2
- import { getByGrafanaSelectorOptions, NavigateOptions, PluginTestCtx } from '../../types';
2
+ import { getByGrafanaSelectorOptions, GrafanaPageArgs, NavigateOptions, PluginTestCtx } from '../../types';
3
3
  /**
4
4
  * Base class for all Grafana pages.
5
5
  *
@@ -7,7 +7,8 @@ import { getByGrafanaSelectorOptions, NavigateOptions, PluginTestCtx } from '../
7
7
  */
8
8
  export declare abstract class GrafanaPage {
9
9
  readonly ctx: PluginTestCtx;
10
- constructor(ctx: PluginTestCtx);
10
+ readonly pageArgs: GrafanaPageArgs;
11
+ constructor(ctx: PluginTestCtx, pageArgs?: GrafanaPageArgs);
11
12
  protected navigate(url: string, options?: NavigateOptions): Promise<void>;
12
13
  /**
13
14
  * Get a locator based on a Grafana E2E selector. A grafana E2E selector is defined in @grafana/e2e-selectors or in plugin-e2e/src/e2e-selectors.
@@ -8,15 +8,19 @@ exports.GrafanaPage = void 0;
8
8
  */
9
9
  class GrafanaPage {
10
10
  ctx;
11
- constructor(ctx) {
11
+ pageArgs;
12
+ constructor(ctx, pageArgs = {}) {
12
13
  this.ctx = ctx;
14
+ this.pageArgs = pageArgs;
13
15
  }
14
16
  async navigate(url, options) {
15
- if (options?.queryParams) {
16
- url += `?${options.queryParams.toString()}`;
17
+ let queryParams = options?.queryParams ? options.queryParams : this.pageArgs.queryParams;
18
+ if (queryParams) {
19
+ url += `?${queryParams.toString()}`;
17
20
  }
18
21
  await this.ctx.page.goto(url, {
19
22
  waitUntil: 'networkidle',
23
+ ...this.pageArgs,
20
24
  ...options,
21
25
  });
22
26
  }
@@ -38,7 +38,7 @@ class PanelEditPage extends GrafanaPage_1.GrafanaPage {
38
38
  timeRange;
39
39
  panel;
40
40
  constructor(ctx, args) {
41
- super(ctx);
41
+ super(ctx, args);
42
42
  this.ctx = ctx;
43
43
  this.args = args;
44
44
  this.datasource = new DataSourcePicker_1.DataSourcePicker(ctx);
@@ -6,7 +6,7 @@ class PluginConfigPage extends GrafanaPage_1.GrafanaPage {
6
6
  ctx;
7
7
  args;
8
8
  constructor(ctx, args) {
9
- super(ctx);
9
+ super(ctx, args);
10
10
  this.ctx = ctx;
11
11
  this.args = args;
12
12
  }
@@ -32,7 +32,7 @@ class VariableEditPage extends GrafanaPage_1.GrafanaPage {
32
32
  args;
33
33
  datasource;
34
34
  constructor(ctx, args) {
35
- super(ctx);
35
+ super(ctx, args);
36
36
  this.ctx = ctx;
37
37
  this.args = args;
38
38
  this.datasource = new DataSourcePicker_1.DataSourcePicker(ctx);
@@ -7,7 +7,7 @@ class VariablePage extends GrafanaPage_1.GrafanaPage {
7
7
  ctx;
8
8
  dashboard;
9
9
  constructor(ctx, dashboard) {
10
- super(ctx);
10
+ super(ctx, dashboard);
11
11
  this.ctx = ctx;
12
12
  this.dashboard = dashboard;
13
13
  }
package/dist/types.d.ts CHANGED
@@ -386,7 +386,8 @@ export interface TimeRangeArgs {
386
386
  */
387
387
  zone?: string;
388
388
  }
389
- export type DashboardPageArgs = {
389
+ export type GrafanaPageArgs = NavigateOptions;
390
+ export type DashboardPageArgs = GrafanaPageArgs & {
390
391
  /**
391
392
  * The uid of the dashboard to go to
392
393
  */
@@ -407,11 +408,11 @@ export type DashboardPageArgs = {
407
408
  * If dashboard is not specified, it's assumed that it's a new dashboard. Otherwise, the dashboard uid is used to
408
409
  * navigate to an already existing dashboard.
409
410
  */
410
- export type DashboardEditViewArgs<T> = {
411
+ export type DashboardEditViewArgs<T> = GrafanaPageArgs & {
411
412
  dashboard?: DashboardPageArgs;
412
413
  id: T;
413
414
  };
414
- export type AlertRuleArgs = {
415
+ export type AlertRuleArgs = GrafanaPageArgs & {
415
416
  uid: string;
416
417
  };
417
418
  export type ReadProvisionedDashboardArgs = {
@@ -444,7 +445,7 @@ export type ReadProvisionedDataSourceArgs = {
444
445
  */
445
446
  name?: string;
446
447
  };
447
- export type PluginPageArgs = {
448
+ export type PluginPageArgs = GrafanaPageArgs & {
448
449
  pluginId: string;
449
450
  };
450
451
  export type GotoAppConfigPageArgs = PluginPageArgs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-e2e",
3
- "version": "1.7.2",
3
+ "version": "1.8.0-canary.1111.faecd66.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -55,5 +55,5 @@
55
55
  "start": "cls || clear"
56
56
  }
57
57
  },
58
- "gitHead": "64698d0d56bdafb4660ca3b0b0dc66d2b89fc680"
58
+ "gitHead": "faecd66fa1f3e3209108c979984f3595c4cfe577"
59
59
  }