Skip to content

Commit 4605c49

Browse files
committed
Re-enable e2e tests
1 parent e2ff6a4 commit 4605c49

30 files changed

+1890
-761
lines changed

docker-compose.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.0'
2-
31
services:
42
grafana:
53
container_name: 'checkmk-cloud-datasource'
@@ -16,7 +14,7 @@ services:
1614
volumes:
1715
- ./dist:/var/lib/grafana/plugins/checkmk-cloud-datasource
1816
- ./provisioning:/etc/grafana/provisioning
19-
- .:/root/checkmk-cmkgrafanadatasource2-datasource
17+
- .:/root/checkmk-cloud-datasource
2018

2119
environment:
2220
NODE_ENV: development

jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ process.env.TZ = 'UTC';
66
module.exports = {
77
// Jest configuration provided by Grafana scaffolding
88
...require('./.config/jest.config'),
9-
testMatch: ['**/tests/unit/**/*'],
9+
//testMatch: ['<rootDir>/test/unit/**/*.{spec,test,jest}.{js,jsx,ts,tsx}'],
10+
testMatch: ['**/tests/unit/**/*.{spec,test,jest}.{js,jsx,ts,tsx}'],
1011
};

package-lock.json

Lines changed: 170 additions & 169 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"scripts": {
66
"build": "webpack -c ./webpack.config.ts --env production",
77
"build:cloud": "webpack -c ./webpack.config.ts --env production",
8+
"build:dev": "webpack -c ./webpack.config.ts --env development",
89
"dev": "webpack -w -c ./webpack.config.ts --env development",
910
"test": "jest --watch --onlyChanged",
1011
"test:ci": "jest --passWithNoTests --maxWorkers 4",
@@ -25,28 +26,28 @@
2526
"author": "Checkmk",
2627
"license": "Apache-2.0",
2728
"devDependencies": {
28-
"@babel/core": "^7.26.10",
29+
"@babel/core": "^7.27.1",
2930
"@grafana/eslint-config": "^7.0.0",
3031
"@grafana/plugin-e2e": "^1.19.4",
3132
"@grafana/tsconfig": "^2.0.0",
32-
"@playwright/test": "^1.51.1",
33-
"@swc/core": "^1.11.18",
33+
"@playwright/test": "^1.52.0",
34+
"@swc/core": "^1.11.24",
3435
"@swc/helpers": "^0.5.15",
3536
"@swc/jest": "^0.2.37",
3637
"@testing-library/jest-dom": "6.6.3",
3738
"@testing-library/react": "16.3.0",
3839
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
3940
"@types/jest": "^29.5.14",
4041
"@types/lodash": "^4.17.16",
41-
"@types/node": "^22.14.0",
42+
"@types/node": "^22.15.19",
4243
"@types/react-router-dom": "^5.3.3",
4344
"copy-webpack-plugin": "^12.0.2",
4445
"css-loader": "^7.1.2",
45-
"dotenv": "^16.4.7",
46+
"dotenv": "^16.5.0",
4647
"eslint-plugin-deprecation": "^3.0.0",
4748
"eslint-webpack-plugin": "^4.2.0",
4849
"fork-ts-checker-webpack-plugin": "^9.1.0",
49-
"glob": "^11.0.1",
50+
"glob": "^11.0.2",
5051
"identity-obj-proxy": "3.0.0",
5152
"imports-loader": "^5.0.0",
5253
"jest": "^29.7.0",
@@ -55,14 +56,14 @@
5556
"react-intersection-observer": "^9.16.0",
5657
"react-select-event": "^5.5.1",
5758
"replace-in-file-webpack-plugin": "^1.0.6",
58-
"sass": "1.86.3",
59+
"sass": "1.89.0",
5960
"sass-loader": "16.0.5",
6061
"style-loader": "4.0.0",
6162
"swc-loader": "^0.2.6",
6263
"ts-node": "^10.9.2",
6364
"tsconfig-paths": "^4.2.0",
6465
"typescript": "5.8.3",
65-
"webpack": "^5.99.5",
66+
"webpack": "^5.99.8",
6667
"webpack-cli": "^5.1.4",
6768
"webpack-livereload-plugin": "^3.0.2"
6869
},
@@ -71,10 +72,10 @@
7172
},
7273
"dependencies": {
7374
"@emotion/css": "^11.13.5",
74-
"@grafana/data": "^11.6.0",
75-
"@grafana/runtime": "^11.6.0",
76-
"@grafana/schema": "^11.6.0",
77-
"@grafana/ui": "^11.6.0",
75+
"@grafana/data": "^11.5.3",
76+
"@grafana/runtime": "^11.5.3",
77+
"@grafana/schema": "^11.5.3",
78+
"@grafana/ui": "^11.5.3",
7879
"process": "^0.11.10",
7980
"react": "18.3.1",
8081
"react-dom": "18.3.1",

playwright.config.ts

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ export default defineConfig<PluginOptions>({
77
fullyParallel: false,
88
forbidOnly: !!process.env.CI,
99
retries: process.env.CI ? 3 : 0,
10+
expect: {
11+
timeout: 20_000,
12+
},
13+
timeout: 60_000,
1014
workers: 1,
1115
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
1216
reporter: 'list',
@@ -15,6 +19,7 @@ export default defineConfig<PluginOptions>({
1519
video: 'retain-on-failure',
1620
screenshot: 'only-on-failure',
1721
viewport: { width: 1920, height: 1080 },
22+
testIdAttribute: 'data-test-id',
1823
baseURL: process.env.PLAYWRIGHT_TO_GRAFANA_URL || 'http://localhost:3003',
1924
grafanaAPICredentials: {
2025
user: process.env.GRAFANA_USER || 'admin',
@@ -23,27 +28,21 @@ export default defineConfig<PluginOptions>({
2328
},
2429
projects: [
2530
{
26-
name: 'e2e tests',
31+
name: 'tests',
2732
testDir: './tests/e2e/tests',
28-
testMatch: ['**/disabled.test.ts'],
33+
testMatch: ['**/*.test.ts'],
34+
dependencies: ['setup'],
35+
},
36+
{
37+
name: 'setup',
38+
testDir: './tests/e2e/tests',
39+
testMatch: 'global.setup.ts',
40+
teardown: 'tearDown',
41+
},
42+
{
43+
name: 'tearDown',
44+
testDir: './tests/e2e/tests',
45+
testMatch: 'global.teardown.ts',
2946
},
30-
31-
// {
32-
// name: 'e2e tests',
33-
// testDir: './tests/e2e/tests',
34-
// testMatch: ['**/*.test.ts'],
35-
// dependencies: ['setup'],
36-
// },
37-
// {
38-
// name: 'setup',
39-
// testDir: './tests/e2e/tests',
40-
// testMatch: 'global.setup.ts',
41-
// teardown: 'tearDown',
42-
// },
43-
// {
44-
// name: 'tearDown',
45-
// testDir: './tests/e2e/tests',
46-
// testMatch: 'global.teardown.ts',
47-
// },
4847
],
4948
});

src/ui/ConfigEditor.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const ConfigEditor = (props: Props) => {
102102
onChange={onUrlChange}
103103
value={settings.url || ''}
104104
tooltip="Which Checkmk Server to connect to. (Example: https://checkmk.server/site)"
105-
data-testid="checkmk-url"
105+
data-test-id="checkmk-url"
106106
/>
107107
</div>
108108
<InlineField label="Edition" labelWidth={12}>
@@ -113,7 +113,7 @@ export const ConfigEditor = (props: Props) => {
113113
value={settings.edition}
114114
placeholder="Select your checkmk edition"
115115
inputId="checkmk-edition"
116-
data-testid="checkmk-edition"
116+
data-test-id="checkmk-edition"
117117
/>
118118
</InlineField>
119119
</FieldSet>
@@ -126,7 +126,7 @@ export const ConfigEditor = (props: Props) => {
126126
onChange={onUsernameChange}
127127
value={settings.username}
128128
tooltip="A checkmk monitoring user. Don't use 'automation' user, because it has admin rights."
129-
data-testid="checkmk-username"
129+
data-test-id="checkmk-username"
130130
/>
131131
</div>
132132
<div className="gf-form">
@@ -140,7 +140,7 @@ export const ConfigEditor = (props: Props) => {
140140
onReset={onResetSecret}
141141
onChange={onSecretChange}
142142
tooltip="You can find the secret for your user in your checkmk server under Users."
143-
data-testid="checkmk-password"
143+
data-test-id="checkmk-password"
144144
/>
145145
</div>
146146
</FieldSet>

tests/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
results/
2+
unit/

tests/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/playwright:v1.46.1-jammy
1+
FROM mcr.microsoft.com/playwright:v1.52.0-noble
22

33
WORKDIR /app
44

Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#!/usr/bin/env bash
2+
# This script runs while the site is still stopped
3+
24
su - cmk -c "/usr/bin/env bash" << __EOF__
35
echo abskjfdalkdhjbld | cmk-passwd cmkadmin -i
46
echo "Admin password set"
57
6-
omd stop
78
omd config set MKEVENTD off
89
omd config set AGENT_RECEIVER off
910
omd config set LIVEPROXYD off
10-
omd config set TRACE_SEND off
11-
omd config set TRACE_RECEIVE off
12-
omd start
13-
echo "Event console, agent receiver, liveproxy, and trace disabled"
11+
echo "Event console, liveproxy, and trace disabled"
1412
__EOF__

tests/checkmk-docker-hooks/post-start/generate_random_rrd_data.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)