@grafana/plugin-e2e 0.18.0 → 0.19.0-canary.769.63a3ce3.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/e2e-selectors/types.d.ts +1 -0
- package/dist/e2e-selectors/versioned/apis.d.ts +3 -0
- package/dist/e2e-selectors/versioned/apis.js +3 -0
- package/dist/fixtures/annotationEditPage.js +2 -2
- package/dist/fixtures/commands/createDataSourceConfigPage.js +2 -2
- package/dist/fixtures/explorePage.js +2 -2
- package/dist/fixtures/newDashboardPage.js +2 -2
- package/dist/fixtures/variableEditPage.js +2 -2
- package/dist/models/pages/DataSourceConfigPage.d.ts +6 -4
- package/dist/models/pages/DataSourceConfigPage.js +8 -10
- package/dist/types.d.ts +5 -4
- package/package.json +2 -2
|
@@ -24,6 +24,9 @@ exports.versionedAPIs = {
|
|
|
24
24
|
datasourceByUID: {
|
|
25
25
|
[constants_1.MIN_GRAFANA_VERSION]: (uid) => `/api/datasources/uid/${uid}`,
|
|
26
26
|
},
|
|
27
|
+
proxy: {
|
|
28
|
+
[constants_1.MIN_GRAFANA_VERSION]: (uid) => `api/datasources/proxy/uid/${uid}`,
|
|
29
|
+
},
|
|
27
30
|
},
|
|
28
31
|
Dashboard: {
|
|
29
32
|
delete: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const models_1 = require("../models");
|
|
4
|
-
const annotationEditPage = async ({ page, selectors, grafanaVersion, request }, use) => {
|
|
5
|
-
const annotationPage = new models_1.AnnotationPage({ page, selectors, grafanaVersion, request });
|
|
4
|
+
const annotationEditPage = async ({ page, selectors, grafanaVersion, request }, use, testInfo) => {
|
|
5
|
+
const annotationPage = new models_1.AnnotationPage({ page, selectors, grafanaVersion, request, testInfo });
|
|
6
6
|
await annotationPage.goto();
|
|
7
7
|
const annotationEditPage = await annotationPage.clickAddNew();
|
|
8
8
|
await use(annotationEditPage);
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const models_1 = require("../../models");
|
|
4
4
|
const createDataSource_1 = require("./createDataSource");
|
|
5
|
-
const createDataSourceConfigPage = async ({ request, page, selectors, grafanaVersion }, use) => {
|
|
5
|
+
const createDataSourceConfigPage = async ({ request, page, selectors, grafanaVersion }, use, testInfo) => {
|
|
6
6
|
let datasourceConfigPage;
|
|
7
7
|
let deleteDataSource = true;
|
|
8
8
|
await use(async (args) => {
|
|
9
9
|
deleteDataSource = args.deleteDataSourceAfterTest ?? true;
|
|
10
10
|
const datasource = await (0, createDataSource_1.createDataSourceViaAPI)(request, args);
|
|
11
|
-
datasourceConfigPage = new models_1.DataSourceConfigPage({ page, selectors, grafanaVersion, request }, datasource);
|
|
11
|
+
datasourceConfigPage = new models_1.DataSourceConfigPage({ page, selectors, grafanaVersion, request, testInfo }, datasource);
|
|
12
12
|
await datasourceConfigPage.goto();
|
|
13
13
|
return datasourceConfigPage;
|
|
14
14
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const ExplorePage_1 = require("../models/pages/ExplorePage");
|
|
4
|
-
const explorePage = async ({ page, selectors, grafanaVersion, request }, use) => {
|
|
5
|
-
const explorePage = new ExplorePage_1.ExplorePage({ page, selectors, grafanaVersion, request });
|
|
4
|
+
const explorePage = async ({ page, selectors, grafanaVersion, request }, use, testInfo) => {
|
|
5
|
+
const explorePage = new ExplorePage_1.ExplorePage({ page, selectors, grafanaVersion, request, testInfo });
|
|
6
6
|
await explorePage.goto();
|
|
7
7
|
await use(explorePage);
|
|
8
8
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const models_1 = require("../models");
|
|
4
|
-
const newDashboardPage = async ({ page, request, selectors, grafanaVersion }, use) => {
|
|
5
|
-
const newDashboardPage = new models_1.DashboardPage({ page, selectors, grafanaVersion, request });
|
|
4
|
+
const newDashboardPage = async ({ page, request, selectors, grafanaVersion }, use, testInfo) => {
|
|
5
|
+
const newDashboardPage = new models_1.DashboardPage({ page, selectors, grafanaVersion, request, testInfo });
|
|
6
6
|
await newDashboardPage.goto();
|
|
7
7
|
await use(newDashboardPage);
|
|
8
8
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const models_1 = require("../models");
|
|
4
|
-
const variableEditPage = async ({ page, selectors, grafanaVersion, request }, use) => {
|
|
5
|
-
const variablePage = new models_1.VariablePage({ page, selectors, grafanaVersion, request });
|
|
4
|
+
const variableEditPage = async ({ page, selectors, grafanaVersion, request }, use, testInfo) => {
|
|
5
|
+
const variablePage = new models_1.VariablePage({ page, selectors, grafanaVersion, request, testInfo });
|
|
6
6
|
await variablePage.goto();
|
|
7
7
|
const variableEditPage = await variablePage.clickAddNew();
|
|
8
8
|
await use(variableEditPage);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Response } from '@playwright/test';
|
|
2
|
-
import { DataSourceSettings, NavigateOptions, PluginTestCtx,
|
|
2
|
+
import { DataSourceSettings, NavigateOptions, PluginTestCtx, TriggerRequestOptions } from '../../types';
|
|
3
3
|
import { GrafanaPage } from './GrafanaPage';
|
|
4
4
|
export declare class DataSourceConfigPage extends GrafanaPage {
|
|
5
|
-
|
|
5
|
+
datasource: DataSourceSettings;
|
|
6
6
|
constructor(ctx: PluginTestCtx, datasource: DataSourceSettings);
|
|
7
7
|
deleteDataSource(): Promise<void>;
|
|
8
8
|
/**
|
|
@@ -18,7 +18,9 @@ export declare class DataSourceConfigPage extends GrafanaPage {
|
|
|
18
18
|
/**
|
|
19
19
|
* Clicks the save and test button and waits for the response
|
|
20
20
|
*
|
|
21
|
-
*
|
|
21
|
+
* By default, this will return the response of the health check call to /api/datasources/uid/<pluginUid>/health.
|
|
22
|
+
* Optionally, if your plugin uses a custom health check endpoint, you can provide the {@link TriggerRequestOptions.path } of this url.
|
|
23
|
+
* May be useful for data source plugins that don't have a backend.
|
|
22
24
|
*/
|
|
23
|
-
saveAndTest(options?:
|
|
25
|
+
saveAndTest(options?: TriggerRequestOptions): Promise<Response>;
|
|
24
26
|
}
|
|
@@ -23,24 +23,22 @@ class DataSourceConfigPage extends GrafanaPage_1.GrafanaPage {
|
|
|
23
23
|
* @param status the HTTP status code to return. Defaults to 200
|
|
24
24
|
*/
|
|
25
25
|
async mockHealthCheckResponse(json, status = 200) {
|
|
26
|
-
await this.ctx.page.route(`${this.ctx.selectors.apis.DataSource.health(this.datasource.uid, this.datasource.id
|
|
26
|
+
await this.ctx.page.route(`${this.ctx.selectors.apis.DataSource.health(this.datasource.uid, this.datasource.id.toString())}`, async (route) => {
|
|
27
27
|
await route.fulfill({ json, status });
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Clicks the save and test button and waits for the response
|
|
32
32
|
*
|
|
33
|
-
*
|
|
33
|
+
* By default, this will return the response of the health check call to /api/datasources/uid/<pluginUid>/health.
|
|
34
|
+
* Optionally, if your plugin uses a custom health check endpoint, you can provide the {@link TriggerRequestOptions.path } of this url.
|
|
35
|
+
* May be useful for data source plugins that don't have a backend.
|
|
34
36
|
*/
|
|
35
37
|
async saveAndTest(options) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const saveResponsePromise = this.ctx.page.waitForResponse((resp) => resp.url().includes(this.ctx.selectors.apis.DataSource.datasourceByUID(this.datasource.uid)));
|
|
41
|
-
const healthResponsePromise = this.ctx.page.waitForResponse((resp) => resp
|
|
42
|
-
.url()
|
|
43
|
-
.includes(this.ctx.selectors.apis.DataSource.health(this.datasource.uid, this.datasource.id?.toString() ?? '')));
|
|
38
|
+
const { datasourceByUID, health } = this.ctx.selectors.apis.DataSource;
|
|
39
|
+
const saveResponsePromise = this.ctx.page.waitForResponse((resp) => resp.url().includes(datasourceByUID(this.datasource.uid)));
|
|
40
|
+
const healthPath = options?.path ?? health(this.datasource.uid, this.datasource.id.toString());
|
|
41
|
+
const healthResponsePromise = this.ctx.page.waitForResponse((resp) => resp.url().includes(healthPath));
|
|
44
42
|
await this.getByTestIdOrAriaLabel(this.ctx.selectors.pages.DataSource.saveAndTest).click();
|
|
45
43
|
return saveResponsePromise.then(() => healthResponsePromise);
|
|
46
44
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Locator, PlaywrightTestArgs, Response } from '@playwright/test';
|
|
1
|
+
import { Locator, PlaywrightTestArgs, Response, TestInfo } from '@playwright/test';
|
|
2
2
|
import { E2ESelectors } from './e2e-selectors/types';
|
|
3
3
|
/**
|
|
4
4
|
* The context object passed to page object models
|
|
@@ -6,6 +6,7 @@ import { E2ESelectors } from './e2e-selectors/types';
|
|
|
6
6
|
export type PluginTestCtx = {
|
|
7
7
|
grafanaVersion: string;
|
|
8
8
|
selectors: E2ESelectors;
|
|
9
|
+
testInfo: TestInfo;
|
|
9
10
|
} & Pick<PlaywrightTestArgs, 'page' | 'request'>;
|
|
10
11
|
/**
|
|
11
12
|
* The data source settings
|
|
@@ -183,11 +184,11 @@ export type GetByTestIdOrAriaLabelOptions = {
|
|
|
183
184
|
*/
|
|
184
185
|
startsWith?: boolean;
|
|
185
186
|
};
|
|
186
|
-
export type
|
|
187
|
+
export type TriggerRequestOptions = {
|
|
187
188
|
/**
|
|
188
|
-
*
|
|
189
|
+
* The path to the endpoint to trigger
|
|
189
190
|
*/
|
|
190
|
-
|
|
191
|
+
path?: string;
|
|
191
192
|
};
|
|
192
193
|
/**
|
|
193
194
|
* Panel visualization types
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/plugin-e2e",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0-canary.769.63a3ce3.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": "
|
|
49
|
+
"gitHead": "63a3ce36bd8cd59be06f1c153939be48d3575545"
|
|
50
50
|
}
|