Skip to content

Commit 9b8ef2a

Browse files
committed
Migration VI
* Updated DEVELOPMENT.md * Fixed typos and whitespaces * Added missing prettier-plugin-sort-imports plugin
1 parent a5394ac commit 9b8ef2a

24 files changed

+344
-136
lines changed

.prettierrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
module.exports = {
22
// Prettier configuration provided by Grafana scaffolding
33
...require('./.config/.prettierrc.js'),
4+
plugins: ['@trivago/prettier-plugin-sort-imports'],
5+
importOrder: ['^components/(.*)$', '^[./]'],
6+
importOrderSeparation: true,
7+
importOrderSortSpecifiers: true,
48
};

DEVELOPMENT.md

Lines changed: 61 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ you are looking to use the plugin please head over to [README.md](README.md).
88
1. Install dependencies
99

1010
```BASH
11-
yarn install --immutable
11+
npm ci
1212
```
1313

1414
2. Build plugin in development mode or run in watch mode
1515

1616
```BASH
17-
yarn dev
17+
npm run dev
1818
```
1919

2020
3. Build plugin in production mode
2121

2222
```BASH
23-
yarn build
23+
npm run build
2424
```
2525

2626
## Maintenance
2727

2828
Code formatting
2929

3030
```BASH
31-
yarn pretty
31+
npm run pretty
3232
```
3333

3434
Update dependencies
@@ -37,11 +37,9 @@ https://grafana.com/developers/plugin-tools/migration-guides/update-create-plugi
3737

3838
```BASH
3939
npx @grafana/create-plugin@latest update
40-
yarn install
41-
yarn upgrade
42-
yarn pretty
43-
cd tests
44-
yarn upgrade
40+
npm install
41+
npx npm-check-updates -i --format group
42+
npm run pretty
4543
```
4644

4745
## Release
@@ -57,52 +55,85 @@ yarn upgrade
5755
## E2E Tests
5856

5957
There are serval ways to run the e2e tests.
60-
Make sure to have an up to date `dist/` folder using `yarn build`.
58+
Make sure to have an up to date `dist/` folder using `npm run build`.
59+
60+
### No Interactivity use case (e.g. CI)
61+
62+
```BASH
63+
cd tests/
64+
docker compose up --exit-code-from=playwright
65+
```
66+
67+
This will run all tests without any further interaction necessary.
68+
6169

6270
### Local development use case
6371

72+
Please, note that you need to set serval environment variables as described for [No docker use case](#No-docker-use-case)
73+
6474
```BASH
6575
cd tests/
6676
docker compose up -d checkmk grafana
67-
yarn run cypress open
77+
cd ..
78+
npm run e2e
6879
```
6980

70-
This will show you a nice interactive GUI to run and debug your E2E tests.
71-
See the official [docs](https://docs.cypress.io/guides/overview/why-cypress) for more information.
81+
You can run the tests on the console by runing
7282

73-
### No Interactivity use case (e.g. CI)
83+
```BASH
84+
npm run e2e
85+
86+
# Or you can run it in debug mode
87+
npm run e2e:debug
88+
```
89+
90+
Or you can launch a nice interactive GUI to run and debug your E2E tests
91+
by running
7492

7593
```BASH
76-
cd tests/
77-
docker compose up --exit-code-from=cypress
94+
npm run e2e:gui
7895
```
7996

80-
This will run all tests without any further interaction necessary.
97+
See the official [docs](https://playwright.dev/docs/intro) for more information.
8198

8299
### No docker use case
83100

84101
If you don't want to or can't use docker at all, make sure you have a Grafana and a CheckMK instance running somewhere.
85102
The Plugin you want to test needs to be installed in you Grafana instance.
86103

87-
You also need to set serval environment variables.
104+
First you need to install the Playwright dependencies:
105+
```BASH
106+
npx playwright install --with-deps
107+
```
108+
109+
You also need to set serval environment variables. You can export them or define them in a .env file
110+
111+
| Variable | Description | Example |
112+
| --------------------------- | ----------------------------------------------- | ---------------------------- |
113+
| CMK_SITE | Checkmk site name | cmk |
114+
| CMK_ADMIN | Administrator user name for Checkmk | cmkadmin |
115+
| CMK_AUTOMATION | Automation user name for Checkmk | automation |
116+
| CMK_PASSWORD | Password CMK_ADMIN and CMK_AUTOMATION | my_secret |
117+
| PLAYWRIGHT_TO_CHECKMK_URL | URL for connecting Playwright to Checkmk | http://127.0.0.1:12345/cmk/ |
118+
| PLAYWRIGHT_TO_GRAFANA_URL | URL for connecting Playwright to Grafana | http://127.0.0.1:3003/ |
119+
| GRAFANA_USER | User name for connecting to Grafana's Rest API | grafana_user |
120+
| GRAFANA_PASSWORD | Password for GRAFANA_USERNAME | my_other_secret |
121+
| GRAFANA_TO_CHECKMK_URL | URL for connecting Grafana to Checkmk | http://checkmk:5000/cmk/ |
122+
| GRAFANA_TO_CHECKMK_USER | Checkmk user name to access the Rest API | automation |
123+
| GRAFANA_TO_CHECKMK_PASSWORD | Password for GRAFANA_TO_CHECKMK_USER | my_secret |
88124

89-
| Variable | Description |
90-
| --------------------------- | -------------------------------------------- |
91-
| CYPRESS_baseUrl | The URL to your Grafana instance |
92-
| CYPRESS_grafanaUsername | The username used to log into Grafana |
93-
| CYPRESS_grafanaPassword | the password used to log into Grafana |
94-
| CYPRESS_grafanaToCheckmkUrl | The url from which grafana can reach CheckMK |
95-
| CYPRESS_cypressToCheckmkUrl | The url from which cypress can reach CheckMK |
96-
| CYPRESS_cmkUsername | The username of a CheckMK admin |
97-
| CYPRESS_cmkPassword | The password of that CheckMK admin |
98125

99126
If everything is set up, just start cypress the usual way.
100127

101128
```BASH
102-
yarn run cypress open
129+
# Automatic run
130+
npm run e2e
131+
132+
# or if you want to run it on debug mode
133+
npm run e2e:debug
103134

104-
# or if you just want to see the results
105-
yarn run cypress run
135+
# or if you want to run it with the fancy web interface
136+
npm run e2e:gui
106137
```
107138

108139
Please note that the test have side effects on your Grafana and CheckMK instance,

0 commit comments

Comments
 (0)