@grafana/plugin-e2e 0.21.1 → 0.22.0-canary.821.518e194.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/api.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { E2ESelectors } from './e2e-selectors/types';
2
- import { CreateDataSourceArgs, CreateDataSourcePageArgs, DataSourceSettings, ReadProvisionedDashboardArgs, ReadProvisionedDataSourceArgs, CreateUserArgs, Dashboard, DashboardPageArgs, DashboardEditViewArgs, GotoAppConfigPageArgs } from './types';
3
- import { PanelEditPage, GrafanaPage, DataSourceConfigPage, DashboardPage, VariableEditPage, AnnotationEditPage, AppConfigPage } from './models';
2
+ import { CreateDataSourceArgs, CreateDataSourcePageArgs, DataSourceSettings, ReadProvisionedDashboardArgs, ReadProvisionedDataSourceArgs, CreateUserArgs, Dashboard, DashboardPageArgs, DashboardEditViewArgs, GotoAppConfigPageArgs, GotoAppPageArgs } from './types';
3
+ import { PanelEditPage, GrafanaPage, DataSourceConfigPage, DashboardPage, VariableEditPage, AnnotationEditPage, AppConfigPage, AppPage } from './models';
4
4
  import { ExplorePage } from './models/pages/ExplorePage';
5
5
  export type PluginOptions = {
6
6
  /**
@@ -221,6 +221,10 @@ export type PluginFixture = {
221
221
  * Fixture command that navigates to the AppConfigPage for a given plugin.
222
222
  */
223
223
  gotoAppConfigPage: (args: GotoAppConfigPageArgs) => Promise<AppConfigPage>;
224
+ /**
225
+ * Fixture command that navigates to an AppPage for a given plugin.
226
+ */
227
+ gotoAppPage: (args: GotoAppPageArgs) => Promise<AppPage>;
224
228
  };
225
229
  export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & PluginFixture, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions & PluginOptions>;
226
230
  export declare const expect: import("@playwright/test").Expect<{
@@ -0,0 +1,7 @@
1
+ import { TestFixture } from '@playwright/test';
2
+ import { PluginFixture, PluginOptions } from '../../api';
3
+ import { PlaywrightCombinedArgs } from '../types';
4
+ import { AppPage, GotoAppPageArgs } from '../..';
5
+ type GotoAppPageFixture = TestFixture<(args: GotoAppPageArgs) => Promise<AppPage>, PluginFixture & PluginOptions & PlaywrightCombinedArgs>;
6
+ export declare const gotoAppPage: GotoAppPageFixture;
7
+ export default gotoAppPage;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gotoAppPage = void 0;
4
+ const __1 = require("../..");
5
+ const gotoAppPage = async ({ page, selectors, grafanaVersion, request }, use, testInfo) => {
6
+ await use(async ({ pluginId, path }) => {
7
+ const appPage = new __1.AppPage({ page, selectors, grafanaVersion, request, testInfo }, { pluginId });
8
+ await appPage.goto({ path });
9
+ return appPage;
10
+ });
11
+ };
12
+ exports.gotoAppPage = gotoAppPage;
13
+ exports.default = exports.gotoAppPage;
@@ -19,6 +19,7 @@ declare const fixtures: {
19
19
  gotoVariableEditPage: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: (args: import("..").DashboardEditViewArgs<string>) => Promise<import("..").VariableEditPage>) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
20
20
  gotoAnnotationEditPage: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: (args: import("..").DashboardEditViewArgs<string>) => Promise<import("..").AnnotationEditPage>) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
21
21
  gotoDataSourceConfigPage: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: (uid: string) => Promise<import("..").DataSourceConfigPage>) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
22
- gotoAppConfigPage: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: (args: import("..").PluginConfigPageArgs) => Promise<import("..").AppConfigPage>) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
22
+ gotoAppConfigPage: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: (args: import("..").PluginPageArgs) => Promise<import("..").AppConfigPage>) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
23
+ gotoAppPage: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: (args: import("..").GotoAppPageArgs) => Promise<import("..").AppPage>) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
23
24
  };
24
25
  export default fixtures;
@@ -24,6 +24,7 @@ const gotoVariableEditPage_1 = __importDefault(require("./commands/gotoVariableE
24
24
  const gotoAnnotationEditPage_1 = __importDefault(require("./commands/gotoAnnotationEditPage"));
25
25
  const gotoDataSourceConfigPage_1 = __importDefault(require("./commands/gotoDataSourceConfigPage"));
26
26
  const gotoAppConfigPage_1 = __importDefault(require("./commands/gotoAppConfigPage"));
27
+ const gotoAppPage_1 = __importDefault(require("./commands/gotoAppPage"));
27
28
  const fixtures = {
28
29
  selectors: selectors_1.default,
29
30
  grafanaVersion: grafanaVersion_1.default,
@@ -46,5 +47,6 @@ const fixtures = {
46
47
  gotoAnnotationEditPage: gotoAnnotationEditPage_1.default,
47
48
  gotoDataSourceConfigPage: gotoDataSourceConfigPage_1.default,
48
49
  gotoAppConfigPage: gotoAppConfigPage_1.default,
50
+ gotoAppPage: gotoAppPage_1.default,
49
51
  };
50
52
  exports.default = fixtures;
@@ -12,3 +12,4 @@ export { Panel } from './components/Panel';
12
12
  export { TimeRange } from './components/TimeRange';
13
13
  export { AppConfigPage } from './pages/AppConfigPage';
14
14
  export { PluginConfigPage } from './pages/PluginConfigPage';
15
+ export { AppPage } from './pages/AppPage';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PluginConfigPage = exports.AppConfigPage = exports.TimeRange = exports.Panel = exports.DataSourcePicker = exports.VariablePage = exports.VariableEditPage = exports.PanelEditPage = exports.GrafanaPage = exports.ExplorePage = exports.DataSourceConfigPage = exports.DashboardPage = exports.AnnotationPage = exports.AnnotationEditPage = void 0;
3
+ exports.AppPage = exports.PluginConfigPage = exports.AppConfigPage = exports.TimeRange = exports.Panel = exports.DataSourcePicker = exports.VariablePage = exports.VariableEditPage = exports.PanelEditPage = exports.GrafanaPage = exports.ExplorePage = exports.DataSourceConfigPage = exports.DashboardPage = exports.AnnotationPage = exports.AnnotationEditPage = void 0;
4
4
  var AnnotationEditPage_1 = require("./pages/AnnotationEditPage");
5
5
  Object.defineProperty(exports, "AnnotationEditPage", { enumerable: true, get: function () { return AnnotationEditPage_1.AnnotationEditPage; } });
6
6
  var AnnotationPage_1 = require("./pages/AnnotationPage");
@@ -29,3 +29,5 @@ var AppConfigPage_1 = require("./pages/AppConfigPage");
29
29
  Object.defineProperty(exports, "AppConfigPage", { enumerable: true, get: function () { return AppConfigPage_1.AppConfigPage; } });
30
30
  var PluginConfigPage_1 = require("./pages/PluginConfigPage");
31
31
  Object.defineProperty(exports, "PluginConfigPage", { enumerable: true, get: function () { return PluginConfigPage_1.PluginConfigPage; } });
32
+ var AppPage_1 = require("./pages/AppPage");
33
+ Object.defineProperty(exports, "AppPage", { enumerable: true, get: function () { return AppPage_1.AppPage; } });
@@ -1,10 +1,10 @@
1
1
  import { Response as PlaywrightResponse } from '@playwright/test';
2
- import { PluginConfigPageArgs, PluginTestCtx } from '../../types';
2
+ import { PluginPageArgs, PluginTestCtx } from '../../types';
3
3
  import { PluginConfigPage } from './PluginConfigPage';
4
4
  export declare class AppConfigPage extends PluginConfigPage {
5
5
  readonly ctx: PluginTestCtx;
6
- readonly args: PluginConfigPageArgs;
7
- constructor(ctx: PluginTestCtx, args: PluginConfigPageArgs);
6
+ readonly args: PluginPageArgs;
7
+ constructor(ctx: PluginTestCtx, args: PluginPageArgs);
8
8
  /**
9
9
  * Will wait for the settings endpoint to be called e.g. when saving settings
10
10
  */
@@ -0,0 +1,12 @@
1
+ import { AppPageNavigateOptions, PluginPageArgs, PluginTestCtx } from '../../types';
2
+ import { GrafanaPage } from '..';
3
+ export declare class AppPage extends GrafanaPage {
4
+ readonly ctx: PluginTestCtx;
5
+ readonly args: PluginPageArgs;
6
+ constructor(ctx: PluginTestCtx, args: PluginPageArgs);
7
+ /**
8
+ * Will append the `/a/${pluginId}` before the provided path and then
9
+ * navigate to the page.
10
+ */
11
+ goto(options?: AppPageNavigateOptions): Promise<void>;
12
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.AppPage = void 0;
27
+ const nodePath = __importStar(require("path"));
28
+ const __1 = require("..");
29
+ class AppPage extends __1.GrafanaPage {
30
+ ctx;
31
+ args;
32
+ constructor(ctx, args) {
33
+ super(ctx);
34
+ this.ctx = ctx;
35
+ this.args = args;
36
+ }
37
+ /**
38
+ * Will append the `/a/${pluginId}` before the provided path and then
39
+ * navigate to the page.
40
+ */
41
+ goto(options) {
42
+ const path = options?.path ?? '';
43
+ const url = nodePath.join('/a/', this.args.pluginId, path);
44
+ return super.navigate(url, options);
45
+ }
46
+ }
47
+ exports.AppPage = AppPage;
@@ -1,9 +1,9 @@
1
- import { PluginConfigPageArgs, NavigateOptions, PluginTestCtx } from '../../types';
1
+ import { PluginPageArgs, NavigateOptions, PluginTestCtx } from '../../types';
2
2
  import { GrafanaPage } from './GrafanaPage';
3
3
  export declare class PluginConfigPage extends GrafanaPage {
4
4
  readonly ctx: PluginTestCtx;
5
- readonly args: PluginConfigPageArgs;
6
- constructor(ctx: PluginTestCtx, args: PluginConfigPageArgs);
5
+ readonly args: PluginPageArgs;
6
+ constructor(ctx: PluginTestCtx, args: PluginPageArgs);
7
7
  /**
8
8
  * Navigates to the app plugin config page.
9
9
  */
package/dist/types.d.ts CHANGED
@@ -173,6 +173,9 @@ export type NavigateOptions = {
173
173
  */
174
174
  queryParams?: URLSearchParams;
175
175
  };
176
+ export type AppPageNavigateOptions = NavigateOptions & {
177
+ path?: string;
178
+ };
176
179
  export type GetByTestIdOrAriaLabelOptions = {
177
180
  /**
178
181
  *Optional root locator to search within. If no locator is provided, the page will be used
@@ -246,7 +249,10 @@ export interface ContainTextOptions {
246
249
  */
247
250
  useInnerText?: boolean;
248
251
  }
249
- export type PluginConfigPageArgs = {
252
+ export type PluginPageArgs = {
250
253
  pluginId: string;
251
254
  };
252
- export type GotoAppConfigPageArgs = PluginConfigPageArgs;
255
+ export type GotoAppConfigPageArgs = PluginPageArgs;
256
+ export type GotoAppPageArgs = PluginPageArgs & {
257
+ path?: string;
258
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-e2e",
3
- "version": "0.21.1",
3
+ "version": "0.22.0-canary.821.518e194.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": "b8e8992b5515564b3c6aabd98696d1b32f9d7baa"
58
+ "gitHead": "518e1941e100a497366c4e969792e84c7efcc99d"
59
59
  }