plum-e2e 1.2.4 → 1.3.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/CLAUDE.md +201 -0
- package/README.md +245 -90
- package/backend/_scaffold/utils/browser.ts +5 -2
- package/backend/app.js +9 -1
- package/backend/config/scripts/generate-report.js +34 -73
- package/backend/config/scripts/run-tests.js +13 -3
- package/backend/constants/triggers.js +67 -0
- package/backend/lib/reportFilename.js +37 -0
- package/backend/lib/testChunker.js +73 -0
- package/backend/middleware/auth.js +32 -0
- package/backend/package.json +4 -2
- package/backend/prisma/migrations/20260616000000_add_runners_and_browser/migration.sql +26 -0
- package/backend/prisma/migrations/20260616000001_cron_runner_ids/migration.sql +6 -0
- package/backend/prisma/migrations/20260617000000_cron_enabled/migration.sql +1 -0
- package/backend/prisma/migrations/20260617000001_report_content/migration.sql +8 -0
- package/backend/prisma/schema.prisma +21 -1
- package/backend/routes/cron.routes.js +28 -0
- package/backend/routes/node.routes.js +121 -0
- package/backend/routes/reports.routes.js +23 -20
- package/backend/routes/runners.routes.js +83 -0
- package/backend/scripts/add-local-runner.js +120 -0
- package/backend/scripts/create-test.js +148 -0
- package/backend/server.js +16 -7
- package/backend/services/backupService.js +3 -30
- package/backend/services/cronService.js +220 -36
- package/backend/services/reportService.js +227 -55
- package/backend/services/runnerService.js +179 -0
- package/backend/websockets/socketHandler.js +162 -21
- package/bin/plum.js +160 -31
- package/docker-compose.node.yml +59 -0
- package/docker-compose.yml +2 -0
- package/frontend/package.json +1 -4
- package/frontend/src/app.css +20 -254
- package/frontend/src/app.html +1 -1
- package/frontend/src/lib/api/reports.js +17 -36
- package/frontend/src/lib/api/runners.js +61 -0
- package/frontend/src/lib/api/schedules.js +34 -5
- package/frontend/src/lib/api/settings.js +5 -5
- package/frontend/src/lib/api/tests.js +2 -19
- package/frontend/src/lib/components/icons/BrowserIcon.svelte +75 -0
- package/frontend/src/lib/components/layout/Nav.svelte +42 -47
- package/frontend/src/lib/components/layout/RunnerPanel.svelte +913 -253
- package/frontend/src/lib/components/ui/Badge.svelte +6 -1
- package/frontend/src/lib/components/ui/ConfirmModal.svelte +98 -0
- package/frontend/{tailwind.config.js → src/lib/components/ui/EmptyState.svelte} +27 -8
- package/frontend/{postcss.config.js → src/lib/components/ui/Toast.svelte} +20 -7
- package/frontend/src/lib/constants.js +36 -0
- package/frontend/src/lib/stores/runner.js +23 -12
- package/frontend/src/lib/styles/global.css +176 -0
- package/frontend/src/lib/styles/reset.css +86 -0
- package/frontend/src/lib/styles/tokens.css +90 -0
- package/frontend/src/lib/utils/format.js +46 -0
- package/frontend/src/routes/+page.svelte +16 -35
- package/frontend/src/routes/reports/+page.svelte +84 -167
- package/frontend/src/routes/reports/{[slug] → [id]}/+page.svelte +325 -76
- package/frontend/src/routes/reports/live/+page.svelte +704 -0
- package/frontend/src/routes/scheduled-tests/+page.svelte +328 -88
- package/frontend/src/routes/settings/+page.svelte +774 -127
- package/frontend/static/favicon-32x32.png +0 -0
- package/frontend/static/favicon.ico +0 -0
- package/package.json +1 -1
- package/frontend/static/favicon.png +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of Plum.
|
|
3
|
+
#
|
|
4
|
+
# Plum is free software: you can redistribute it and/or modify
|
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
# (at your option) any later version.
|
|
8
|
+
#
|
|
9
|
+
# Plum is distributed in the hope that it will be useful,
|
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
# GNU General Public License for more details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU General Public License
|
|
15
|
+
# along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
# Runner node — backend + postgres only, no frontend UI.
|
|
19
|
+
# Start with: plum node start --token <secret> --primary http://primary:3001
|
|
20
|
+
|
|
21
|
+
services:
|
|
22
|
+
postgres:
|
|
23
|
+
image: postgres:16-alpine
|
|
24
|
+
environment:
|
|
25
|
+
POSTGRES_DB: plum
|
|
26
|
+
POSTGRES_USER: plum
|
|
27
|
+
POSTGRES_PASSWORD: plum
|
|
28
|
+
volumes:
|
|
29
|
+
- node_postgres_data:/var/lib/postgresql/data
|
|
30
|
+
networks:
|
|
31
|
+
- node-network
|
|
32
|
+
healthcheck:
|
|
33
|
+
test: ['CMD-SHELL', 'pg_isready -U plum']
|
|
34
|
+
interval: 5s
|
|
35
|
+
timeout: 5s
|
|
36
|
+
retries: 10
|
|
37
|
+
|
|
38
|
+
backend:
|
|
39
|
+
build: ./backend
|
|
40
|
+
ports:
|
|
41
|
+
- '3001:3001'
|
|
42
|
+
environment:
|
|
43
|
+
DATABASE_URL: 'postgresql://plum:plum@postgres:5432/plum'
|
|
44
|
+
PLUM_MODE: 'node'
|
|
45
|
+
volumes:
|
|
46
|
+
- ./backend/reports:/app/reports
|
|
47
|
+
- ./backend/tests:/app/tests:rw
|
|
48
|
+
depends_on:
|
|
49
|
+
postgres:
|
|
50
|
+
condition: service_healthy
|
|
51
|
+
networks:
|
|
52
|
+
- node-network
|
|
53
|
+
|
|
54
|
+
networks:
|
|
55
|
+
node-network:
|
|
56
|
+
driver: bridge
|
|
57
|
+
|
|
58
|
+
volumes:
|
|
59
|
+
node_postgres_data:
|
package/docker-compose.yml
CHANGED
package/frontend/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plum-frontend",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite dev",
|
|
@@ -14,10 +14,7 @@
|
|
|
14
14
|
"@sveltejs/adapter-node": "^5.5.4",
|
|
15
15
|
"@sveltejs/kit": "^2.16.0",
|
|
16
16
|
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
|
17
|
-
"autoprefixer": "^10.4.20",
|
|
18
|
-
"postcss": "^8.5.1",
|
|
19
17
|
"svelte": "^5.0.0",
|
|
20
|
-
"tailwindcss": "^3.4.17",
|
|
21
18
|
"vite": "^6.0.0"
|
|
22
19
|
},
|
|
23
20
|
"dependencies": {
|
package/frontend/src/app.css
CHANGED
|
@@ -14,257 +14,23 @@ GNU General Public License for more details.
|
|
|
14
14
|
You should have received a copy of the GNU General Public License
|
|
15
15
|
along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
--warn: #d97706;
|
|
38
|
-
--warn-soft: #fef3c7;
|
|
39
|
-
--terminal-bg: #0d0c08;
|
|
40
|
-
--terminal-text: #d6d0c8;
|
|
41
|
-
|
|
42
|
-
--font-display: 'Playfair Display', Georgia, serif;
|
|
43
|
-
--font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
|
|
44
|
-
|
|
45
|
-
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
|
|
46
|
-
--duration-fast: 140ms;
|
|
47
|
-
--duration-base: 240ms;
|
|
48
|
-
--duration-slow: 400ms;
|
|
49
|
-
|
|
50
|
-
--radius-sm: 6px;
|
|
51
|
-
--radius-md: 10px;
|
|
52
|
-
--radius-lg: 16px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
[data-theme='dark'] {
|
|
56
|
-
--bg: #101009;
|
|
57
|
-
--bg-subtle: #1a1910;
|
|
58
|
-
--bg-elevated: #201f14;
|
|
59
|
-
--border: #2e2c1e;
|
|
60
|
-
--text: #f0ede6;
|
|
61
|
-
--text-muted: #706a5e;
|
|
62
|
-
--accent: #d0a5f5;
|
|
63
|
-
--accent-soft: #1b0d30;
|
|
64
|
-
--pass: #22c55e;
|
|
65
|
-
--pass-soft: #0d2118;
|
|
66
|
-
--fail: #f87171;
|
|
67
|
-
--fail-soft: #2d1010;
|
|
68
|
-
--warn: #fbbf24;
|
|
69
|
-
--warn-soft: #2a1f06;
|
|
70
|
-
--terminal-bg: #080807;
|
|
71
|
-
--terminal-text: #cbc5bd;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/* ── Reset ──────────────────────────────────────────────────────────────── */
|
|
75
|
-
|
|
76
|
-
*,
|
|
77
|
-
*::before,
|
|
78
|
-
*::after {
|
|
79
|
-
box-sizing: border-box;
|
|
80
|
-
margin: 0;
|
|
81
|
-
padding: 0;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
html {
|
|
85
|
-
scroll-behavior: smooth;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
body {
|
|
89
|
-
font-family: var(--font-body);
|
|
90
|
-
font-weight: 300;
|
|
91
|
-
font-size: 1rem;
|
|
92
|
-
line-height: 1.65;
|
|
93
|
-
background-color: var(--bg);
|
|
94
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
|
|
95
|
-
background-size: 200px 200px;
|
|
96
|
-
color: var(--text);
|
|
97
|
-
transition:
|
|
98
|
-
background-color var(--duration-base) var(--ease-out),
|
|
99
|
-
color var(--duration-base) var(--ease-out);
|
|
100
|
-
-webkit-font-smoothing: antialiased;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
h1 {
|
|
104
|
-
font-family: var(--font-display);
|
|
105
|
-
font-weight: 400;
|
|
106
|
-
line-height: 1.1;
|
|
107
|
-
letter-spacing: -0.015em;
|
|
108
|
-
color: var(--text);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
h2,
|
|
112
|
-
h3 {
|
|
113
|
-
font-family: var(--font-display);
|
|
114
|
-
font-weight: 400;
|
|
115
|
-
line-height: 1.2;
|
|
116
|
-
color: var(--text);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
a {
|
|
120
|
-
color: inherit;
|
|
121
|
-
text-decoration: none;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
button {
|
|
125
|
-
font-family: var(--font-body);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/* ── Global form styles ─────────────────────────────────────────────────── */
|
|
129
|
-
|
|
130
|
-
.field {
|
|
131
|
-
display: flex;
|
|
132
|
-
flex-direction: column;
|
|
133
|
-
gap: 0.375rem;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.field-label {
|
|
137
|
-
display: flex;
|
|
138
|
-
justify-content: space-between;
|
|
139
|
-
font-size: 0.8125rem;
|
|
140
|
-
font-weight: 400;
|
|
141
|
-
color: var(--text-muted);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.field-hint {
|
|
145
|
-
font-size: 0.75rem;
|
|
146
|
-
color: var(--text-muted);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.field-input {
|
|
150
|
-
width: 100%;
|
|
151
|
-
padding: 0.6rem 0.875rem;
|
|
152
|
-
border: 1px solid var(--border);
|
|
153
|
-
border-radius: var(--radius-md);
|
|
154
|
-
background: var(--bg-subtle);
|
|
155
|
-
color: var(--text);
|
|
156
|
-
font-family: var(--font-body);
|
|
157
|
-
font-size: 0.875rem;
|
|
158
|
-
font-weight: 300;
|
|
159
|
-
outline: none;
|
|
160
|
-
transition:
|
|
161
|
-
border-color var(--duration-fast),
|
|
162
|
-
box-shadow var(--duration-fast);
|
|
163
|
-
appearance: none;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.field-input:focus {
|
|
167
|
-
border-color: var(--accent);
|
|
168
|
-
box-shadow: 0 0 0 3px var(--accent-soft);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.field-input:disabled {
|
|
172
|
-
opacity: 0.5;
|
|
173
|
-
cursor: not-allowed;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.field-input::placeholder {
|
|
177
|
-
color: var(--text-muted);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/* ── Global table ───────────────────────────────────────────────────────── */
|
|
181
|
-
|
|
182
|
-
.data-table {
|
|
183
|
-
width: 100%;
|
|
184
|
-
border-collapse: collapse;
|
|
185
|
-
font-size: 0.875rem;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.data-table th {
|
|
189
|
-
text-align: left;
|
|
190
|
-
padding: 0.5rem 1rem;
|
|
191
|
-
font-family: var(--font-body);
|
|
192
|
-
font-weight: 500;
|
|
193
|
-
font-size: 0.7rem;
|
|
194
|
-
letter-spacing: 0.07em;
|
|
195
|
-
text-transform: uppercase;
|
|
196
|
-
color: var(--text-muted);
|
|
197
|
-
border-bottom: 1px solid var(--border);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.data-table td {
|
|
201
|
-
padding: 0.875rem 1rem;
|
|
202
|
-
border-bottom: 1px solid var(--border);
|
|
203
|
-
color: var(--text);
|
|
204
|
-
vertical-align: middle;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.data-table tbody tr:last-child td {
|
|
208
|
-
border-bottom: none;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/* ── Card ───────────────────────────────────────────────────────────────── */
|
|
212
|
-
|
|
213
|
-
.card {
|
|
214
|
-
background: var(--bg-elevated);
|
|
215
|
-
border: 1px solid var(--border);
|
|
216
|
-
border-radius: var(--radius-lg);
|
|
217
|
-
padding: 1.5rem;
|
|
218
|
-
transition:
|
|
219
|
-
background var(--duration-base) var(--ease-out),
|
|
220
|
-
border-color var(--duration-base) var(--ease-out);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.card-title {
|
|
224
|
-
font-family: var(--font-display);
|
|
225
|
-
font-size: 1.25rem;
|
|
226
|
-
font-weight: 400;
|
|
227
|
-
color: var(--text);
|
|
228
|
-
margin-bottom: 0.25rem;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.card-subtitle {
|
|
232
|
-
font-size: 0.8125rem;
|
|
233
|
-
color: var(--text-muted);
|
|
234
|
-
margin-bottom: 1.25rem;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/* ── Alert ──────────────────────────────────────────────────────────────── */
|
|
238
|
-
|
|
239
|
-
.alert {
|
|
240
|
-
display: flex;
|
|
241
|
-
align-items: center;
|
|
242
|
-
gap: 0.625rem;
|
|
243
|
-
padding: 0.75rem 1rem;
|
|
244
|
-
border-radius: var(--radius-md);
|
|
245
|
-
font-size: 0.875rem;
|
|
246
|
-
font-weight: 400;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.alert-success {
|
|
250
|
-
background: var(--pass-soft);
|
|
251
|
-
color: var(--pass);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
.alert-error {
|
|
255
|
-
background: var(--fail-soft);
|
|
256
|
-
color: var(--fail);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/* ── Animations ─────────────────────────────────────────────────────────── */
|
|
260
|
-
|
|
261
|
-
@keyframes fadeUp {
|
|
262
|
-
from {
|
|
263
|
-
opacity: 0;
|
|
264
|
-
transform: translateY(10px);
|
|
265
|
-
}
|
|
266
|
-
to {
|
|
267
|
-
opacity: 1;
|
|
268
|
-
transform: translateY(0);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
17
|
+
/*
|
|
18
|
+
* This file is part of Plum.
|
|
19
|
+
*
|
|
20
|
+
* Plum is free software: you can redistribute it and/or modify
|
|
21
|
+
* it under the terms of the GNU General Public License as published by
|
|
22
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
23
|
+
* (at your option) any later version.
|
|
24
|
+
*
|
|
25
|
+
* Plum is distributed in the hope that it will be useful,
|
|
26
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
27
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
28
|
+
* GNU General Public License for more details.
|
|
29
|
+
*
|
|
30
|
+
* You should have received a copy of the GNU General Public License
|
|
31
|
+
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
@import '$lib/styles/tokens.css';
|
|
35
|
+
@import '$lib/styles/reset.css';
|
|
36
|
+
@import '$lib/styles/global.css';
|
package/frontend/src/app.html
CHANGED
|
@@ -18,7 +18,7 @@ along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
|
18
18
|
<html lang="en" data-theme="light">
|
|
19
19
|
<head>
|
|
20
20
|
<meta charset="utf-8" />
|
|
21
|
-
<link rel="icon" href="%sveltekit.assets%/favicon.
|
|
21
|
+
<link rel="icon" href="%sveltekit.assets%/favicon.ico" />
|
|
22
22
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
23
23
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
24
24
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
@@ -15,64 +15,45 @@
|
|
|
15
15
|
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
import { API_BASE } from '$lib/constants';
|
|
19
19
|
|
|
20
20
|
export async function fetchReports() {
|
|
21
|
-
const res = await fetch(`${
|
|
21
|
+
const res = await fetch(`${API_BASE}/reports`);
|
|
22
22
|
const { reports } = await res.json();
|
|
23
23
|
return reports.map((r) => ({ ...r, date: new Date(r.createdAt).toLocaleString() }));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export async function
|
|
27
|
-
const res = await fetch(`${
|
|
28
|
-
const {
|
|
29
|
-
return
|
|
26
|
+
export async function fetchLatestReportId() {
|
|
27
|
+
const res = await fetch(`${API_BASE}/reports/latest`);
|
|
28
|
+
const { latestReportId } = await res.json();
|
|
29
|
+
return latestReportId;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export function reportUrl(
|
|
33
|
-
return `/reports/${
|
|
32
|
+
export function reportUrl(id) {
|
|
33
|
+
return `/reports/${id}`;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export function parseReport(fileName) {
|
|
39
|
-
const m = fileName.match(
|
|
40
|
-
/^(PASS|FAIL)_cucumber_report_(.+?)_(\([^)]+\))_runners_(\d+)_(\d{4}_\d{2}_\d{2}T[\d_]+Z)\.json$/
|
|
41
|
-
);
|
|
42
|
-
if (!m) return null;
|
|
43
|
-
const [, status, triggerType, tags, runners, tsRaw] = m;
|
|
44
|
-
const isoStr = tsRaw.replace(
|
|
45
|
-
/^(\d{4})_(\d{2})_(\d{2})T(\d{2})_(\d{2})_(\d{2})_(\d+)Z$/,
|
|
46
|
-
'$1-$2-$3T$4:$5:$6.$7Z'
|
|
47
|
-
);
|
|
48
|
-
return {
|
|
49
|
-
status,
|
|
50
|
-
triggerType,
|
|
51
|
-
tags,
|
|
52
|
-
runners: parseInt(runners, 10),
|
|
53
|
-
date: new Date(isoStr).toLocaleString()
|
|
54
|
-
};
|
|
36
|
+
export function screenshotUrl(filename) {
|
|
37
|
+
return `${API_BASE}/screenshots/${filename}`;
|
|
55
38
|
}
|
|
56
39
|
|
|
57
|
-
export async function fetchReportDetail(
|
|
58
|
-
const res = await fetch(`${
|
|
40
|
+
export async function fetchReportDetail(id) {
|
|
41
|
+
const res = await fetch(`${API_BASE}/reports/${id}`);
|
|
59
42
|
if (!res.ok) throw new Error('Report not found');
|
|
60
43
|
return res.json();
|
|
61
44
|
}
|
|
62
45
|
|
|
63
|
-
export async function deleteReport(
|
|
64
|
-
const res = await fetch(`${
|
|
65
|
-
method: 'DELETE'
|
|
66
|
-
});
|
|
46
|
+
export async function deleteReport(id) {
|
|
47
|
+
const res = await fetch(`${API_BASE}/reports/${id}`, { method: 'DELETE' });
|
|
67
48
|
if (!res.ok) throw new Error('Failed to delete report');
|
|
68
49
|
return res.json();
|
|
69
50
|
}
|
|
70
51
|
|
|
71
|
-
export async function deleteReports(
|
|
72
|
-
const res = await fetch(`${
|
|
52
|
+
export async function deleteReports(ids) {
|
|
53
|
+
const res = await fetch(`${API_BASE}/reports/bulk`, {
|
|
73
54
|
method: 'DELETE',
|
|
74
55
|
headers: { 'Content-Type': 'application/json' },
|
|
75
|
-
body: JSON.stringify({
|
|
56
|
+
body: JSON.stringify({ ids })
|
|
76
57
|
});
|
|
77
58
|
if (!res.ok) throw new Error('Failed to delete reports');
|
|
78
59
|
return res.json();
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of Plum.
|
|
3
|
+
*
|
|
4
|
+
* Plum is free software: you can redistribute it and/or modify
|
|
5
|
+
* it under the terms of the GNU General Public License as published by
|
|
6
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
* (at your option) any later version.
|
|
8
|
+
*
|
|
9
|
+
* Plum is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License
|
|
15
|
+
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { API_BASE } from '$lib/constants';
|
|
19
|
+
|
|
20
|
+
export async function fetchRunners() {
|
|
21
|
+
const res = await fetch(`${API_BASE}/runners`);
|
|
22
|
+
const { runners } = await res.json();
|
|
23
|
+
return runners;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export async function createRunner(data) {
|
|
27
|
+
const res = await fetch(`${API_BASE}/runners`, {
|
|
28
|
+
method: 'POST',
|
|
29
|
+
headers: { 'Content-Type': 'application/json' },
|
|
30
|
+
body: JSON.stringify(data)
|
|
31
|
+
});
|
|
32
|
+
return res.json();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function deleteRunner(id) {
|
|
36
|
+
const res = await fetch(`${API_BASE}/runners/${id}`, { method: 'DELETE' });
|
|
37
|
+
return res.json();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function updateRunner(id, data) {
|
|
41
|
+
const res = await fetch(`${API_BASE}/runners/${id}`, {
|
|
42
|
+
method: 'PUT',
|
|
43
|
+
headers: { 'Content-Type': 'application/json' },
|
|
44
|
+
body: JSON.stringify(data)
|
|
45
|
+
});
|
|
46
|
+
return res.json();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function pingRunner(id) {
|
|
50
|
+
const res = await fetch(`${API_BASE}/runners/${id}/ping`, { method: 'POST' });
|
|
51
|
+
return res.json();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export async function probeRunner(url, token) {
|
|
55
|
+
const res = await fetch(`${API_BASE}/runners/probe`, {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
headers: { 'Content-Type': 'application/json' },
|
|
58
|
+
body: JSON.stringify({ url, token })
|
|
59
|
+
});
|
|
60
|
+
return res.json();
|
|
61
|
+
}
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
import { API_BASE } from '$lib/constants';
|
|
19
19
|
|
|
20
20
|
export async function fetchCronJobs() {
|
|
21
|
-
const res = await fetch(`${
|
|
21
|
+
const res = await fetch(`${API_BASE}/cron-jobs`);
|
|
22
22
|
const { cronJobs } = await res.json();
|
|
23
23
|
return cronJobs ?? [];
|
|
24
24
|
}
|
|
@@ -28,21 +28,50 @@ export async function saveCronJob({
|
|
|
28
28
|
cronExpression,
|
|
29
29
|
tags,
|
|
30
30
|
workers,
|
|
31
|
+
browser,
|
|
32
|
+
runnerIds,
|
|
31
33
|
isEditing,
|
|
32
34
|
editTaskName
|
|
33
35
|
}) {
|
|
34
36
|
const formattedTags = tags.replace(/\sOR\s/gi, (m) => m.toLowerCase());
|
|
35
|
-
const url = isEditing
|
|
37
|
+
const url = isEditing
|
|
38
|
+
? `${API_BASE}/cron-jobs/${encodeURIComponent(editTaskName)}`
|
|
39
|
+
: `${API_BASE}/cron-jobs`;
|
|
36
40
|
const method = isEditing ? 'PUT' : 'POST';
|
|
37
41
|
const res = await fetch(url, {
|
|
38
42
|
method,
|
|
39
43
|
headers: { 'Content-Type': 'application/json' },
|
|
40
|
-
body: JSON.stringify({
|
|
44
|
+
body: JSON.stringify({
|
|
45
|
+
cronExpression,
|
|
46
|
+
taskName,
|
|
47
|
+
tags: formattedTags,
|
|
48
|
+
workers,
|
|
49
|
+
browser,
|
|
50
|
+
runnerIds
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
return res.json();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export async function toggleCronJob(taskName, enabled) {
|
|
57
|
+
const res = await fetch(`${API_BASE}/cron-jobs/${encodeURIComponent(taskName)}/toggle`, {
|
|
58
|
+
method: 'PATCH',
|
|
59
|
+
headers: { 'Content-Type': 'application/json' },
|
|
60
|
+
body: JSON.stringify({ enabled })
|
|
61
|
+
});
|
|
62
|
+
return res.json();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export async function runCronJobNow(taskName) {
|
|
66
|
+
const res = await fetch(`${API_BASE}/cron-jobs/${encodeURIComponent(taskName)}/run`, {
|
|
67
|
+
method: 'POST'
|
|
41
68
|
});
|
|
42
69
|
return res.json();
|
|
43
70
|
}
|
|
44
71
|
|
|
45
72
|
export async function deleteCronJob(taskName) {
|
|
46
|
-
const res = await fetch(`${
|
|
73
|
+
const res = await fetch(`${API_BASE}/cron-jobs/${encodeURIComponent(taskName)}`, {
|
|
74
|
+
method: 'DELETE'
|
|
75
|
+
});
|
|
47
76
|
return res.json();
|
|
48
77
|
}
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
import { API_BASE } from '$lib/constants';
|
|
19
19
|
|
|
20
20
|
export async function fetchProject() {
|
|
21
|
-
const res = await fetch(`${
|
|
21
|
+
const res = await fetch(`${API_BASE}/settings/project`);
|
|
22
22
|
if (!res.ok) return { name: '', logoUrl: '' };
|
|
23
23
|
return res.json();
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export async function saveProject({ name, logoUrl }) {
|
|
27
|
-
const res = await fetch(`${
|
|
27
|
+
const res = await fetch(`${API_BASE}/settings/project`, {
|
|
28
28
|
method: 'POST',
|
|
29
29
|
headers: { 'Content-Type': 'application/json' },
|
|
30
30
|
body: JSON.stringify({ name, logoUrl })
|
|
@@ -33,13 +33,13 @@ export async function saveProject({ name, logoUrl }) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export async function exportBackup() {
|
|
36
|
-
const res = await fetch(`${
|
|
36
|
+
const res = await fetch(`${API_BASE}/backup/export`);
|
|
37
37
|
if (!res.ok) throw new Error('Export failed');
|
|
38
38
|
return res.json();
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export async function importBackup(data) {
|
|
42
|
-
const res = await fetch(`${
|
|
42
|
+
const res = await fetch(`${API_BASE}/backup/import`, {
|
|
43
43
|
method: 'POST',
|
|
44
44
|
headers: { 'Content-Type': 'application/json' },
|
|
45
45
|
body: JSON.stringify(data)
|
|
@@ -15,27 +15,10 @@
|
|
|
15
15
|
* along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
This file is part of Plum.
|
|
20
|
-
|
|
21
|
-
Plum is free software: you can redistribute it and/or modify
|
|
22
|
-
it under the terms of the GNU General Public License as published by
|
|
23
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
24
|
-
(at your option) any later version.
|
|
25
|
-
|
|
26
|
-
Plum is distributed in the hope that it will be useful,
|
|
27
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
28
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
29
|
-
GNU General Public License for more details.
|
|
30
|
-
|
|
31
|
-
You should have received a copy of the GNU General Public License
|
|
32
|
-
along with Plum. If not, see https://www.gnu.org/licenses/.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
const BASE = 'http://localhost:3001';
|
|
18
|
+
import { API_BASE } from '$lib/constants';
|
|
36
19
|
|
|
37
20
|
export async function fetchSuites() {
|
|
38
|
-
const res = await fetch(`${
|
|
21
|
+
const res = await fetch(`${API_BASE}/tests`);
|
|
39
22
|
const { suites } = await res.json();
|
|
40
23
|
return suites.suites ?? [];
|
|
41
24
|
}
|