@grafana/plugin-e2e 0.5.0-canary.641.7aa6686.0 → 0.6.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 +1 -1
- package/dist/index.d.ts +28 -0
- package/dist/matchers/index.d.ts +1 -1
- package/dist/matchers/toDisplayPreviews.d.ts +2 -1
- package/dist/matchers/toDisplayPreviews.js +2 -2
- package/dist/models/AnnotationEditPage.d.ts +3 -0
- package/dist/models/AnnotationEditPage.js +3 -0
- package/dist/models/AnnotationPage.d.ts +6 -0
- package/dist/models/AnnotationPage.js +6 -0
- package/dist/models/DashboardPage.d.ts +17 -0
- package/dist/models/DashboardPage.js +17 -0
- package/dist/models/DataSourceConfigPage.d.ts +3 -0
- package/dist/models/DataSourceConfigPage.js +3 -0
- package/dist/models/DataSourcePicker.d.ts +3 -0
- package/dist/models/DataSourcePicker.js +3 -0
- package/dist/models/ExplorePage.d.ts +9 -0
- package/dist/models/ExplorePage.js +9 -0
- package/dist/models/PanelEditPage.d.ts +18 -0
- package/dist/models/PanelEditPage.js +18 -0
- package/dist/models/TimeRange.d.ts +3 -0
- package/dist/models/TimeRange.js +3 -0
- package/dist/models/VariableEditPage.d.ts +6 -0
- package/dist/models/VariableEditPage.js +6 -0
- package/dist/models/VariablePage.d.ts +6 -0
- package/dist/models/VariablePage.js +6 -0
- package/dist/types.d.ts +15 -0
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -141,7 +141,7 @@ export declare const expect: import("@playwright/test").Expect<{
|
|
|
141
141
|
pass: boolean;
|
|
142
142
|
actual: number;
|
|
143
143
|
}>;
|
|
144
|
-
toDisplayPreviews: (variableEditPage: VariableEditPage, previewTexts: (string | RegExp)[]) => Promise<{
|
|
144
|
+
toDisplayPreviews: (variableEditPage: VariableEditPage, previewTexts: (string | RegExp)[], options?: import("./types").ContainTextOptions) => Promise<{
|
|
145
145
|
pass: boolean;
|
|
146
146
|
actual: boolean;
|
|
147
147
|
message: () => string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
|
+
import { GrafanaPage, VariableEditPage } from './models';
|
|
2
|
+
import { AlertPageOptions, AlertVariant, ContainTextOptions, PanelError } from './types';
|
|
1
3
|
export { expect, test, type PluginFixture, type PluginOptions } from './api';
|
|
2
4
|
export * from './e2e-selectors';
|
|
3
5
|
export * from './fixtures';
|
|
4
6
|
export * from './models';
|
|
7
|
+
declare global {
|
|
8
|
+
namespace PlaywrightTest {
|
|
9
|
+
const r: unique symbol;
|
|
10
|
+
const t: unique symbol;
|
|
11
|
+
interface Matchers<R, T> {
|
|
12
|
+
[r]: R;
|
|
13
|
+
[t]: T;
|
|
14
|
+
/**
|
|
15
|
+
* Await the response of a Playwright request and asserts the response was successful (status in the range 200-299).
|
|
16
|
+
*/
|
|
17
|
+
toBeOK(this: Matchers<unknown, Promise<Response>>): R;
|
|
18
|
+
/**
|
|
19
|
+
* Asserts that preview text elements are displayed on the Variable Edit Page. You should make sure any variable queries are completed before calling this matcher.
|
|
20
|
+
*/
|
|
21
|
+
toDisplayPreviews(this: Matchers<unknown, VariableEditPage>, previewTexts: Array<string | RegExp>, options: ContainTextOptions): R;
|
|
22
|
+
/**
|
|
23
|
+
* Asserts that a GrafanaPage contains an alert with the specified severity. Use the options to specify the timeout and to filter the alerts.
|
|
24
|
+
*/
|
|
25
|
+
toHaveAlert(this: Matchers<unknown, GrafanaPage>, severity: AlertVariant, options?: AlertPageOptions): R;
|
|
26
|
+
/**
|
|
27
|
+
* Asserts that the number of panel errors displayed on the page is equal to 1.
|
|
28
|
+
*/
|
|
29
|
+
toHavePanelError(this: Matchers<unknown, PanelError>): R;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
package/dist/matchers/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare const _default: {
|
|
|
11
11
|
pass: boolean;
|
|
12
12
|
actual: number;
|
|
13
13
|
}>;
|
|
14
|
-
toDisplayPreviews: (variableEditPage: import("..").VariableEditPage, previewTexts: (string | RegExp)[]) => Promise<{
|
|
14
|
+
toDisplayPreviews: (variableEditPage: import("..").VariableEditPage, previewTexts: (string | RegExp)[], options?: import("../types").ContainTextOptions) => Promise<{
|
|
15
15
|
pass: boolean;
|
|
16
16
|
actual: boolean;
|
|
17
17
|
message: () => string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { VariableEditPage } from '../models';
|
|
2
|
-
|
|
2
|
+
import { ContainTextOptions } from '../types';
|
|
3
|
+
declare const toDisplayPreviews: (variableEditPage: VariableEditPage, previewTexts: Array<string | RegExp>, options?: ContainTextOptions) => Promise<{
|
|
3
4
|
pass: boolean;
|
|
4
5
|
actual: boolean;
|
|
5
6
|
message: () => string;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const test_1 = require("@playwright/test");
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
|
-
const toDisplayPreviews = async (variableEditPage, previewTexts) => {
|
|
5
|
+
const toDisplayPreviews = async (variableEditPage, previewTexts, options) => {
|
|
6
6
|
let pass = false;
|
|
7
7
|
let actual;
|
|
8
8
|
let message = `To find preview of values: ${previewTexts.join(', ')}}`;
|
|
9
9
|
try {
|
|
10
|
-
await (0, test_1.expect)(variableEditPage.getByTestIdOrAriaLabel(variableEditPage.ctx.selectors.pages.Dashboard.Settings.Variables.Edit.General.previewOfValuesOption)).toContainText(previewTexts);
|
|
10
|
+
await (0, test_1.expect)(variableEditPage.getByTestIdOrAriaLabel(variableEditPage.ctx.selectors.pages.Dashboard.Settings.Variables.Edit.General.previewOfValuesOption)).toContainText(previewTexts, options);
|
|
11
11
|
return {
|
|
12
12
|
pass: true,
|
|
13
13
|
actual: false,
|
|
@@ -6,6 +6,9 @@ export declare class AnnotationEditPage extends GrafanaPage {
|
|
|
6
6
|
readonly args: DashboardEditViewArgs<string>;
|
|
7
7
|
datasource: DataSourcePicker;
|
|
8
8
|
constructor(ctx: PluginTestCtx, args: DashboardEditViewArgs<string>);
|
|
9
|
+
/**
|
|
10
|
+
* Navigates to the annotation edit page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
|
|
11
|
+
*/
|
|
9
12
|
goto(options?: NavigateOptions): Promise<void>;
|
|
10
13
|
/**
|
|
11
14
|
* Executes the annotation query defined in the annotation page and returns the response promise
|
|
@@ -13,6 +13,9 @@ class AnnotationEditPage extends GrafanaPage_1.GrafanaPage {
|
|
|
13
13
|
this.args = args;
|
|
14
14
|
this.datasource = new DataSourcePicker_1.DataSourcePicker(ctx);
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Navigates to the annotation edit page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
|
|
18
|
+
*/
|
|
16
19
|
async goto(options) {
|
|
17
20
|
const { Dashboard, AddDashboard } = this.ctx.selectors.pages;
|
|
18
21
|
const url = this.args.dashboard?.uid
|
|
@@ -5,6 +5,12 @@ export declare class AnnotationPage extends GrafanaPage {
|
|
|
5
5
|
readonly ctx: PluginTestCtx;
|
|
6
6
|
readonly dashboard?: DashboardPageArgs;
|
|
7
7
|
constructor(ctx: PluginTestCtx, dashboard?: DashboardPageArgs);
|
|
8
|
+
/**
|
|
9
|
+
* Navigates to the annotation list page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
|
|
10
|
+
*/
|
|
8
11
|
goto(options?: NavigateOptions): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Clicks the add new annotation button and returns the annotation edit page
|
|
14
|
+
*/
|
|
9
15
|
clickAddNew(): Promise<AnnotationEditPage>;
|
|
10
16
|
}
|
|
@@ -35,6 +35,9 @@ class AnnotationPage extends GrafanaPage_1.GrafanaPage {
|
|
|
35
35
|
this.ctx = ctx;
|
|
36
36
|
this.dashboard = dashboard;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Navigates to the annotation list page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
|
|
40
|
+
*/
|
|
38
41
|
async goto(options) {
|
|
39
42
|
const { Dashboard, AddDashboard } = this.ctx.selectors.pages;
|
|
40
43
|
let url = this.dashboard?.uid
|
|
@@ -42,6 +45,9 @@ class AnnotationPage extends GrafanaPage_1.GrafanaPage {
|
|
|
42
45
|
: AddDashboard.Settings.Annotations.List.url;
|
|
43
46
|
return super.navigate(url, options);
|
|
44
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Clicks the add new annotation button and returns the annotation edit page
|
|
50
|
+
*/
|
|
45
51
|
async clickAddNew() {
|
|
46
52
|
const { Dashboard } = this.ctx.selectors.pages;
|
|
47
53
|
if (!this.dashboard?.uid) {
|
|
@@ -8,9 +8,26 @@ export declare class DashboardPage extends GrafanaPage {
|
|
|
8
8
|
dataSourcePicker: any;
|
|
9
9
|
timeRange: TimeRange;
|
|
10
10
|
constructor(ctx: PluginTestCtx, dashboard?: DashboardPageArgs);
|
|
11
|
+
/**
|
|
12
|
+
* Navigates to the dashboard page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
|
|
13
|
+
*/
|
|
11
14
|
goto(options?: NavigateOptions): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Navigates to the panel edit page for the given panel id
|
|
17
|
+
*
|
|
18
|
+
* If the panel id does not exist in the dashboard, Grafana will redirect to the dashboard page
|
|
19
|
+
*/
|
|
12
20
|
gotoPanelEditPage(panelId: string): Promise<PanelEditPage>;
|
|
21
|
+
/**
|
|
22
|
+
* Clicks the buttons to add a new panel and returns the panel edit page for the new panel
|
|
23
|
+
*/
|
|
13
24
|
addPanel(): Promise<PanelEditPage>;
|
|
25
|
+
/**
|
|
26
|
+
* Deletes the dashboard
|
|
27
|
+
*/
|
|
14
28
|
deleteDashboard(): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Clicks the run button in the refresh picker to refresh the dashboard
|
|
31
|
+
*/
|
|
15
32
|
refreshDashboard(): Promise<void>;
|
|
16
33
|
}
|
|
@@ -18,6 +18,9 @@ class DashboardPage extends GrafanaPage_1.GrafanaPage {
|
|
|
18
18
|
this.dataSourcePicker = new DataSourcePicker_1.DataSourcePicker(ctx);
|
|
19
19
|
this.timeRange = new TimeRange_1.TimeRange(ctx);
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Navigates to the dashboard page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
|
|
23
|
+
*/
|
|
21
24
|
async goto(options) {
|
|
22
25
|
let url = this.dashboard?.uid
|
|
23
26
|
? this.ctx.selectors.pages.Dashboard.url(this.dashboard.uid)
|
|
@@ -29,11 +32,19 @@ class DashboardPage extends GrafanaPage_1.GrafanaPage {
|
|
|
29
32
|
}
|
|
30
33
|
return super.navigate(url, options);
|
|
31
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Navigates to the panel edit page for the given panel id
|
|
37
|
+
*
|
|
38
|
+
* If the panel id does not exist in the dashboard, Grafana will redirect to the dashboard page
|
|
39
|
+
*/
|
|
32
40
|
async gotoPanelEditPage(panelId) {
|
|
33
41
|
const panelEditPage = new PanelEditPage_1.PanelEditPage(this.ctx, { dashboard: this.dashboard, id: panelId });
|
|
34
42
|
await panelEditPage.goto();
|
|
35
43
|
return panelEditPage;
|
|
36
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Clicks the buttons to add a new panel and returns the panel edit page for the new panel
|
|
47
|
+
*/
|
|
37
48
|
async addPanel() {
|
|
38
49
|
const { components, pages } = this.ctx.selectors;
|
|
39
50
|
if (gte(this.ctx.grafanaVersion, '10.0.0')) {
|
|
@@ -49,9 +60,15 @@ class DashboardPage extends GrafanaPage_1.GrafanaPage {
|
|
|
49
60
|
});
|
|
50
61
|
return new PanelEditPage_1.PanelEditPage(this.ctx, { dashboard: this.dashboard, id: panelId });
|
|
51
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Deletes the dashboard
|
|
65
|
+
*/
|
|
52
66
|
async deleteDashboard() {
|
|
53
67
|
await this.ctx.request.delete(this.ctx.selectors.apis.Dashboard.delete(this.dashboard.uid));
|
|
54
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Clicks the run button in the refresh picker to refresh the dashboard
|
|
71
|
+
*/
|
|
55
72
|
async refreshDashboard() {
|
|
56
73
|
await this.ctx.page.getByTestId(this.ctx.selectors.components.RefreshPicker.runButtonV2).click();
|
|
57
74
|
}
|
|
@@ -4,6 +4,9 @@ export declare class DataSourceConfigPage extends GrafanaPage {
|
|
|
4
4
|
private datasource;
|
|
5
5
|
constructor(ctx: PluginTestCtx, datasource: DataSource);
|
|
6
6
|
deleteDataSource(): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Navigates to the datasource edit page for an existing datasource
|
|
9
|
+
*/
|
|
7
10
|
goto(options?: NavigateOptions): Promise<void>;
|
|
8
11
|
/**
|
|
9
12
|
* Mocks the response of the datasource health check call
|
|
@@ -11,6 +11,9 @@ class DataSourceConfigPage extends GrafanaPage_1.GrafanaPage {
|
|
|
11
11
|
async deleteDataSource() {
|
|
12
12
|
await this.ctx.request.delete(this.ctx.selectors.apis.DataSource.datasourceByUID(this.datasource.uid));
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Navigates to the datasource edit page for an existing datasource
|
|
16
|
+
*/
|
|
14
17
|
async goto(options) {
|
|
15
18
|
return super.navigate(this.ctx.selectors.pages.EditDataSource.url(this.datasource.uid), options);
|
|
16
19
|
}
|
|
@@ -2,5 +2,8 @@ import { PluginTestCtx } from '../types';
|
|
|
2
2
|
import { GrafanaPage } from './GrafanaPage';
|
|
3
3
|
export declare class DataSourcePicker extends GrafanaPage {
|
|
4
4
|
constructor(ctx: PluginTestCtx);
|
|
5
|
+
/**
|
|
6
|
+
* Sets the data source picker to the provided name
|
|
7
|
+
*/
|
|
5
8
|
set(name: string): Promise<void>;
|
|
6
9
|
}
|
|
@@ -6,6 +6,9 @@ class DataSourcePicker extends GrafanaPage_1.GrafanaPage {
|
|
|
6
6
|
constructor(ctx) {
|
|
7
7
|
super(ctx);
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Sets the data source picker to the provided name
|
|
11
|
+
*/
|
|
9
12
|
async set(name) {
|
|
10
13
|
await this.getByTestIdOrAriaLabel(this.ctx.selectors.components.DataSourcePicker.container)
|
|
11
14
|
.locator('input')
|
|
@@ -6,7 +6,16 @@ export declare class ExplorePage extends GrafanaPage {
|
|
|
6
6
|
datasource: DataSourcePicker;
|
|
7
7
|
timeRange: any;
|
|
8
8
|
constructor(ctx: PluginTestCtx);
|
|
9
|
+
/**
|
|
10
|
+
* Navigates to the explore page.
|
|
11
|
+
*/
|
|
9
12
|
goto(options?: NavigateOptions): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the locator for the query editor row with the given refId
|
|
15
|
+
*/
|
|
10
16
|
getQueryEditorRow(refId: string): Promise<Locator>;
|
|
17
|
+
/**
|
|
18
|
+
* Clicks the "Run Query" button in the refresh picker to run the query. Returns the response promise for the data query
|
|
19
|
+
*/
|
|
11
20
|
runQuery(options?: RequestOptions): Promise<import("@playwright/test").Response>;
|
|
12
21
|
}
|
|
@@ -13,9 +13,15 @@ class ExplorePage extends GrafanaPage_1.GrafanaPage {
|
|
|
13
13
|
this.datasource = new DataSourcePicker_1.DataSourcePicker(ctx);
|
|
14
14
|
this.timeRange = new TimeRange_1.TimeRange(ctx);
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Navigates to the explore page.
|
|
18
|
+
*/
|
|
16
19
|
async goto(options) {
|
|
17
20
|
await super.navigate(this.ctx.selectors.pages.Explore.url, options);
|
|
18
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns the locator for the query editor row with the given refId
|
|
24
|
+
*/
|
|
19
25
|
async getQueryEditorRow(refId) {
|
|
20
26
|
const locator = this.getByTestIdOrAriaLabel(this.ctx.selectors.components.QueryEditorRows.rows).filter({
|
|
21
27
|
has: this.getByTestIdOrAriaLabel(this.ctx.selectors.components.QueryEditorRow.title(refId)),
|
|
@@ -23,6 +29,9 @@ class ExplorePage extends GrafanaPage_1.GrafanaPage {
|
|
|
23
29
|
await (0, test_1.expect)(locator).toBeVisible();
|
|
24
30
|
return locator;
|
|
25
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Clicks the "Run Query" button in the refresh picker to run the query. Returns the response promise for the data query
|
|
34
|
+
*/
|
|
26
35
|
async runQuery(options) {
|
|
27
36
|
const components = this.ctx.selectors.components;
|
|
28
37
|
const responsePromise = this.ctx.page.waitForResponse((resp) => resp.url().includes(this.ctx.selectors.apis.DataSource.query), options);
|
|
@@ -9,6 +9,9 @@ export declare class PanelEditPage extends GrafanaPage implements PanelError {
|
|
|
9
9
|
datasource: DataSourcePicker;
|
|
10
10
|
timeRange: TimeRange;
|
|
11
11
|
constructor(ctx: PluginTestCtx, args: DashboardEditViewArgs<string>);
|
|
12
|
+
/**
|
|
13
|
+
* Navigates to the panel edit page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
|
|
14
|
+
*/
|
|
12
15
|
goto(options?: NavigateOptions): Promise<void>;
|
|
13
16
|
/**
|
|
14
17
|
* Sets the title of the panel. This method will open the panel options, set the title and close the panel options.
|
|
@@ -22,9 +25,24 @@ export declare class PanelEditPage extends GrafanaPage implements PanelError {
|
|
|
22
25
|
* Expands the section for the given category name. If the section is already expanded, this method does nothing.
|
|
23
26
|
*/
|
|
24
27
|
collapseSection(categoryName: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the name of the visualization currently selected in the panel editor
|
|
30
|
+
*/
|
|
25
31
|
getVisualizationName(): Locator;
|
|
32
|
+
/**
|
|
33
|
+
* Clicks the "Apply" button in the panel editor
|
|
34
|
+
*/
|
|
26
35
|
apply(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the locator for the query editor row with the given refId
|
|
38
|
+
*/
|
|
27
39
|
getQueryEditorRow(refId: string): Promise<Locator>;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the locator for the panel error (if any)
|
|
42
|
+
*/
|
|
28
43
|
getPanelError(): Locator;
|
|
44
|
+
/**
|
|
45
|
+
* CLicks the "Refresh" button in the panel editor. Returns the response promise for the data query
|
|
46
|
+
*/
|
|
29
47
|
refreshPanel(options?: RequestOptions): Promise<import("@playwright/test").Response>;
|
|
30
48
|
}
|
|
@@ -42,6 +42,9 @@ class PanelEditPage extends GrafanaPage_1.GrafanaPage {
|
|
|
42
42
|
this.datasource = new DataSourcePicker_1.DataSourcePicker(ctx);
|
|
43
43
|
this.timeRange = new TimeRange_1.TimeRange(ctx);
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Navigates to the panel edit page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
|
|
47
|
+
*/
|
|
45
48
|
async goto(options) {
|
|
46
49
|
const url = this.args.dashboard?.uid
|
|
47
50
|
? this.ctx.selectors.pages.Dashboard.url(this.args.dashboard.uid)
|
|
@@ -90,12 +93,21 @@ class PanelEditPage extends GrafanaPage_1.GrafanaPage {
|
|
|
90
93
|
await section.click();
|
|
91
94
|
}
|
|
92
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Returns the name of the visualization currently selected in the panel editor
|
|
98
|
+
*/
|
|
93
99
|
getVisualizationName() {
|
|
94
100
|
return this.getByTestIdOrAriaLabel(this.ctx.selectors.components.PanelEditor.toggleVizPicker);
|
|
95
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Clicks the "Apply" button in the panel editor
|
|
104
|
+
*/
|
|
96
105
|
async apply() {
|
|
97
106
|
await this.ctx.page.getByTestId(this.ctx.selectors.components.PanelEditor.applyButton).click();
|
|
98
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Returns the locator for the query editor row with the given refId
|
|
110
|
+
*/
|
|
99
111
|
async getQueryEditorRow(refId) {
|
|
100
112
|
const locator = this.getByTestIdOrAriaLabel(this.ctx.selectors.components.QueryEditorRows.rows).filter({
|
|
101
113
|
has: this.getByTestIdOrAriaLabel(this.ctx.selectors.components.QueryEditorRow.title(refId)),
|
|
@@ -103,6 +115,9 @@ class PanelEditPage extends GrafanaPage_1.GrafanaPage {
|
|
|
103
115
|
await (0, test_1.expect)(locator).toBeVisible();
|
|
104
116
|
return locator;
|
|
105
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Returns the locator for the panel error (if any)
|
|
120
|
+
*/
|
|
106
121
|
getPanelError() {
|
|
107
122
|
// the selector (not the selector value) used to identify a panel error changed in 9.4.3
|
|
108
123
|
if (semver.lte(this.ctx.grafanaVersion, '9.4.3')) {
|
|
@@ -110,6 +125,9 @@ class PanelEditPage extends GrafanaPage_1.GrafanaPage {
|
|
|
110
125
|
}
|
|
111
126
|
return this.getByTestIdOrAriaLabel(this.ctx.selectors.components.Panels.Panel.status(ERROR_STATUS));
|
|
112
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* CLicks the "Refresh" button in the panel editor. Returns the response promise for the data query
|
|
130
|
+
*/
|
|
113
131
|
async refreshPanel(options) {
|
|
114
132
|
const responsePromise = this.ctx.page.waitForResponse((resp) => resp.url().includes(this.ctx.selectors.apis.DataSource.query), options);
|
|
115
133
|
// in older versions of grafana, the refresh button is rendered twice. this is a workaround to click the correct one
|
|
@@ -2,5 +2,8 @@ import { PluginTestCtx, TimeRangeArgs } from '../types';
|
|
|
2
2
|
import { GrafanaPage } from './GrafanaPage';
|
|
3
3
|
export declare class TimeRange extends GrafanaPage {
|
|
4
4
|
constructor(ctx: PluginTestCtx);
|
|
5
|
+
/**
|
|
6
|
+
* Opens the time picker and sets the time range to the provided values
|
|
7
|
+
*/
|
|
5
8
|
set({ from, to, zone }: TimeRangeArgs): Promise<void>;
|
|
6
9
|
}
|
package/dist/models/TimeRange.js
CHANGED
|
@@ -6,6 +6,9 @@ class TimeRange extends GrafanaPage_1.GrafanaPage {
|
|
|
6
6
|
constructor(ctx) {
|
|
7
7
|
super(ctx);
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Opens the time picker and sets the time range to the provided values
|
|
11
|
+
*/
|
|
9
12
|
async set({ from, to, zone }) {
|
|
10
13
|
try {
|
|
11
14
|
await this.getByTestIdOrAriaLabel(this.ctx.selectors.components.TimePicker.openButton).click();
|
|
@@ -7,7 +7,13 @@ export declare class VariableEditPage extends GrafanaPage {
|
|
|
7
7
|
readonly args: DashboardEditViewArgs<string>;
|
|
8
8
|
datasource: DataSourcePicker;
|
|
9
9
|
constructor(ctx: PluginTestCtx, args: DashboardEditViewArgs<string>);
|
|
10
|
+
/**
|
|
11
|
+
* Navigates to the variable edit page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
|
|
12
|
+
*/
|
|
10
13
|
goto(options?: NavigateOptions): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Sets the type of variable in the 'Variable type' dropdown to the given type
|
|
16
|
+
*/
|
|
11
17
|
setVariableType(type: VariableType): Promise<void>;
|
|
12
18
|
/**
|
|
13
19
|
* Triggers the variable query to run. Note that unlike {@link PanelEditPage.refreshPanel}, this method doesn't
|
|
@@ -14,6 +14,9 @@ class VariableEditPage extends GrafanaPage_1.GrafanaPage {
|
|
|
14
14
|
this.args = args;
|
|
15
15
|
this.datasource = new DataSourcePicker_1.DataSourcePicker(ctx);
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Navigates to the variable edit page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
|
|
19
|
+
*/
|
|
17
20
|
async goto(options) {
|
|
18
21
|
const { Dashboard, AddDashboard } = this.ctx.selectors.pages;
|
|
19
22
|
const url = this.args.dashboard?.uid
|
|
@@ -21,6 +24,9 @@ class VariableEditPage extends GrafanaPage_1.GrafanaPage {
|
|
|
21
24
|
: AddDashboard.Settings.Variables.Edit.url(this.args.id);
|
|
22
25
|
await super.navigate(url, options);
|
|
23
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Sets the type of variable in the 'Variable type' dropdown to the given type
|
|
29
|
+
*/
|
|
24
30
|
async setVariableType(type) {
|
|
25
31
|
await this.getByTestIdOrAriaLabel(this.ctx.selectors.pages.Dashboard.Settings.Variables.Edit.General.generalTypeSelectV2)
|
|
26
32
|
.locator('input')
|
|
@@ -5,6 +5,12 @@ export declare class VariablePage extends GrafanaPage {
|
|
|
5
5
|
readonly ctx: PluginTestCtx;
|
|
6
6
|
readonly dashboard?: DashboardPageArgs;
|
|
7
7
|
constructor(ctx: PluginTestCtx, dashboard?: DashboardPageArgs);
|
|
8
|
+
/**
|
|
9
|
+
* Navigates to the variable list page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
|
|
10
|
+
*/
|
|
8
11
|
goto(options?: NavigateOptions): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Clicks the add new variable button and returns the variable edit page
|
|
14
|
+
*/
|
|
9
15
|
clickAddNew(): Promise<VariableEditPage>;
|
|
10
16
|
}
|
|
@@ -11,6 +11,9 @@ class VariablePage extends GrafanaPage_1.GrafanaPage {
|
|
|
11
11
|
this.ctx = ctx;
|
|
12
12
|
this.dashboard = dashboard;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Navigates to the variable list page. If a dashboard uid was not provided, it's assumed that it's a new dashboard.
|
|
16
|
+
*/
|
|
14
17
|
async goto(options) {
|
|
15
18
|
const { Dashboard, AddDashboard } = this.ctx.selectors.pages;
|
|
16
19
|
let url = this.dashboard?.uid
|
|
@@ -18,6 +21,9 @@ class VariablePage extends GrafanaPage_1.GrafanaPage {
|
|
|
18
21
|
: AddDashboard.Settings.Variables.List.url;
|
|
19
22
|
return super.navigate(url, options);
|
|
20
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Clicks the add new variable button and returns the variable edit page
|
|
26
|
+
*/
|
|
21
27
|
async clickAddNew() {
|
|
22
28
|
const { addVariableCTAV2, addVariableCTAV2Item, newButton } = this.ctx.selectors.pages.Dashboard.Settings.Variables.List;
|
|
23
29
|
if (!this.dashboard?.uid) {
|
package/dist/types.d.ts
CHANGED
|
@@ -188,3 +188,18 @@ export interface AlertPageOptions {
|
|
|
188
188
|
*/
|
|
189
189
|
hasText?: string | RegExp;
|
|
190
190
|
}
|
|
191
|
+
export interface ContainTextOptions {
|
|
192
|
+
/**
|
|
193
|
+
* Whether to perform case-insensitive match. `ignoreCase` option takes precedence over the corresponding regular
|
|
194
|
+
* expression flag if specified.
|
|
195
|
+
*/
|
|
196
|
+
ignoreCase?: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
|
|
199
|
+
*/
|
|
200
|
+
timeout?: number;
|
|
201
|
+
/**
|
|
202
|
+
* Whether to use `element.innerText` instead of `element.textContent` when retrieving DOM node text.
|
|
203
|
+
*/
|
|
204
|
+
useInnerText?: boolean;
|
|
205
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/plugin-e2e",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"semver": "^7.5.4",
|
|
45
45
|
"uuid": "^9.0.1"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "e5eec7a28018662bec5b65e0980c3ff1fe2a358d"
|
|
48
48
|
}
|