@grafana/plugin-e2e 0.20.0 → 0.21.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.
Files changed (33) hide show
  1. package/dist/api.d.ts +28 -9
  2. package/dist/e2e-selectors/types.d.ts +6 -0
  3. package/dist/e2e-selectors/versioned/apis.d.ts +5 -0
  4. package/dist/e2e-selectors/versioned/apis.js +5 -0
  5. package/dist/e2e-selectors/versioned/pages.d.ts +5 -0
  6. package/dist/e2e-selectors/versioned/pages.js +5 -0
  7. package/dist/fixtures/commands/gotoAnnotationEditPage.d.ts +8 -0
  8. package/dist/fixtures/commands/gotoAnnotationEditPage.js +11 -0
  9. package/dist/fixtures/commands/gotoAppConfigPage.d.ts +8 -0
  10. package/dist/fixtures/commands/gotoAppConfigPage.js +13 -0
  11. package/dist/fixtures/commands/gotoDashboardPage.d.ts +8 -0
  12. package/dist/fixtures/commands/gotoDashboardPage.js +11 -0
  13. package/dist/fixtures/commands/gotoDataSourceConfigPage.d.ts +7 -0
  14. package/dist/fixtures/commands/gotoDataSourceConfigPage.js +21 -0
  15. package/dist/fixtures/commands/gotoPanelEditPage.d.ts +8 -0
  16. package/dist/fixtures/commands/gotoPanelEditPage.js +11 -0
  17. package/dist/fixtures/commands/gotoVariableEditPage.d.ts +8 -0
  18. package/dist/fixtures/commands/gotoVariableEditPage.js +11 -0
  19. package/dist/fixtures/dashboardPage.d.ts +7 -0
  20. package/dist/fixtures/dashboardPage.js +9 -0
  21. package/dist/fixtures/index.d.ts +7 -1
  22. package/dist/fixtures/index.js +14 -2
  23. package/dist/fixtures/panelEditPage.js +2 -2
  24. package/dist/models/index.d.ts +2 -0
  25. package/dist/models/index.js +5 -1
  26. package/dist/models/pages/AppConfigPage.d.ts +14 -0
  27. package/dist/models/pages/AppConfigPage.js +21 -0
  28. package/dist/models/pages/PluginConfigPage.d.ts +11 -0
  29. package/dist/models/pages/PluginConfigPage.js +21 -0
  30. package/dist/types.d.ts +4 -0
  31. package/package.json +2 -2
  32. package/dist/fixtures/newDashboardPage.d.ts +0 -7
  33. package/dist/fixtures/newDashboardPage.js +0 -9
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 } from './types';
3
- import { PanelEditPage, GrafanaPage, DataSourceConfigPage, DashboardPage, VariableEditPage, AnnotationEditPage } from './models';
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';
4
4
  import { ExplorePage } from './models/pages/ExplorePage';
5
5
  export type PluginOptions = {
6
6
  /**
@@ -62,14 +62,9 @@ export type PluginFixture = {
62
62
  /**
63
63
  * Isolated {@link DashboardPage} instance for each test.
64
64
  *
65
- * Navigates to a new dashboard page and adds a new panel.
66
- *
67
- * Use {@link PanelEditPage.setVisualization} to change the visualization
68
- * Use {@link PanelEditPage.datasource.set} to change the datasource
69
- * Use {@link PanelEditPage.getQueryEditorEditorRow} to retrieve the query
70
- * editor row locator for a given query refId
65
+ * Navigates to a new to a new dashboard page.
71
66
  */
72
- newDashboardPage: DashboardPage;
67
+ dashboardPage: DashboardPage;
73
68
  /**
74
69
  * Isolated {@link PanelEditPage} instance for each test.
75
70
  *
@@ -202,6 +197,30 @@ export type PluginFixture = {
202
197
  * Function that checks if a feature toggle is enabled. Only works for frontend feature toggles.
203
198
  */
204
199
  isFeatureToggleEnabled<T = object>(featureToggle: keyof T): Promise<boolean>;
200
+ /**
201
+ * Fixture command that navigates to an already exist dashboard. Returns a DashboardPage instance.
202
+ */
203
+ gotoDashboardPage: (args: DashboardPageArgs) => Promise<DashboardPage>;
204
+ /**
205
+ * Fixture command that navigates a panel edit page for an already existing panel in a dashboard.
206
+ */
207
+ gotoPanelEditPage: (args: DashboardEditViewArgs<string>) => Promise<PanelEditPage>;
208
+ /**
209
+ * Fixture command that navigates a variable edit page for an already existing variable query in a dashboard.
210
+ */
211
+ gotoVariableEditPage: (args: DashboardEditViewArgs<string>) => Promise<VariableEditPage>;
212
+ /**
213
+ * Fixture command that navigates an annotation edit page for an already existing annotation query in a dashboard.
214
+ */
215
+ gotoAnnotationEditPage: (args: DashboardEditViewArgs<string>) => Promise<AnnotationEditPage>;
216
+ /**
217
+ * Fixture command that navigates a configuration page for an already existing data source instance.
218
+ */
219
+ gotoDataSourceConfigPage: (uid: string) => Promise<DataSourceConfigPage>;
220
+ /**
221
+ * Fixture command that navigates to the AppConfigPage for a given plugin.
222
+ */
223
+ gotoAppConfigPage: (args: GotoAppConfigPageArgs) => Promise<AppConfigPage>;
205
224
  };
206
225
  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>;
207
226
  export declare const expect: import("@playwright/test").Expect<{
@@ -16,6 +16,9 @@ export type APIs = {
16
16
  Dashboard: {
17
17
  delete: (uid: string) => string;
18
18
  };
19
+ Plugin: {
20
+ settings: (pluginId: string) => string;
21
+ };
19
22
  };
20
23
  export type Components = {
21
24
  TimePicker: {
@@ -179,4 +182,7 @@ export type Pages = {
179
182
  Explore: {
180
183
  url: string;
181
184
  };
185
+ Plugin: {
186
+ url: (pluginId: string) => string;
187
+ };
182
188
  };
@@ -29,4 +29,9 @@ export declare const versionedAPIs: {
29
29
  "8.0.0": (uid: string) => string;
30
30
  };
31
31
  };
32
+ Plugin: {
33
+ settings: {
34
+ "8.0.0": (pluginId: string) => string;
35
+ };
36
+ };
32
37
  };
@@ -33,4 +33,9 @@ exports.versionedAPIs = {
33
33
  [constants_1.MIN_GRAFANA_VERSION]: (uid) => `/api/datasources/uid/${uid}`,
34
34
  },
35
35
  },
36
+ Plugin: {
37
+ settings: {
38
+ [constants_1.MIN_GRAFANA_VERSION]: (pluginId) => `/api/plugins/${pluginId}/settings`,
39
+ },
40
+ },
36
41
  };
@@ -122,4 +122,9 @@ export declare const versionedPages: {
122
122
  "8.0.0": string;
123
123
  };
124
124
  };
125
+ Plugin: {
126
+ url: {
127
+ "8.0.0": (pluginId: string) => string;
128
+ };
129
+ };
125
130
  };
@@ -128,4 +128,9 @@ exports.versionedPages = {
128
128
  [constants_1.MIN_GRAFANA_VERSION]: '/explore',
129
129
  },
130
130
  },
131
+ Plugin: {
132
+ url: {
133
+ [constants_1.MIN_GRAFANA_VERSION]: (pluginId) => `/plugins/${pluginId}`,
134
+ },
135
+ },
131
136
  };
@@ -0,0 +1,8 @@
1
+ import { TestFixture } from '@playwright/test';
2
+ import { PluginFixture, PluginOptions } from '../../api';
3
+ import { DashboardEditViewArgs } from '../../types';
4
+ import { PlaywrightCombinedArgs } from '../types';
5
+ import { AnnotationEditPage } from '../../models';
6
+ type GotoAnnotationEditPageFixture = TestFixture<(args: DashboardEditViewArgs<string>) => Promise<AnnotationEditPage>, PluginFixture & PluginOptions & PlaywrightCombinedArgs>;
7
+ declare const gotoAnnotationEditPage: GotoAnnotationEditPageFixture;
8
+ export default gotoAnnotationEditPage;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const models_1 = require("../../models");
4
+ const gotoAnnotationEditPage = async ({ request, page, selectors, grafanaVersion }, use, testInfo) => {
5
+ await use(async (args) => {
6
+ const annotationEditPage = new models_1.AnnotationEditPage({ page, selectors, grafanaVersion, request, testInfo }, args);
7
+ await annotationEditPage.goto();
8
+ return annotationEditPage;
9
+ });
10
+ };
11
+ exports.default = gotoAnnotationEditPage;
@@ -0,0 +1,8 @@
1
+ import { TestFixture } from '@playwright/test';
2
+ import { PluginFixture, PluginOptions } from '../../api';
3
+ import { GotoAppConfigPageArgs } from '../../types';
4
+ import { PlaywrightCombinedArgs } from '../types';
5
+ import { AppConfigPage } from '../../models/pages/AppConfigPage';
6
+ type GotoAppConfigPageFixture = TestFixture<(args: GotoAppConfigPageArgs) => Promise<AppConfigPage>, PluginFixture & PluginOptions & PlaywrightCombinedArgs>;
7
+ export declare const gotoAppConfigPage: GotoAppConfigPageFixture;
8
+ export default gotoAppConfigPage;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gotoAppConfigPage = void 0;
4
+ const AppConfigPage_1 = require("../../models/pages/AppConfigPage");
5
+ const gotoAppConfigPage = async ({ page, selectors, grafanaVersion, request }, use, testInfo) => {
6
+ await use(async (args) => {
7
+ const appConfigPage = new AppConfigPage_1.AppConfigPage({ page, selectors, grafanaVersion, request, testInfo }, args);
8
+ await appConfigPage.goto();
9
+ return appConfigPage;
10
+ });
11
+ };
12
+ exports.gotoAppConfigPage = gotoAppConfigPage;
13
+ exports.default = exports.gotoAppConfigPage;
@@ -0,0 +1,8 @@
1
+ import { TestFixture } from '@playwright/test';
2
+ import { PluginFixture, PluginOptions } from '../../api';
3
+ import { DashboardPageArgs } from '../../types';
4
+ import { PlaywrightCombinedArgs } from '../types';
5
+ import { DashboardPage } from '../../models';
6
+ type GotoDashboardFixture = TestFixture<(args: DashboardPageArgs) => Promise<DashboardPage>, PluginFixture & PluginOptions & PlaywrightCombinedArgs>;
7
+ declare const gotoDashboardPage: GotoDashboardFixture;
8
+ export default gotoDashboardPage;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const models_1 = require("../../models");
4
+ const gotoDashboardPage = async ({ request, page, selectors, grafanaVersion }, use, testInfo) => {
5
+ await use(async (args) => {
6
+ const dashboardPage = new models_1.DashboardPage({ page, selectors, grafanaVersion, request, testInfo }, args);
7
+ await dashboardPage.goto();
8
+ return dashboardPage;
9
+ });
10
+ };
11
+ exports.default = gotoDashboardPage;
@@ -0,0 +1,7 @@
1
+ import { TestFixture } from '@playwright/test';
2
+ import { PluginFixture, PluginOptions } from '../../api';
3
+ import { PlaywrightCombinedArgs } from '../types';
4
+ import { DataSourceConfigPage } from '../../models';
5
+ type GotoDataSourceConfigPageFixture = TestFixture<(uid: string) => Promise<DataSourceConfigPage>, PluginFixture & PluginOptions & PlaywrightCombinedArgs>;
6
+ declare const gotoDataSourceConfigPage: GotoDataSourceConfigPageFixture;
7
+ export default gotoDataSourceConfigPage;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const models_1 = require("../../models");
4
+ const gotoDataSourceConfigPage = async ({ request, page, selectors, grafanaVersion }, use, testInfo) => {
5
+ await use(async (uid) => {
6
+ const response = await request.get(`/api/datasources/uid/${uid}`, {
7
+ headers: {
8
+ // here we call backend as admin user and not on behalf of the logged in user as it might not have required permissions
9
+ Authorization: `Basic ${Buffer.from(`admin:admin`).toString('base64')}`,
10
+ },
11
+ });
12
+ if (!response.ok()) {
13
+ throw new Error(`Failed to get datasource by uid: ${response.statusText()}. If you're using a provisioned data source, make sure it has a UID`);
14
+ }
15
+ const settings = await response.json();
16
+ const dataSourceConfigPage = new models_1.DataSourceConfigPage({ page, selectors, grafanaVersion, request, testInfo }, settings);
17
+ await dataSourceConfigPage.goto();
18
+ return dataSourceConfigPage;
19
+ });
20
+ };
21
+ exports.default = gotoDataSourceConfigPage;
@@ -0,0 +1,8 @@
1
+ import { TestFixture } from '@playwright/test';
2
+ import { PluginFixture, PluginOptions } from '../../api';
3
+ import { DashboardEditViewArgs } from '../../types';
4
+ import { PlaywrightCombinedArgs } from '../types';
5
+ import { PanelEditPage } from '../../models';
6
+ type GotoPanelEditPageFixture = TestFixture<(args: DashboardEditViewArgs<string>) => Promise<PanelEditPage>, PluginFixture & PluginOptions & PlaywrightCombinedArgs>;
7
+ declare const gotoPanelEditPage: GotoPanelEditPageFixture;
8
+ export default gotoPanelEditPage;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const models_1 = require("../../models");
4
+ const gotoPanelEditPage = async ({ request, page, selectors, grafanaVersion }, use, testInfo) => {
5
+ await use(async (args) => {
6
+ const panelEditPage = new models_1.PanelEditPage({ page, selectors, grafanaVersion, request, testInfo }, args);
7
+ await panelEditPage.goto();
8
+ return panelEditPage;
9
+ });
10
+ };
11
+ exports.default = gotoPanelEditPage;
@@ -0,0 +1,8 @@
1
+ import { TestFixture } from '@playwright/test';
2
+ import { PluginFixture, PluginOptions } from '../../api';
3
+ import { DashboardEditViewArgs } from '../../types';
4
+ import { PlaywrightCombinedArgs } from '../types';
5
+ import { VariableEditPage } from '../../models';
6
+ type GotoVariableEditPageFixture = TestFixture<(args: DashboardEditViewArgs<string>) => Promise<VariableEditPage>, PluginFixture & PluginOptions & PlaywrightCombinedArgs>;
7
+ declare const gotoVariableEditPage: GotoVariableEditPageFixture;
8
+ export default gotoVariableEditPage;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const models_1 = require("../../models");
4
+ const gotoVariableEditPage = async ({ request, page, selectors, grafanaVersion }, use, testInfo) => {
5
+ await use(async (args) => {
6
+ const variableEditPage = new models_1.VariableEditPage({ page, selectors, grafanaVersion, request, testInfo }, args);
7
+ await variableEditPage.goto();
8
+ return variableEditPage;
9
+ });
10
+ };
11
+ exports.default = gotoVariableEditPage;
@@ -0,0 +1,7 @@
1
+ import { TestFixture } from '@playwright/test';
2
+ import { PluginFixture, PluginOptions } from '../api';
3
+ import { DashboardPage } from '../models';
4
+ import { PlaywrightCombinedArgs } from './types';
5
+ type DashboardPageFixture = TestFixture<DashboardPage, PluginFixture & PluginOptions & PlaywrightCombinedArgs>;
6
+ declare const dashboardPage: DashboardPageFixture;
7
+ export default dashboardPage;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const models_1 = require("../models");
4
+ const dashboardPage = async ({ page, request, selectors, grafanaVersion }, use, testInfo) => {
5
+ const dashboardPage = new models_1.DashboardPage({ page, selectors, grafanaVersion, request, testInfo });
6
+ await dashboardPage.goto();
7
+ await use(dashboardPage);
8
+ };
9
+ exports.default = dashboardPage;
@@ -4,7 +4,7 @@ declare const fixtures: {
4
4
  login: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: () => Promise<void>) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
5
5
  createDataSourceConfigPage: (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("..").CreateDataSourcePageArgs) => Promise<import("..").DataSourceConfigPage>) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
6
6
  page: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: import("playwright-core").Page) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
7
- newDashboardPage: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: import("..").DashboardPage) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
7
+ dashboardPage: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: import("..").DashboardPage) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
8
8
  panelEditPage: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: import("..").PanelEditPage) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
9
9
  variableEditPage: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: import("..").VariableEditPage) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
10
10
  annotationEditPage: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: import("..").AnnotationEditPage) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
@@ -14,5 +14,11 @@ declare const fixtures: {
14
14
  readProvisionedDashboard: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: <T_1 = any>(args: import("..").ReadProvisionedDashboardArgs) => Promise<T_1>) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
15
15
  isFeatureToggleEnabled: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: <T_2 = object>(featureToggle: keyof T_2) => Promise<boolean>) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
16
16
  createUser: (args: import("..").PluginFixture & import("..").PluginOptions & import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions, use: (r: () => Promise<void>) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
17
+ gotoDashboardPage: (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("..").DashboardPageArgs) => Promise<import("..").DashboardPage>) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
18
+ gotoPanelEditPage: (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("..").PanelEditPage>) => Promise<void>, testInfo: import("playwright/test").TestInfo) => any;
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
+ 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
+ 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;
17
23
  };
18
24
  export default fixtures;
@@ -12,19 +12,25 @@ const panelEditPage_1 = __importDefault(require("./panelEditPage"));
12
12
  const createDataSource_1 = __importDefault(require("./commands/createDataSource"));
13
13
  const readProvisionedDataSource_1 = __importDefault(require("./commands/readProvisionedDataSource"));
14
14
  const readProvisionedDashboard_1 = __importDefault(require("./commands/readProvisionedDashboard"));
15
- const newDashboardPage_1 = __importDefault(require("./newDashboardPage"));
15
+ const dashboardPage_1 = __importDefault(require("./dashboardPage"));
16
16
  const variableEditPage_1 = __importDefault(require("./variableEditPage"));
17
17
  const explorePage_1 = __importDefault(require("./explorePage"));
18
18
  const isFeatureToggleEnabled_1 = __importDefault(require("./isFeatureToggleEnabled"));
19
19
  const page_1 = __importDefault(require("./page"));
20
20
  const createUser_1 = __importDefault(require("./commands/createUser"));
21
+ const gotoDashboardPage_1 = __importDefault(require("./commands/gotoDashboardPage"));
22
+ const gotoPanelEditPage_1 = __importDefault(require("./commands/gotoPanelEditPage"));
23
+ const gotoVariableEditPage_1 = __importDefault(require("./commands/gotoVariableEditPage"));
24
+ const gotoAnnotationEditPage_1 = __importDefault(require("./commands/gotoAnnotationEditPage"));
25
+ const gotoDataSourceConfigPage_1 = __importDefault(require("./commands/gotoDataSourceConfigPage"));
26
+ const gotoAppConfigPage_1 = __importDefault(require("./commands/gotoAppConfigPage"));
21
27
  const fixtures = {
22
28
  selectors: selectors_1.default,
23
29
  grafanaVersion: grafanaVersion_1.default,
24
30
  login: login_1.default,
25
31
  createDataSourceConfigPage: createDataSourceConfigPage_1.default,
26
32
  page: page_1.default,
27
- newDashboardPage: newDashboardPage_1.default,
33
+ dashboardPage: dashboardPage_1.default,
28
34
  panelEditPage: panelEditPage_1.default,
29
35
  variableEditPage: variableEditPage_1.default,
30
36
  annotationEditPage: annotationEditPage_1.default,
@@ -34,5 +40,11 @@ const fixtures = {
34
40
  readProvisionedDashboard: readProvisionedDashboard_1.default,
35
41
  isFeatureToggleEnabled: isFeatureToggleEnabled_1.default,
36
42
  createUser: createUser_1.default,
43
+ gotoDashboardPage: gotoDashboardPage_1.default,
44
+ gotoPanelEditPage: gotoPanelEditPage_1.default,
45
+ gotoVariableEditPage: gotoVariableEditPage_1.default,
46
+ gotoAnnotationEditPage: gotoAnnotationEditPage_1.default,
47
+ gotoDataSourceConfigPage: gotoDataSourceConfigPage_1.default,
48
+ gotoAppConfigPage: gotoAppConfigPage_1.default,
37
49
  };
38
50
  exports.default = fixtures;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const panelEditPage = async ({ newDashboardPage }, use) => {
4
- const panelEditPage = await newDashboardPage.addPanel();
3
+ const panelEditPage = async ({ dashboardPage }, use) => {
4
+ const panelEditPage = await dashboardPage.addPanel();
5
5
  await use(panelEditPage);
6
6
  };
7
7
  exports.default = panelEditPage;
@@ -10,3 +10,5 @@ export { VariablePage } from './pages/VariablePage';
10
10
  export { DataSourcePicker } from './components/DataSourcePicker';
11
11
  export { Panel } from './components/Panel';
12
12
  export { TimeRange } from './components/TimeRange';
13
+ export { AppConfigPage } from './pages/AppConfigPage';
14
+ export { PluginConfigPage } from './pages/PluginConfigPage';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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.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");
@@ -25,3 +25,7 @@ var Panel_1 = require("./components/Panel");
25
25
  Object.defineProperty(exports, "Panel", { enumerable: true, get: function () { return Panel_1.Panel; } });
26
26
  var TimeRange_1 = require("./components/TimeRange");
27
27
  Object.defineProperty(exports, "TimeRange", { enumerable: true, get: function () { return TimeRange_1.TimeRange; } });
28
+ var AppConfigPage_1 = require("./pages/AppConfigPage");
29
+ Object.defineProperty(exports, "AppConfigPage", { enumerable: true, get: function () { return AppConfigPage_1.AppConfigPage; } });
30
+ var PluginConfigPage_1 = require("./pages/PluginConfigPage");
31
+ Object.defineProperty(exports, "PluginConfigPage", { enumerable: true, get: function () { return PluginConfigPage_1.PluginConfigPage; } });
@@ -0,0 +1,14 @@
1
+ import { Response as PlaywrightResponse } from '@playwright/test';
2
+ import { PluginConfigPageArgs, PluginTestCtx } from '../../types';
3
+ import { PluginConfigPage } from './PluginConfigPage';
4
+ export declare class AppConfigPage extends PluginConfigPage {
5
+ readonly ctx: PluginTestCtx;
6
+ readonly args: PluginConfigPageArgs;
7
+ constructor(ctx: PluginTestCtx, args: PluginConfigPageArgs);
8
+ /**
9
+ * Will wait for the settings endpoint to be called e.g. when saving settings
10
+ */
11
+ waitForSettingsResponse(options?: {
12
+ timeout?: number;
13
+ }): Promise<PlaywrightResponse>;
14
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppConfigPage = void 0;
4
+ const PluginConfigPage_1 = require("./PluginConfigPage");
5
+ class AppConfigPage extends PluginConfigPage_1.PluginConfigPage {
6
+ ctx;
7
+ args;
8
+ constructor(ctx, args) {
9
+ super(ctx, args);
10
+ this.ctx = ctx;
11
+ this.args = args;
12
+ }
13
+ /**
14
+ * Will wait for the settings endpoint to be called e.g. when saving settings
15
+ */
16
+ waitForSettingsResponse(options) {
17
+ const url = this.ctx.selectors.apis.Plugin.settings(this.args.pluginId);
18
+ return this.ctx.page.waitForResponse(url, options);
19
+ }
20
+ }
21
+ exports.AppConfigPage = AppConfigPage;
@@ -0,0 +1,11 @@
1
+ import { PluginConfigPageArgs, NavigateOptions, PluginTestCtx } from '../../types';
2
+ import { GrafanaPage } from './GrafanaPage';
3
+ export declare class PluginConfigPage extends GrafanaPage {
4
+ readonly ctx: PluginTestCtx;
5
+ readonly args: PluginConfigPageArgs;
6
+ constructor(ctx: PluginTestCtx, args: PluginConfigPageArgs);
7
+ /**
8
+ * Navigates to the app plugin config page.
9
+ */
10
+ goto(options?: NavigateOptions): Promise<void>;
11
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PluginConfigPage = void 0;
4
+ const GrafanaPage_1 = require("./GrafanaPage");
5
+ class PluginConfigPage extends GrafanaPage_1.GrafanaPage {
6
+ ctx;
7
+ args;
8
+ constructor(ctx, args) {
9
+ super(ctx);
10
+ this.ctx = ctx;
11
+ this.args = args;
12
+ }
13
+ /**
14
+ * Navigates to the app plugin config page.
15
+ */
16
+ goto(options) {
17
+ const url = this.ctx.selectors.pages.Plugin.url(this.args.pluginId);
18
+ return super.navigate(url, options);
19
+ }
20
+ }
21
+ exports.PluginConfigPage = PluginConfigPage;
package/dist/types.d.ts CHANGED
@@ -246,3 +246,7 @@ export interface ContainTextOptions {
246
246
  */
247
247
  useInnerText?: boolean;
248
248
  }
249
+ export type PluginConfigPageArgs = {
250
+ pluginId: string;
251
+ };
252
+ export type GotoAppConfigPageArgs = PluginConfigPageArgs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-e2e",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -46,5 +46,5 @@
46
46
  "uuid": "^9.0.1",
47
47
  "yaml": "^2.3.4"
48
48
  },
49
- "gitHead": "cfb36df34e91f83732cf2785e15aab43540cf551"
49
+ "gitHead": "b368c05c45d61983883f8efe7ee814b609b8d482"
50
50
  }
@@ -1,7 +0,0 @@
1
- import { TestFixture } from '@playwright/test';
2
- import { PluginFixture, PluginOptions } from '../api';
3
- import { DashboardPage } from '../models';
4
- import { PlaywrightCombinedArgs } from './types';
5
- type NewDashboardPageFixture = TestFixture<DashboardPage, PluginFixture & PluginOptions & PlaywrightCombinedArgs>;
6
- declare const newDashboardPage: NewDashboardPageFixture;
7
- export default newDashboardPage;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const models_1 = require("../models");
4
- const newDashboardPage = async ({ page, request, selectors, grafanaVersion }, use, testInfo) => {
5
- const newDashboardPage = new models_1.DashboardPage({ page, selectors, grafanaVersion, request, testInfo });
6
- await newDashboardPage.goto();
7
- await use(newDashboardPage);
8
- };
9
- exports.default = newDashboardPage;