@grafana/plugin-e2e 0.7.0 → 0.8.1
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/README.md +67 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1 +1,68 @@
|
|
|
1
1
|
# Grafana / Plugin E2E
|
|
2
|
+
|
|
3
|
+
E2E test Grafana plugins with ease.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`@grafana/plugin-e2e` is designed specifically for Grafana plugin developers. It extends [Playwright test](https://github.com/microsoft/playwright/) capabilities with fixtures, models, and expect matchers, enabling comprehensive end-to-end testing of Grafana plugins across multiple versions of Grafana. This package simplifies the testing process, ensuring your plugin is robust and compatible with various Grafana environments.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Predefined Fixtures:** Offers a set of predefined fixtures that are tailored for Grafana plugin testing.
|
|
12
|
+
- **Custom Models:** Provides custom models that represent different aspects of Grafana, making it easier to interact with the Grafana UI in tests.
|
|
13
|
+
- **Expect Matchers:** Includes a range of expect matchers that are specialized for Grafana plugin assertions, helping you validate plugin behavior more effectively.
|
|
14
|
+
- **Version Compatibility:** Ensures that your plugin is tested across multiple versions of Grafana, guaranteeing compatibility and stability.
|
|
15
|
+
- **Integration with Playwright:** Seamlessly integrates with the Playwright testing framework, leveraging its powerful browser automation capabilities.
|
|
16
|
+
|
|
17
|
+
## Getting Started
|
|
18
|
+
|
|
19
|
+
### Prerequisites
|
|
20
|
+
|
|
21
|
+
- Node.js (LTS)
|
|
22
|
+
- Basic knowledge of Playwright
|
|
23
|
+
- Grafana plugin [development environment](https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment)
|
|
24
|
+
|
|
25
|
+
### Installation
|
|
26
|
+
|
|
27
|
+
To install `@grafana/plugin-e2e`, run the following command in your project directory:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @grafana/plugin-e2e@latest --save-dev
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
To install Playwright along with the default browsers:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm init playwright@latest
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> Note: @grafana/plugin-e2e uses @playwright/test version 1.40.0 internally, so the version you install in the plugin needs to be the same or higher.
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
### Writing Tests
|
|
44
|
+
|
|
45
|
+
Here's a basic example of how to write an E2E test using `@grafana/plugin-e2e`:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { expect, test } from '@grafana/plugin-e2e';
|
|
49
|
+
|
|
50
|
+
test('query data request should return 200 when query is valid', async ({ panelEditPage }) => {
|
|
51
|
+
await panelEditPage.datasource.set('gdev-testdata');
|
|
52
|
+
const queryEditorRow = await panelEditPage.getQueryEditorRow('A');
|
|
53
|
+
await queryEditorRow.getByLabel('Labels').fill('key=value1, key2=value3');
|
|
54
|
+
await expect(panelEditPage.refreshPanel()).toBeOK();
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Running Tests
|
|
59
|
+
|
|
60
|
+
To run your tests, use the following command:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npx playwright test
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
# Contributing
|
|
67
|
+
|
|
68
|
+
We welcome contributions to @grafana/plugin-e2e. If you're interested in contributing, please read our [contributing guidelines](./CONTRIBUTING.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/plugin-e2e",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"typecheck": "tsc --emitDeclarationOnly false --noEmit",
|
|
28
28
|
"test": "jest",
|
|
29
29
|
"playwright:test": "npx playwright test",
|
|
30
|
-
"playwright:test:ui": "npx playwright test --ui"
|
|
30
|
+
"playwright:test:ui": "npx playwright test --ui",
|
|
31
|
+
"playwright:showreport": "npx playwright show-report"
|
|
31
32
|
},
|
|
32
33
|
"engines": {
|
|
33
34
|
"node": ">=20"
|
|
@@ -44,5 +45,5 @@
|
|
|
44
45
|
"semver": "^7.5.4",
|
|
45
46
|
"uuid": "^9.0.1"
|
|
46
47
|
},
|
|
47
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "b4bc4c2ebc5f604eaa3dfe271a5bcc0091389032"
|
|
48
49
|
}
|