@grafana/create-plugin 4.5.0-canary.847.e7bd94b.0 → 4.5.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/CHANGELOG.md +84 -0
- package/dist/commands/generate/print-success-message.js +3 -1
- package/dist/commands/generate.command.js +0 -2
- package/dist/utils/tests/utils.templates.test.js +1 -5
- package/dist/utils/utils.packageManager.js +1 -1
- package/dist/utils/utils.templates.js +0 -9
- package/package.json +2 -2
- package/src/commands/generate/print-success-message.ts +3 -1
- package/src/commands/generate.command.ts +1 -5
- package/src/types.ts +0 -2
- package/src/utils/tests/utils.templates.test.ts +1 -5
- package/src/utils/utils.packageManager.ts +1 -1
- package/src/utils/utils.templates.ts +0 -9
- package/templates/common/.config/Dockerfile +19 -8
- package/templates/common/.config/entrypoint.sh +8 -0
- package/templates/common/.config/supervisord/supervisord.conf +4 -0
- package/templates/common/_package.json +4 -4
- package/templates/common/cypress/integration/01-smoke.spec.ts +10 -0
- package/templates/common/cypress.json +3 -0
- package/templates/common/docker-compose.yaml +0 -1
- package/templates/common/gitignore +4 -8
- package/templates/github/ci/.github/workflows/ci.yml +3 -16
- package/templates/common/playwright.config.ts +0 -51
- package/templates/common/tests/smoke.spec.ts +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
1
|
+
# v4.5.0 (Fri Apr 05 2024)
|
|
2
|
+
|
|
3
|
+
#### 🚀 Enhancement
|
|
4
|
+
|
|
5
|
+
- Create Plugins: Add feature to toggle docker development environment [#857](https://github.com/grafana/plugin-tools/pull/857) ([@oshirohugo](https://github.com/oshirohugo))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Hugo Kiyodi Oshiro ([@oshirohugo](https://github.com/oshirohugo))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# v4.4.6 (Wed Apr 03 2024)
|
|
14
|
+
|
|
15
|
+
#### 🐛 Bug Fix
|
|
16
|
+
|
|
17
|
+
- Plugin E2E: Fix APIs that are broken in older versions of Grafana [#739](https://github.com/grafana/plugin-tools/pull/739) ([@sunker](https://github.com/sunker))
|
|
18
|
+
|
|
19
|
+
#### Authors: 1
|
|
20
|
+
|
|
21
|
+
- Erik Sundell ([@sunker](https://github.com/sunker))
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# v4.4.5 (Tue Apr 02 2024)
|
|
26
|
+
|
|
27
|
+
#### 🐛 Bug Fix
|
|
28
|
+
|
|
29
|
+
- Create Plugins: Remove unused env variable [#850](https://github.com/grafana/plugin-tools/pull/850) ([@oshirohugo](https://github.com/oshirohugo))
|
|
30
|
+
|
|
31
|
+
#### Authors: 1
|
|
32
|
+
|
|
33
|
+
- Hugo Kiyodi Oshiro ([@oshirohugo](https://github.com/oshirohugo))
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
# v4.4.4 (Thu Mar 28 2024)
|
|
38
|
+
|
|
39
|
+
#### 🐛 Bug Fix
|
|
40
|
+
|
|
41
|
+
- Create Plugin: Fix hardcoded path [#846](https://github.com/grafana/plugin-tools/pull/846) ([@oshirohugo](https://github.com/oshirohugo))
|
|
42
|
+
|
|
43
|
+
#### Authors: 1
|
|
44
|
+
|
|
45
|
+
- Hugo Kiyodi Oshiro ([@oshirohugo](https://github.com/oshirohugo))
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
# v4.4.3 (Thu Mar 28 2024)
|
|
50
|
+
|
|
51
|
+
#### 🐛 Bug Fix
|
|
52
|
+
|
|
53
|
+
- Create Plugin: Update default yarn version to 1.22.22 [#839](https://github.com/grafana/plugin-tools/pull/839) ([@jackw](https://github.com/jackw))
|
|
54
|
+
|
|
55
|
+
#### Authors: 1
|
|
56
|
+
|
|
57
|
+
- Jack Westbrook ([@jackw](https://github.com/jackw))
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
# v4.4.2 (Thu Mar 28 2024)
|
|
62
|
+
|
|
63
|
+
#### 🐛 Bug Fix
|
|
64
|
+
|
|
65
|
+
- Create Plugin: Fix grafana running without plugin backend [#844](https://github.com/grafana/plugin-tools/pull/844) ([@oshirohugo](https://github.com/oshirohugo))
|
|
66
|
+
|
|
67
|
+
#### Authors: 1
|
|
68
|
+
|
|
69
|
+
- Hugo Kiyodi Oshiro ([@oshirohugo](https://github.com/oshirohugo))
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
# v4.4.1 (Wed Mar 27 2024)
|
|
74
|
+
|
|
75
|
+
#### 🐛 Bug Fix
|
|
76
|
+
|
|
77
|
+
- Create-Plugin: Improve commands intructions [#843](https://github.com/grafana/plugin-tools/pull/843) ([@oshirohugo](https://github.com/oshirohugo))
|
|
78
|
+
|
|
79
|
+
#### Authors: 1
|
|
80
|
+
|
|
81
|
+
- Hugo Kiyodi Oshiro ([@oshirohugo](https://github.com/oshirohugo))
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
1
85
|
# v4.4.0 (Tue Mar 26 2024)
|
|
2
86
|
|
|
3
87
|
#### 🐛 Bug Fix
|
|
@@ -14,7 +14,9 @@ export function printGenerateSuccessMessage(answers) {
|
|
|
14
14
|
]
|
|
15
15
|
: []),
|
|
16
16
|
'- `docker-compose up` to start a grafana development server. ' +
|
|
17
|
-
(answers.hasBackend
|
|
17
|
+
(answers.hasBackend
|
|
18
|
+
? 'The plugin backend will be reloaded on every code change and a debugger can be attached on port `2345`.'
|
|
19
|
+
: ''),
|
|
18
20
|
'- Open http://localhost:3000 in your browser to create a dashboard to begin developing your plugin.',
|
|
19
21
|
];
|
|
20
22
|
const msg = `\n# Congratulations on scaffolding a Grafana ${answers.pluginType} plugin! 🚀
|
|
@@ -60,8 +60,6 @@ function getTemplateData(answers) {
|
|
|
60
60
|
bundleGrafanaUI: features.bundleGrafanaUI ?? DEFAULT_FEATURE_FLAGS.bundleGrafanaUI,
|
|
61
61
|
useReactRouterV6,
|
|
62
62
|
reactRouterVersion: useReactRouterV6 ? '6.22.0' : '5.2.0',
|
|
63
|
-
e2eTestCmd: 'playwright test',
|
|
64
|
-
e2eTestUpdateCmd: 'playwright test --update-snapshots',
|
|
65
63
|
};
|
|
66
64
|
return templateData;
|
|
67
65
|
}
|
|
@@ -17,11 +17,7 @@ describe('Utils / Templates', () => {
|
|
|
17
17
|
expect(templateFiles.length).toBe(0);
|
|
18
18
|
});
|
|
19
19
|
test('should be possible to filter for multiple different files', () => {
|
|
20
|
-
const templateFiles = getTemplateFiles(PLUGIN_TYPES.app, [
|
|
21
|
-
'.prettierrc.js',
|
|
22
|
-
'playwright.config.ts',
|
|
23
|
-
'tsconfig.json',
|
|
24
|
-
]);
|
|
20
|
+
const templateFiles = getTemplateFiles(PLUGIN_TYPES.app, ['.prettierrc.js', 'cypress.json', 'tsconfig.json']);
|
|
25
21
|
expect(Array.isArray(templateFiles)).toBe(true);
|
|
26
22
|
expect(templateFiles.length).toBe(3);
|
|
27
23
|
});
|
|
@@ -6,7 +6,7 @@ const NPM_LOCKFILE = 'package-lock.json';
|
|
|
6
6
|
const PNPM_LOCKFILE = 'pnpm-lock.yaml';
|
|
7
7
|
const YARN_LOCKFILE = 'yarn.lock';
|
|
8
8
|
const SUPPORTED_PACKAGE_MANAGERS = ['npm', 'yarn', 'pnpm'];
|
|
9
|
-
const DEFAULT_PACKAGE_MANAGER = { packageManagerName: 'yarn', packageManagerVersion: '1.22.
|
|
9
|
+
const DEFAULT_PACKAGE_MANAGER = { packageManagerName: 'yarn', packageManagerVersion: '1.22.22' };
|
|
10
10
|
export function getPackageManagerFromUserAgent() {
|
|
11
11
|
const agent = process.env.npm_config_user_agent;
|
|
12
12
|
if (!agent) {
|
|
@@ -61,13 +61,6 @@ export function getTemplateData() {
|
|
|
61
61
|
const useReactRouterV6 = features.useReactRouterV6 === true && pluginJson.type === PLUGIN_TYPES.app;
|
|
62
62
|
const { packageManagerName, packageManagerVersion } = getPackageManagerWithFallback();
|
|
63
63
|
const packageManagerInstallCmd = getPackageManagerInstallCmd(packageManagerName);
|
|
64
|
-
const hasPlaywright = isFile(path.join(process.cwd(), 'playwright.config.ts'));
|
|
65
|
-
const e2eTestCmd = hasPlaywright
|
|
66
|
-
? 'playwright test'
|
|
67
|
-
: `${packageManagerName} exec cypress install && ${packageManagerName} exec grafana-e2e run`;
|
|
68
|
-
const e2eTestUpdateCmd = hasPlaywright
|
|
69
|
-
? 'playwright test --update-snapshots'
|
|
70
|
-
: `${packageManagerName} exec cypress install && ${packageManagerName} exec grafana-e2e run --update-screenshots`;
|
|
71
64
|
const templateData = {
|
|
72
65
|
...EXTRA_TEMPLATE_VARIABLES,
|
|
73
66
|
pluginId: pluginJson.id,
|
|
@@ -85,8 +78,6 @@ export function getTemplateData() {
|
|
|
85
78
|
bundleGrafanaUI: features.bundleGrafanaUI ?? DEFAULT_FEATURE_FLAGS.bundleGrafanaUI,
|
|
86
79
|
useReactRouterV6: useReactRouterV6,
|
|
87
80
|
reactRouterVersion: useReactRouterV6 ? '6.22.0' : '5.2.0',
|
|
88
|
-
e2eTestCmd,
|
|
89
|
-
e2eTestUpdateCmd,
|
|
90
81
|
};
|
|
91
82
|
debug('\nTemplate data:\n' + JSON.stringify(templateData, null, 2));
|
|
92
83
|
return templateData;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "4.5.0
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"directory": "packages/create-plugin",
|
|
6
6
|
"url": "https://github.com/grafana/plugin-tools"
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"engines": {
|
|
88
88
|
"node": ">=20"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "79b462dd77503ddb597debb3575a90e43316c865"
|
|
91
91
|
}
|
|
@@ -16,7 +16,9 @@ export function printGenerateSuccessMessage(answers: CliArgs) {
|
|
|
16
16
|
]
|
|
17
17
|
: []),
|
|
18
18
|
'- `docker-compose up` to start a grafana development server. ' +
|
|
19
|
-
(answers.hasBackend
|
|
19
|
+
(answers.hasBackend
|
|
20
|
+
? 'The plugin backend will be reloaded on every code change and a debugger can be attached on port `2345`.'
|
|
21
|
+
: ''),
|
|
20
22
|
'- Open http://localhost:3000 in your browser to create a dashboard to begin developing your plugin.',
|
|
21
23
|
];
|
|
22
24
|
|
|
@@ -59,9 +59,7 @@ function getTemplateData(answers: CliArgs) {
|
|
|
59
59
|
const { packageManagerName, packageManagerVersion } = getPackageManagerFromUserAgent();
|
|
60
60
|
const packageManagerInstallCmd = getPackageManagerInstallCmd(packageManagerName);
|
|
61
61
|
const isAppType = pluginType === PLUGIN_TYPES.app || pluginType === PLUGIN_TYPES.scenes;
|
|
62
|
-
// We don't enable this by default yet for new scenes plugins.
|
|
63
|
-
const useReactRouterV6 = features.useReactRouterV6 === true && pluginType === PLUGIN_TYPES.app;
|
|
64
|
-
|
|
62
|
+
const useReactRouterV6 = features.useReactRouterV6 === true && pluginType === PLUGIN_TYPES.app; // We don't enable this by default yet for new scenes plugins.
|
|
65
63
|
const templateData: TemplateData = {
|
|
66
64
|
...answers,
|
|
67
65
|
pluginId,
|
|
@@ -74,8 +72,6 @@ function getTemplateData(answers: CliArgs) {
|
|
|
74
72
|
bundleGrafanaUI: features.bundleGrafanaUI ?? DEFAULT_FEATURE_FLAGS.bundleGrafanaUI,
|
|
75
73
|
useReactRouterV6,
|
|
76
74
|
reactRouterVersion: useReactRouterV6 ? '6.22.0' : '5.2.0',
|
|
77
|
-
e2eTestCmd: 'playwright test',
|
|
78
|
-
e2eTestUpdateCmd: 'playwright test --update-snapshots',
|
|
79
75
|
};
|
|
80
76
|
|
|
81
77
|
return templateData;
|
package/src/types.ts
CHANGED
|
@@ -28,11 +28,7 @@ describe('Utils / Templates', () => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
test('should be possible to filter for multiple different files', () => {
|
|
31
|
-
const templateFiles = getTemplateFiles(PLUGIN_TYPES.app, [
|
|
32
|
-
'.prettierrc.js',
|
|
33
|
-
'playwright.config.ts',
|
|
34
|
-
'tsconfig.json',
|
|
35
|
-
]);
|
|
31
|
+
const templateFiles = getTemplateFiles(PLUGIN_TYPES.app, ['.prettierrc.js', 'cypress.json', 'tsconfig.json']);
|
|
36
32
|
|
|
37
33
|
expect(Array.isArray(templateFiles)).toBe(true);
|
|
38
34
|
expect(templateFiles.length).toBe(3);
|
|
@@ -7,7 +7,7 @@ const NPM_LOCKFILE = 'package-lock.json';
|
|
|
7
7
|
const PNPM_LOCKFILE = 'pnpm-lock.yaml';
|
|
8
8
|
const YARN_LOCKFILE = 'yarn.lock';
|
|
9
9
|
const SUPPORTED_PACKAGE_MANAGERS = ['npm', 'yarn', 'pnpm'];
|
|
10
|
-
const DEFAULT_PACKAGE_MANAGER = { packageManagerName: 'yarn', packageManagerVersion: '1.22.
|
|
10
|
+
const DEFAULT_PACKAGE_MANAGER = { packageManagerName: 'yarn', packageManagerVersion: '1.22.22' };
|
|
11
11
|
|
|
12
12
|
export type PackageManager = {
|
|
13
13
|
packageManagerName: string;
|
|
@@ -95,13 +95,6 @@ export function getTemplateData(): TemplateData {
|
|
|
95
95
|
const useReactRouterV6 = features.useReactRouterV6 === true && pluginJson.type === PLUGIN_TYPES.app;
|
|
96
96
|
const { packageManagerName, packageManagerVersion } = getPackageManagerWithFallback();
|
|
97
97
|
const packageManagerInstallCmd = getPackageManagerInstallCmd(packageManagerName);
|
|
98
|
-
const hasPlaywright = isFile(path.join(process.cwd(), 'playwright.config.ts'));
|
|
99
|
-
const e2eTestCmd = hasPlaywright
|
|
100
|
-
? 'playwright test'
|
|
101
|
-
: `${packageManagerName} exec cypress install && ${packageManagerName} exec grafana-e2e run`;
|
|
102
|
-
const e2eTestUpdateCmd = hasPlaywright
|
|
103
|
-
? 'playwright test --update-snapshots'
|
|
104
|
-
: `${packageManagerName} exec cypress install && ${packageManagerName} exec grafana-e2e run --update-screenshots`;
|
|
105
98
|
|
|
106
99
|
const templateData = {
|
|
107
100
|
...EXTRA_TEMPLATE_VARIABLES,
|
|
@@ -120,8 +113,6 @@ export function getTemplateData(): TemplateData {
|
|
|
120
113
|
bundleGrafanaUI: features.bundleGrafanaUI ?? DEFAULT_FEATURE_FLAGS.bundleGrafanaUI,
|
|
121
114
|
useReactRouterV6: useReactRouterV6,
|
|
122
115
|
reactRouterVersion: useReactRouterV6 ? '6.22.0' : '5.2.0',
|
|
123
|
-
e2eTestCmd,
|
|
124
|
-
e2eTestUpdateCmd,
|
|
125
116
|
};
|
|
126
117
|
|
|
127
118
|
debug('\nTemplate data:\n' + JSON.stringify(templateData, null, 2));
|
|
@@ -3,11 +3,15 @@ ARG grafana_image=grafana-enterprise
|
|
|
3
3
|
|
|
4
4
|
FROM grafana/${grafana_image}:${grafana_version}
|
|
5
5
|
|
|
6
|
+
ARG development=true
|
|
7
|
+
|
|
6
8
|
{{#if hasBackend}}
|
|
7
9
|
ARG GO_VERSION=1.21.6
|
|
8
10
|
ARG GO_ARCH=amd64
|
|
9
11
|
{{/if}}
|
|
10
12
|
|
|
13
|
+
ENV DEV "${development}"
|
|
14
|
+
|
|
11
15
|
# Make it as simple as possible to access the grafana instance for development purposes
|
|
12
16
|
# Do NOT enable these settings in a public facing / production grafana instance
|
|
13
17
|
ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin"
|
|
@@ -24,10 +28,10 @@ WORKDIR $GF_PATHS_HOME
|
|
|
24
28
|
|
|
25
29
|
USER root
|
|
26
30
|
|
|
27
|
-
|
|
28
31
|
# Installing supervisor and inotify-tools
|
|
29
|
-
RUN if
|
|
30
|
-
|
|
32
|
+
RUN if [ "${development}" = "true" ]; then \
|
|
33
|
+
if grep -i -q alpine /etc/issue; then \
|
|
34
|
+
apk add supervisor inotify-tools git; \
|
|
31
35
|
elif grep -i -q ubuntu /etc/issue; then \
|
|
32
36
|
DEBIAN_FRONTEND=noninteractive && \
|
|
33
37
|
apt-get update && \
|
|
@@ -35,6 +39,7 @@ RUN if grep -i -q alpine /etc/issue; then \
|
|
|
35
39
|
rm -rf /var/lib/apt/lists/*; \
|
|
36
40
|
else \
|
|
37
41
|
echo 'ERROR: Unsupported base image' && /bin/false; \
|
|
42
|
+
fi \
|
|
38
43
|
fi
|
|
39
44
|
|
|
40
45
|
COPY supervisord/supervisord.conf /etc/supervisor.d/supervisord.ini
|
|
@@ -43,20 +48,26 @@ COPY supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
|
|
43
48
|
|
|
44
49
|
{{#if hasBackend}}
|
|
45
50
|
# Installing Go
|
|
46
|
-
RUN
|
|
51
|
+
RUN if [ "${development}" = "true" ]; then \
|
|
52
|
+
curl -O -L https://golang.org/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \
|
|
47
53
|
rm -rf /usr/local/go && \
|
|
48
54
|
tar -C /usr/local -xzf go${GO_VERSION}.linux-${GO_ARCH}.tar.gz && \
|
|
49
55
|
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bashrc && \
|
|
50
|
-
rm -f go${GO_VERSION}.linux-${GO_ARCH}.tar.gz
|
|
56
|
+
rm -f go${GO_VERSION}.linux-${GO_ARCH}.tar.gz; \
|
|
57
|
+
fi
|
|
51
58
|
|
|
52
59
|
# Installing delve for debugging
|
|
53
|
-
RUN
|
|
60
|
+
RUN if [ "${development}" = "true" ]; then \
|
|
61
|
+
/usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest; \
|
|
62
|
+
fi
|
|
54
63
|
|
|
55
64
|
# Installing mage for plugin (re)building
|
|
56
|
-
RUN
|
|
65
|
+
RUN if [ "${development}" = "true" ]; then \
|
|
66
|
+
git clone https://github.com/magefile/mage; \
|
|
57
67
|
cd mage; \
|
|
58
68
|
export PATH=$PATH:/usr/local/go/bin; \
|
|
59
|
-
go run bootstrap.go
|
|
69
|
+
go run bootstrap.go; \
|
|
70
|
+
fi
|
|
60
71
|
{{/if}}
|
|
61
72
|
|
|
62
73
|
# Inject livereload script into grafana index.html
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
|
|
3
|
+
if [ "${DEV}" = "false" ]; then
|
|
4
|
+
echo "Starting test mode"
|
|
5
|
+
exec /run.sh
|
|
6
|
+
fi
|
|
7
|
+
|
|
8
|
+
echo "Starting development mode"
|
|
9
|
+
|
|
3
10
|
if grep -i -q alpine /etc/issue; then
|
|
4
11
|
exec /usr/bin/supervisord -c /etc/supervisord.conf
|
|
5
12
|
elif grep -i -q ubuntu /etc/issue; then
|
|
@@ -8,3 +15,4 @@ else
|
|
|
8
15
|
echo 'ERROR: Unsupported base image'
|
|
9
16
|
exit 1
|
|
10
17
|
fi
|
|
18
|
+
|
|
@@ -5,7 +5,11 @@ user=root
|
|
|
5
5
|
[program:grafana]
|
|
6
6
|
user=root
|
|
7
7
|
directory=/var/lib/grafana
|
|
8
|
+
{{#if hasBackend}}
|
|
9
|
+
command=bash -c 'while [ ! -f /root/{{ pluginId }}/dist/gpx_{{ snakeCase pluginName }}* ]; do sleep 1; done; /run.sh'
|
|
10
|
+
{{else}}
|
|
8
11
|
command=/run.sh
|
|
12
|
+
{{/if}}
|
|
9
13
|
stdout_logfile=/dev/fd/1
|
|
10
14
|
stdout_logfile_maxbytes=0
|
|
11
15
|
redirect_stderr=true
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"typecheck": "tsc --noEmit",
|
|
11
11
|
"lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx .",
|
|
12
12
|
"lint:fix": "{{ packageManagerName }} run lint{{#if isNPM}} --{{/if}} --fix",
|
|
13
|
-
"e2e": "{{
|
|
14
|
-
"e2e:update": "{{
|
|
13
|
+
"e2e": "{{ packageManagerName }} exec cypress install && {{ packageManagerName }} exec grafana-e2e run",
|
|
14
|
+
"e2e:update": "{{ packageManagerName }} exec cypress install && {{ packageManagerName }} exec grafana-e2e run --update-screenshots",
|
|
15
15
|
"server": "docker-compose up --build",
|
|
16
16
|
"sign": "npx --yes @grafana/sign-plugin@latest"
|
|
17
17
|
},
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@babel/core": "^7.21.4",
|
|
22
|
+
"@grafana/e2e": "{{ grafanaVersion }}",
|
|
23
|
+
"@grafana/e2e-selectors": "{{ grafanaVersion }}",
|
|
22
24
|
"@grafana/eslint-config": "^7.0.0",
|
|
23
|
-
"@grafana/plugin-e2e": "^0.24.0",
|
|
24
25
|
"@grafana/tsconfig": "^1.2.0-rc1",
|
|
25
|
-
"@playwright/test": "^1.41.2",
|
|
26
26
|
"@swc/core": "^1.3.90",
|
|
27
27
|
"@swc/helpers": "^0.5.0",
|
|
28
28
|
"@swc/jest": "^0.2.26",
|
|
@@ -25,15 +25,11 @@ dist/
|
|
|
25
25
|
artifacts/
|
|
26
26
|
work/
|
|
27
27
|
ci/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/
|
|
31
|
-
/playwright-report/
|
|
32
|
-
/blob-report/
|
|
33
|
-
/playwright/.cache/
|
|
34
|
-
/playwright/.auth/
|
|
28
|
+
e2e-results/
|
|
29
|
+
**/cypress/videos
|
|
30
|
+
**/cypress/report.json
|
|
35
31
|
|
|
36
32
|
# Editor
|
|
37
33
|
.idea
|
|
38
34
|
|
|
39
|
-
.eslintcache
|
|
35
|
+
.eslintcache
|
|
@@ -74,28 +74,15 @@ jobs:
|
|
|
74
74
|
- name: Check for E2E
|
|
75
75
|
id: check-for-e2e
|
|
76
76
|
run: |
|
|
77
|
-
if [ -
|
|
77
|
+
if [ -d "cypress" ]
|
|
78
78
|
then
|
|
79
79
|
echo "has-e2e=true" >> $GITHUB_OUTPUT
|
|
80
80
|
fi
|
|
81
81
|
|
|
82
|
-
- name: Install Playwright Browsers
|
|
83
|
-
if: steps.check-for-e2e.outputs.has-e2e == 'true'
|
|
84
|
-
run: {{ packageManagerName }} exec playwright install --with-deps
|
|
85
|
-
|
|
86
82
|
- name: Start grafana docker
|
|
87
83
|
if: steps.check-for-e2e.outputs.has-e2e == 'true'
|
|
88
84
|
run: docker-compose up -d
|
|
89
85
|
|
|
90
|
-
- name: Wait for Grafana to start
|
|
91
|
-
if: steps.check-for-e2e.outputs.has-e2e == 'true'
|
|
92
|
-
uses: nev7n/wait_for_response@v1
|
|
93
|
-
with:
|
|
94
|
-
url: 'http://localhost:3000/'
|
|
95
|
-
responseCode: 200
|
|
96
|
-
timeout: 60000
|
|
97
|
-
interval: 500
|
|
98
|
-
|
|
99
86
|
- name: Run e2e tests
|
|
100
87
|
if: steps.check-for-e2e.outputs.has-e2e == 'true'
|
|
101
88
|
run: {{ packageManagerName }} run e2e
|
|
@@ -108,8 +95,8 @@ jobs:
|
|
|
108
95
|
uses: actions/upload-artifact@v4
|
|
109
96
|
if: steps.check-for-e2e.outputs.has-e2e == 'true' && steps.run-e2e-tests.outcome != 'success'
|
|
110
97
|
with:
|
|
111
|
-
name:
|
|
112
|
-
path:
|
|
98
|
+
name: cypress-videos
|
|
99
|
+
path: cypress/videos
|
|
113
100
|
retention-days: 5
|
|
114
101
|
|
|
115
102
|
- name: Sign plugin
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { defineConfig, devices } from '@playwright/test';
|
|
2
|
-
import { dirname } from 'node:path';
|
|
3
|
-
|
|
4
|
-
const pluginE2eAuth = `${dirname(require.resolve('@grafana/plugin-e2e'))}/auth`;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Read environment variables from file.
|
|
8
|
-
* https://github.com/motdotla/dotenv
|
|
9
|
-
*/
|
|
10
|
-
// require('dotenv').config();
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* See https://playwright.dev/docs/test-configuration.
|
|
14
|
-
*/
|
|
15
|
-
export default defineConfig({
|
|
16
|
-
testDir: './tests',
|
|
17
|
-
/* Run tests in files in parallel */
|
|
18
|
-
fullyParallel: true,
|
|
19
|
-
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
20
|
-
forbidOnly: !!process.env.CI,
|
|
21
|
-
/* Retry on CI only */
|
|
22
|
-
retries: process.env.CI ? 2 : 0,
|
|
23
|
-
/* Opt out of parallel tests on CI. */
|
|
24
|
-
workers: process.env.CI ? 1 : undefined,
|
|
25
|
-
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
26
|
-
reporter: 'html',
|
|
27
|
-
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
28
|
-
use: {
|
|
29
|
-
/* Base URL to use in actions like `await page.goto('/')`. */
|
|
30
|
-
baseURL: 'http://localhost:3000',
|
|
31
|
-
|
|
32
|
-
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
33
|
-
trace: 'on-first-retry',
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
/* Configure projects for major browsers */
|
|
37
|
-
projects: [
|
|
38
|
-
// 1. Login to Grafana and store the cookie on disk for use in other tests.
|
|
39
|
-
{
|
|
40
|
-
name: 'auth',
|
|
41
|
-
testDir: pluginE2eAuth,
|
|
42
|
-
testMatch: [/.*\.js/],
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: 'chromium',
|
|
46
|
-
use: { ...devices['Desktop Chrome'], storageState: 'playwright/.auth/admin.json' },
|
|
47
|
-
dependencies: ['auth'],
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
|
|
51
|
-
});
|