@grafana/plugin-e2e 1.7.2 → 1.7.3-canary.1123.1a0c5f5.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.
@@ -1,6 +1,6 @@
1
1
  import { TestFixture } from '@playwright/test';
2
2
  import { PlaywrightArgs } from '../types';
3
- import { E2ESelectors } from '../e2e-selectors';
4
- type SelectorFixture = TestFixture<E2ESelectors, PlaywrightArgs>;
3
+ import { E2ESelectorGroup } from '@grafana/e2e-selectors';
4
+ type SelectorFixture = TestFixture<E2ESelectorGroup, PlaywrightArgs>;
5
5
  export declare const selectors: SelectorFixture;
6
6
  export {};
@@ -1,15 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.selectors = void 0;
4
- const e2e_selectors_1 = require("../e2e-selectors");
5
- const versioned_1 = require("../e2e-selectors/versioned");
6
- const apis_1 = require("../e2e-selectors/versioned/apis");
4
+ const e2e_selectors_1 = require("@grafana/e2e-selectors");
7
5
  const selectors = async ({ grafanaVersion }, use) => {
8
- const selectors = (0, e2e_selectors_1.resolveSelectors)({
9
- components: versioned_1.versionedComponents,
10
- pages: versioned_1.versionedPages,
11
- apis: apis_1.versionedAPIs,
12
- }, grafanaVersion);
6
+ const selectors = (0, e2e_selectors_1.resolveSelectors)(grafanaVersion);
13
7
  await use(selectors);
14
8
  };
15
9
  exports.selectors = selectors;
@@ -49,15 +49,9 @@ class AnnotationPage extends GrafanaPage_1.GrafanaPage {
49
49
  * Clicks the add new annotation button and returns the annotation edit page
50
50
  */
51
51
  async clickAddNew() {
52
- const { addAnnotationCTAV2, addAnnotationCTA } = this.ctx.selectors.pages.Dashboard.Settings.Annotations.List;
52
+ const { addAnnotationCTAV2 } = this.ctx.selectors.pages.Dashboard.Settings.Annotations.List;
53
53
  if (!this.dashboard?.uid) {
54
- //the dashboard doesn't have any annotations yet (except for the built-in one)
55
- if (semver.gte(this.ctx.grafanaVersion, '8.3.0')) {
56
- await this.getByGrafanaSelector(addAnnotationCTAV2).click();
57
- }
58
- else {
59
- await this.getByGrafanaSelector(addAnnotationCTA).click();
60
- }
54
+ await this.getByGrafanaSelector(addAnnotationCTAV2).click();
61
55
  }
62
56
  else {
63
57
  //the dashboard already has annotations
@@ -97,9 +97,10 @@ class DashboardPage extends GrafanaPage_1.GrafanaPage {
97
97
  * Clicks the buttons to add a new panel and returns the panel edit page for the new panel
98
98
  */
99
99
  async addPanel() {
100
- const { components, pages } = this.ctx.selectors;
100
+ const { pages, components } = this.ctx.selectors;
101
101
  if (semver.gte(this.ctx.grafanaVersion, '10.0.0')) {
102
- await this.getByGrafanaSelector(components.PageToolbar.itemButton(components.PageToolbar.itemButtonTitle)).click();
102
+ const itemButtonTitle = semver.gte(this.ctx.grafanaVersion, '10.1.0') ? 'Add button' : 'Add panel button';
103
+ await this.getByGrafanaSelector(components.PageToolbar.itemButton(itemButtonTitle)).click();
103
104
  await this.getByGrafanaSelector(pages.AddDashboard.itemButton(pages.AddDashboard.itemButtonAddViz)).click();
104
105
  }
105
106
  else {
@@ -86,7 +86,8 @@ class ExplorePage extends GrafanaPage_1.GrafanaPage {
86
86
  }
87
87
  catch (_) {
88
88
  // handle the case when the run button is hidden behind the "Show more items" button
89
- await this.getByGrafanaSelector(components.PageToolbar.item(components.PageToolbar.showMoreItems)).click();
89
+ const toolbarText = 'Show more items';
90
+ await this.getByGrafanaSelector(components.PageToolbar.item(toolbarText)).click();
90
91
  await this.getByGrafanaSelector(components.RefreshPicker.runButtonV2).last().click();
91
92
  }
92
93
  return responsePromise;
@@ -70,7 +70,7 @@ class PanelEditPage extends GrafanaPage_1.GrafanaPage {
70
70
  }
71
71
  async toggleTableView() {
72
72
  await (0, utils_1.radioButtonSetChecked)(this.ctx.page, 'Table view', true);
73
- let locator = this.getByGrafanaSelector(this.ctx.selectors.components.Panels.Panel.toggleTableViewPanel(''));
73
+ let locator = this.getByGrafanaSelector(this.ctx.selectors.components.Panels.Panel.title(''));
74
74
  if (semver.lt(this.ctx.grafanaVersion, '10.4.0')) {
75
75
  locator = this.ctx.page.getByRole('table');
76
76
  }
@@ -86,10 +86,11 @@ class PanelEditPage extends GrafanaPage_1.GrafanaPage {
86
86
  async setPanelTitle(titleText) {
87
87
  const TITLE = 'Title';
88
88
  const { OptionsGroup, PanelEditor } = this.ctx.selectors.components;
89
- await this.collapseSection(OptionsGroup.groupTitle);
89
+ const sectionGroupTitle = 'Panel options';
90
+ await this.collapseSection(sectionGroupTitle);
90
91
  const vizInput = semver.gte(this.ctx.grafanaVersion, '11.0.0')
91
92
  ? this.getByGrafanaSelector(PanelEditor.OptionsPane.fieldInput(TITLE))
92
- : this.getByGrafanaSelector(OptionsGroup.group(OptionsGroup.groupTitle)).locator('input').first();
93
+ : this.getByGrafanaSelector(OptionsGroup.group(sectionGroupTitle)).locator('input').first();
93
94
  await vizInput.fill(titleText);
94
95
  await this.ctx.page.keyboard.press('Tab');
95
96
  }
@@ -25,9 +25,9 @@ class VariablePage extends GrafanaPage_1.GrafanaPage {
25
25
  * Clicks the add new variable button and returns the variable edit page
26
26
  */
27
27
  async clickAddNew() {
28
- const { addVariableCTAV2, addVariableCTAV2Item, newButton } = this.ctx.selectors.pages.Dashboard.Settings.Variables.List;
28
+ const { addVariableCTAV2, newButton } = this.ctx.selectors.pages.Dashboard.Settings.Variables.List;
29
29
  if (!this.dashboard?.uid) {
30
- await this.getByGrafanaSelector(addVariableCTAV2(addVariableCTAV2Item)).click();
30
+ await this.getByGrafanaSelector(addVariableCTAV2).click();
31
31
  }
32
32
  else {
33
33
  await this.getByGrafanaSelector(newButton).click();
package/dist/types.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Locator, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Response, TestInfo } from '@playwright/test';
2
- import { E2ESelectors } from './e2e-selectors/types';
3
2
  import { AnnotationEditPage } from './models/pages/AnnotationEditPage';
4
3
  import { AppConfigPage } from './models/pages/AppConfigPage';
5
4
  import { AppPage } from './models/pages/AppPage';
@@ -11,6 +10,7 @@ import { VariableEditPage } from './models/pages/VariableEditPage';
11
10
  import { VariablePage } from './models/pages/VariablePage';
12
11
  import { AlertRuleEditPage } from './models/pages/AlertRuleEditPage';
13
12
  import { GrafanaAPIClient } from './models/GrafanaAPIClient';
13
+ import { E2ESelectorGroup } from '@grafana/e2e-selectors';
14
14
  export type PluginOptions = {
15
15
  /**
16
16
  * When using the readProvisioning fixture, files will be read from this directory. If no directory is provided,
@@ -73,7 +73,7 @@ export type PluginFixture = {
73
73
  * The E2E selectors to use for the current version of Grafana.
74
74
  * See https://grafana.com/developers/plugin-tools/e2e-test-a-plugin/selecting-elements#grafana-end-to-end-selectors for more information.
75
75
  */
76
- selectors: E2ESelectors;
76
+ selectors: E2ESelectorGroup;
77
77
  /**
78
78
  * Fixture command that creates a data source via the Grafana API.
79
79
  *
@@ -280,7 +280,7 @@ export type PluginFixture = {
280
280
  */
281
281
  export type PluginTestCtx = {
282
282
  grafanaVersion: string;
283
- selectors: E2ESelectors;
283
+ selectors: E2ESelectorGroup;
284
284
  testInfo: TestInfo;
285
285
  } & Pick<PlaywrightTestArgs, 'page' | 'request'>;
286
286
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-e2e",
3
- "version": "1.7.2",
3
+ "version": "1.7.3-canary.1123.1a0c5f5.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -42,6 +42,7 @@
42
42
  "dotenv": "^16.3.1"
43
43
  },
44
44
  "dependencies": {
45
+ "@grafana/e2e-selectors": "file:@grafana-e2e-selectors-11.3.0-pre.tgz",
45
46
  "semver": "^7.5.4",
46
47
  "uuid": "^10.0.0",
47
48
  "yaml": "^2.3.4"
@@ -55,5 +56,5 @@
55
56
  "start": "cls || clear"
56
57
  }
57
58
  },
58
- "gitHead": "64698d0d56bdafb4660ca3b0b0dc66d2b89fc680"
59
+ "gitHead": "1a0c5f533895916c5f72c2347ed32f62328ee0ea"
59
60
  }