@grafana/plugin-e2e 1.0.1 → 1.1.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.
@@ -43,6 +43,9 @@ export type Components = {
43
43
  headerCornerInfo: (mode: string) => string;
44
44
  status: (status: string) => string;
45
45
  toggleTableViewPanel: (title: string) => string;
46
+ PanelDataErrorMessage: string;
47
+ menuItems: (item: string) => string;
48
+ menu: (title: string) => string;
46
49
  };
47
50
  Visualization: {
48
51
  Table: {
@@ -55,6 +58,11 @@ export type Components = {
55
58
  VizLegend: {
56
59
  seriesName: (name: string) => string;
57
60
  };
61
+ Drawer: {
62
+ General: {
63
+ title: (title: string) => string;
64
+ };
65
+ };
58
66
  PanelEditor: {
59
67
  General: {
60
68
  content: string;
@@ -58,6 +58,15 @@ export declare const versionedComponents: {
58
58
  '10.4.0': (title: string) => string;
59
59
  "8.0.0": (_: string) => string;
60
60
  };
61
+ PanelDataErrorMessage: {
62
+ '10.4.0': string;
63
+ };
64
+ menuItems: {
65
+ '9.5.0': (item: string) => string;
66
+ };
67
+ menu: {
68
+ '9.5.0': (item: string) => string;
69
+ };
61
70
  };
62
71
  Visualization: {
63
72
  Table: {
@@ -78,6 +87,13 @@ export declare const versionedComponents: {
78
87
  "8.0.0": (name: string) => string;
79
88
  };
80
89
  };
90
+ Drawer: {
91
+ General: {
92
+ title: {
93
+ "8.0.0": (title: string) => string;
94
+ };
95
+ };
96
+ };
81
97
  PanelEditor: {
82
98
  General: {
83
99
  content: {
@@ -60,6 +60,11 @@ exports.versionedComponents = {
60
60
  '10.4.0': (title) => `data-testid Panel header ${title}`,
61
61
  [constants_1.MIN_GRAFANA_VERSION]: (_) => 'data-testid Panel',
62
62
  },
63
+ PanelDataErrorMessage: {
64
+ '10.4.0': 'data-testid Panel data error message',
65
+ },
66
+ menuItems: { '9.5.0': (item) => `data-testid Panel menu item ${item}` },
67
+ menu: { '9.5.0': (item) => `data-testid Panel menu ${item}` },
63
68
  },
64
69
  Visualization: {
65
70
  Table: {
@@ -81,6 +86,13 @@ exports.versionedComponents = {
81
86
  [constants_1.MIN_GRAFANA_VERSION]: (name) => `VizLegend series ${name}`,
82
87
  },
83
88
  },
89
+ Drawer: {
90
+ General: {
91
+ title: {
92
+ [constants_1.MIN_GRAFANA_VERSION]: (title) => `Drawer title ${title}`,
93
+ },
94
+ },
95
+ },
84
96
  PanelEditor: {
85
97
  General: {
86
98
  content: {
@@ -19,6 +19,14 @@ export declare class Panel extends GrafanaPage {
19
19
  * await expect(panelEditPage.panel.data).toContainText(['1', '4', '14']);
20
20
  */
21
21
  get data(): Locator;
22
+ /**
23
+ * Click on a menu item in the panel menu.
24
+ *
25
+ * Pass options.parentItem to specify the parent item of the menu item to click.
26
+ */
27
+ clickOnMenuItem(item: string, options?: {
28
+ parentItem?: string;
29
+ }): Promise<void>;
22
30
  /**
23
31
  * Returns the locator for the panel error (if any)
24
32
  */
@@ -55,6 +55,28 @@ class Panel extends GrafanaPage_1.GrafanaPage {
55
55
  const panel = this.locator;
56
56
  return panel.locator('[role="cell"]');
57
57
  }
58
+ /**
59
+ * Click on a menu item in the panel menu.
60
+ *
61
+ * Pass options.parentItem to specify the parent item of the menu item to click.
62
+ */
63
+ async clickOnMenuItem(item, options) {
64
+ let panelMenu = this.getByGrafanaSelector(this.ctx.selectors.components.Panels.Panel.menu(''), {
65
+ startsWith: true,
66
+ root: this.locator,
67
+ });
68
+ let parentMenuItem = this.getByGrafanaSelector(this.ctx.selectors.components.Panels.Panel.menuItems(options?.parentItem ?? ''));
69
+ let menuItem = this.getByGrafanaSelector(this.ctx.selectors.components.Panels.Panel.menuItems(item));
70
+ // before 9.5.0, there were no proper selectors for the panel menu items
71
+ if (semver.lt(this.ctx.grafanaVersion, '9.5.0')) {
72
+ panelMenu = this.locator.getByRole('heading');
73
+ this.ctx.page.locator(`[aria-label="Panel header item ${options?.parentItem}"]`);
74
+ this.ctx.page.locator(`[aria-label="Panel header item ${item}"]`);
75
+ }
76
+ await panelMenu.click({ force: true });
77
+ options?.parentItem && parentMenuItem.hover();
78
+ await menuItem.click();
79
+ }
58
80
  /**
59
81
  * Returns the locator for the panel error (if any)
60
82
  */
@@ -75,9 +75,7 @@ class DashboardPage extends GrafanaPage_1.GrafanaPage {
75
75
  * await expect(panel.fieldNames).toContainText(['time', 'temperature']);
76
76
  */
77
77
  getPanelByTitle(title) {
78
- let locator = this.getByGrafanaSelector(this.ctx.selectors.components.Panels.Panel.title(title), {
79
- startsWith: true,
80
- });
78
+ let locator = this.getByGrafanaSelector(this.ctx.selectors.components.Panels.Panel.title(title));
81
79
  // in older versions, the panel selector is added to a child element, so we need to go up two levels to get the wrapper
82
80
  if (semver.lt(this.ctx.grafanaVersion, '9.5.0')) {
83
81
  locator = locator.locator('..').locator('..');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-e2e",
3
- "version": "1.0.1",
3
+ "version": "1.1.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": "9fe91cbe31f7854eeca81196029a819dbe9f8a4f"
58
+ "gitHead": "42bd4ac7f22f753cf6920a72cfadbf12c4b81660"
59
59
  }