@grafana/plugin-e2e 0.12.1 → 0.12.2

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 (51) hide show
  1. package/dist/api.d.ts +178 -0
  2. package/dist/auth/auth.setup.d.ts +1 -0
  3. package/dist/e2e-selectors/index.d.ts +2 -0
  4. package/dist/e2e-selectors/resolver.d.ts +10 -0
  5. package/dist/e2e-selectors/resolver.test.d.ts +1 -0
  6. package/dist/e2e-selectors/types.d.ts +174 -0
  7. package/dist/e2e-selectors/versioned/apis.d.ts +29 -0
  8. package/dist/e2e-selectors/versioned/components.d.ts +154 -0
  9. package/dist/e2e-selectors/versioned/constants.d.ts +1 -0
  10. package/dist/e2e-selectors/versioned/index.d.ts +2 -0
  11. package/dist/e2e-selectors/versioned/pages.d.ts +125 -0
  12. package/dist/e2e-selectors/versioned/types.d.ts +8 -0
  13. package/dist/fixtures/annotationEditPage.d.ts +7 -0
  14. package/dist/fixtures/commands/createDataSource.d.ts +8 -0
  15. package/dist/fixtures/commands/createDataSourceConfigPage.d.ts +8 -0
  16. package/dist/fixtures/commands/login.d.ts +6 -0
  17. package/dist/fixtures/commands/readProvision.d.ts +7 -0
  18. package/dist/fixtures/explorePage.d.ts +7 -0
  19. package/dist/fixtures/grafanaVersion.d.ts +4 -0
  20. package/dist/fixtures/index.d.ts +16 -0
  21. package/dist/fixtures/isFeatureToggleEnabled.d.ts +6 -0
  22. package/dist/fixtures/newDashboardPage.d.ts +7 -0
  23. package/dist/fixtures/page.d.ts +17 -0
  24. package/dist/fixtures/panelEditPage.d.ts +7 -0
  25. package/dist/fixtures/scripts/overrideFeatureToggles.d.ts +1 -0
  26. package/dist/fixtures/selectors.d.ts +7 -0
  27. package/dist/fixtures/types.d.ts +2 -0
  28. package/dist/fixtures/variableEditPage.d.ts +7 -0
  29. package/dist/index.d.ts +35 -0
  30. package/dist/matchers/index.d.ts +25 -0
  31. package/dist/matchers/toBeOK.d.ts +11 -0
  32. package/dist/matchers/toDisplayPreviews.d.ts +12 -0
  33. package/dist/matchers/toHaveAlert.d.ts +8 -0
  34. package/dist/matchers/utils.d.ts +1 -0
  35. package/dist/models/AnnotationEditPage.d.ts +18 -0
  36. package/dist/models/AnnotationPage.d.ts +16 -0
  37. package/dist/models/DashboardPage.d.ts +33 -0
  38. package/dist/models/DataSourceConfigPage.d.ts +23 -0
  39. package/dist/models/DataSourcePicker.d.ts +9 -0
  40. package/dist/models/ExplorePage.d.ts +26 -0
  41. package/dist/models/GrafanaPage.d.ts +43 -0
  42. package/dist/models/Panel.d.ts +12 -0
  43. package/dist/models/PanelEditPage.d.ts +55 -0
  44. package/dist/models/TimeRange.d.ts +9 -0
  45. package/dist/models/VariableEditPage.d.ts +26 -0
  46. package/dist/models/VariablePage.d.ts +16 -0
  47. package/dist/models/index.d.ts +8 -0
  48. package/dist/options/index.d.ts +4 -0
  49. package/dist/selectorEngine.d.ts +7 -0
  50. package/dist/types.d.ts +228 -0
  51. package/package.json +2 -2
@@ -0,0 +1,228 @@
1
+ import { Locator, PlaywrightTestArgs, Response } from '@playwright/test';
2
+ import { E2ESelectors } from './e2e-selectors/types';
3
+ /**
4
+ * The context object passed to page object models
5
+ */
6
+ export type PluginTestCtx = {
7
+ grafanaVersion: string;
8
+ selectors: E2ESelectors;
9
+ } & Pick<PlaywrightTestArgs, 'page' | 'request'>;
10
+ /**
11
+ * The data source object
12
+ */
13
+ export interface DataSource<T = any> {
14
+ id: number;
15
+ editable?: boolean;
16
+ uid: string;
17
+ orgId?: number;
18
+ name?: string;
19
+ type: string;
20
+ access?: string;
21
+ url?: string;
22
+ database?: string;
23
+ isDefault?: boolean;
24
+ jsonData?: T;
25
+ secureJsonData?: T;
26
+ }
27
+ /**
28
+ * The dashboard object
29
+ */
30
+ export interface Dashboard {
31
+ uid: string;
32
+ title?: string;
33
+ }
34
+ /**
35
+ * The YAML provision file parsed to a javascript object
36
+ */
37
+ export type ProvisionFile<T = DataSource> = {
38
+ datasources: Array<DataSource<T>>;
39
+ };
40
+ export type CreateDataSourceArgs<T = any> = {
41
+ /**
42
+ * The data source to create
43
+ */
44
+ id?: number;
45
+ editable?: boolean;
46
+ uid?: string;
47
+ orgId?: number;
48
+ name?: string;
49
+ type: string;
50
+ access?: string;
51
+ url?: string;
52
+ database?: string;
53
+ isDefault?: boolean;
54
+ jsonData?: T;
55
+ secureJsonData?: T;
56
+ };
57
+ export type CreateDataSourcePageArgs = {
58
+ /**
59
+ * The data source type to create
60
+ */
61
+ type: string;
62
+ /**
63
+ * The data source name to create
64
+ */
65
+ name?: string;
66
+ /**
67
+ * Set this to false to delete the data source via Grafana API after the test. Defaults to true.
68
+ */
69
+ deleteDataSourceAfterTest?: boolean;
70
+ };
71
+ export type RequestOptions = {
72
+ /**
73
+ * Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can
74
+ * be changed by using the
75
+ * [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
76
+ * or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
77
+ */
78
+ timeout?: number;
79
+ waitForResponsePredicateCallback?: string | RegExp | ((response: Response) => boolean | Promise<boolean>);
80
+ };
81
+ export interface TimeRangeArgs {
82
+ /**
83
+ * The from time
84
+ * @example 'now-6h'
85
+ * @example '2020-01-01 00:00:00'
86
+ */
87
+ from: string;
88
+ /**
89
+ * The to time
90
+ * @example 'now'
91
+ * @example '2020-01-01 00:00:00'
92
+ */
93
+ to: string;
94
+ /**
95
+ * The time zone
96
+ * @example 'utc'
97
+ * @example 'browser'
98
+ */
99
+ zone?: string;
100
+ }
101
+ export type DashboardPageArgs = {
102
+ /**
103
+ * The uid of the dashboard to go to
104
+ */
105
+ uid?: string;
106
+ /**
107
+ * The time range to set
108
+ */
109
+ timeRange?: TimeRangeArgs;
110
+ /**
111
+ * Query parameters to add to the url
112
+ */
113
+ queryParams?: URLSearchParams;
114
+ };
115
+ /**
116
+ * DashboardEditViewArgs is used to pass arguments to the page object models that represent a dashboard edit view,
117
+ * such as {@link PanelEditPage}, {@link VariableEditPage} and {@link AnnotationEditPage}.
118
+ *
119
+ * If dashboard is not specified, it's assumed that it's a new dashboard. Otherwise, the dashboard uid is used to
120
+ * navigate to an already existing dashboard.
121
+ */
122
+ export type DashboardEditViewArgs<T> = {
123
+ dashboard?: DashboardPageArgs;
124
+ id: T;
125
+ };
126
+ export type ReadProvisionArgs = {
127
+ /**
128
+ * The path, relative to the provisioning folder, to the dashboard json file
129
+ */
130
+ filePath: string;
131
+ };
132
+ export type NavigateOptions = {
133
+ /**
134
+ * Referer header value.
135
+ */
136
+ referer?: string;
137
+ /**
138
+ * Maximum operation time in milliseconds. Defaults to `0` - no timeout.
139
+ */
140
+ timeout?: number;
141
+ /**
142
+ * When to consider operation succeeded, defaults to `load`. Events can be either:
143
+ * - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
144
+ * - `'load'` - consider operation to be finished when the `load` event is fired.
145
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
146
+ * at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
147
+ * - `'commit'` - consider operation to be finished when network response is received and the document started
148
+ * loading.
149
+ */
150
+ waitUntil?: 'load' | 'domcontentloaded' | 'networkidle' | 'commit';
151
+ /**
152
+ * Query parameters to add to the url. Optional
153
+ */
154
+ queryParams?: URLSearchParams;
155
+ };
156
+ export type GetByTestIdOrAriaLabelOptions = {
157
+ /**
158
+ *Optional root locator to search within. If no locator is provided, the page will be used
159
+ */
160
+ root?: Locator;
161
+ /**
162
+ * Set to true to find locator that resolves elements that starts with a given string
163
+ * Defaults to false
164
+ */
165
+ startsWith?: boolean;
166
+ };
167
+ export type TriggerQueryOptions = {
168
+ /**
169
+ * Set this to true to skip waiting for the response. Defaults to false.
170
+ */
171
+ skipWaitForResponse: boolean;
172
+ };
173
+ /**
174
+ * Panel visualization types
175
+ */
176
+ export type Visualization = 'Alert list' | 'Bar gauge' | 'Clock' | 'Dashboard list' | 'Gauge' | 'Graph' | 'Heatmap' | 'Logs' | 'News' | 'Pie Chart' | 'Plugin list' | 'Polystat' | 'Stat' | 'Table' | 'Text' | 'Time series' | 'Worldmap Panel';
177
+ export type AlertVariant = 'success' | 'warning' | 'error' | 'info';
178
+ export interface AlertPageOptions {
179
+ /**
180
+ * Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can
181
+ * be changed by using the
182
+ * [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
183
+ * or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
184
+ */
185
+ timeout?: number;
186
+ /**
187
+ * Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer
188
+ * one. For example, `article` that has `text=Playwright` matches `<article><div>Playwright</div></article>`.
189
+ *
190
+ * Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@link
191
+ * FrameLocator}s.
192
+ */
193
+ has?: Locator;
194
+ /**
195
+ * Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the
196
+ * outer one. For example, `article` that does not have `div` matches `<article><span>Playwright</span></article>`.
197
+ *
198
+ * Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@link
199
+ * FrameLocator}s.
200
+ */
201
+ hasNot?: Locator;
202
+ /**
203
+ * Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element.
204
+ * When passed a [string], matching is case-insensitive and searches for a substring.
205
+ */
206
+ hasNotText?: string | RegExp;
207
+ /**
208
+ * Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When
209
+ * passed a [string], matching is case-insensitive and searches for a substring. For example, `"Playwright"` matches
210
+ * `<article><div>Playwright</div></article>`.
211
+ */
212
+ hasText?: string | RegExp;
213
+ }
214
+ export interface ContainTextOptions {
215
+ /**
216
+ * Whether to perform case-insensitive match. `ignoreCase` option takes precedence over the corresponding regular
217
+ * expression flag if specified.
218
+ */
219
+ ignoreCase?: boolean;
220
+ /**
221
+ * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
222
+ */
223
+ timeout?: number;
224
+ /**
225
+ * Whether to use `element.innerText` instead of `element.textContent` when retrieving DOM node text.
226
+ */
227
+ useInnerText?: boolean;
228
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-e2e",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -45,5 +45,5 @@
45
45
  "semver": "^7.5.4",
46
46
  "uuid": "^9.0.1"
47
47
  },
48
- "gitHead": "87daa3381c7b43ce74ade6bee586acb4b3970494"
48
+ "gitHead": "675394845844dbffe2bfb12156ab3ed5b70ac996"
49
49
  }