plum-e2e 1.3.7 → 2.2.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.
Files changed (62) hide show
  1. package/README.md +111 -3
  2. package/backend/app.js +5 -0
  3. package/backend/config/scripts/create-test.mjs +172 -0
  4. package/backend/config/scripts/generate-report.js +2 -1
  5. package/backend/lib/runnerProcess.js +50 -4
  6. package/backend/logs/runner-cmqneqerz0000qq01i5ap2rvl.log +22 -0
  7. package/backend/logs/runner-cmqnfv7kr0000r101aeocm8eu.log +20 -0
  8. package/backend/logs/runner-cmqnfvb560001r101qoi0phau.log +43 -0
  9. package/backend/logs/runner-cmqnfvlm20002r101gsyqb837.log +20 -0
  10. package/backend/logs/runner-cmqnfvqfy0003r101fh41pzx3.log +20 -0
  11. package/backend/logs/runner-cmqnfvvwo0004r101q4dtqxd2.log +20 -0
  12. package/backend/middleware/jwtAuth.js +33 -0
  13. package/backend/middleware/requireAdmin.js +25 -0
  14. package/backend/package.json +2 -0
  15. package/backend/prisma/migrations/20260618000000_add_test_repository/migration.sql +133 -0
  16. package/backend/prisma/migrations/20260618000001_add_user_roles/migration.sql +3 -0
  17. package/backend/prisma/migrations/20260618000002_drop_automated_tag/migration.sql +2 -0
  18. package/backend/prisma/migrations/20260618000003_entry_assignee/migration.sql +2 -0
  19. package/backend/prisma/migrations/20260621000000_add_notifications/migration.sql +8 -0
  20. package/backend/prisma/schema.prisma +123 -10
  21. package/backend/routes/auth.routes.js +96 -0
  22. package/backend/routes/node.routes.js +9 -0
  23. package/backend/routes/runners.routes.js +10 -0
  24. package/backend/routes/settings.routes.js +71 -8
  25. package/backend/routes/test-cases.routes.js +80 -0
  26. package/backend/routes/test-runs.routes.js +122 -0
  27. package/backend/routes/test-suites.routes.js +92 -0
  28. package/backend/routes/users.routes.js +67 -0
  29. package/backend/scripts/create-test.js +7 -6
  30. package/backend/scripts/manage-runners.mjs +49 -8
  31. package/backend/server.js +22 -1
  32. package/backend/services/cronService.js +91 -7
  33. package/backend/services/notificationService.js +163 -0
  34. package/backend/services/reportService.js +96 -4
  35. package/backend/services/settingsService.js +46 -2
  36. package/backend/services/testCaseService.js +139 -0
  37. package/backend/services/testRunService.js +203 -0
  38. package/backend/services/testSuiteService.js +191 -0
  39. package/backend/services/userService.js +114 -0
  40. package/backend/websockets/socketHandler.js +96 -7
  41. package/bin/plum.js +105 -9
  42. package/frontend/src/lib/api/auth.js +69 -0
  43. package/frontend/src/lib/api/repository.js +256 -0
  44. package/frontend/src/lib/api/schedules.js +5 -1
  45. package/frontend/src/lib/api/settings.js +15 -0
  46. package/frontend/src/lib/api/users.js +52 -0
  47. package/frontend/src/lib/components/layout/Nav.svelte +116 -4
  48. package/frontend/src/lib/components/layout/RunnerPanel.svelte +321 -31
  49. package/frontend/src/lib/components/ui/Modal.svelte +8 -1
  50. package/frontend/src/lib/constants.js +2 -0
  51. package/frontend/src/lib/stores/auth.js +60 -0
  52. package/frontend/src/lib/stores/runner.js +11 -2
  53. package/frontend/src/routes/+layout.svelte +32 -4
  54. package/frontend/src/routes/+page.svelte +1 -1
  55. package/frontend/src/routes/login/+page.svelte +209 -0
  56. package/frontend/src/routes/scheduled-tests/+page.svelte +65 -7
  57. package/frontend/src/routes/settings/+page.svelte +677 -6
  58. package/frontend/src/routes/setup/+page.svelte +249 -0
  59. package/frontend/src/routes/test-repository/+page.svelte +1379 -0
  60. package/frontend/src/routes/test-repository/runs/[id]/+page.svelte +1549 -0
  61. package/frontend/src/routes/test-repository/suites/[id]/+page.svelte +1490 -0
  62. package/package.json +1 -1
@@ -0,0 +1,209 @@
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
+ <script>
19
+ import { auth } from '$lib/stores/auth';
20
+ import { login } from '$lib/api/auth';
21
+ import { theme } from '$lib/stores/theme';
22
+
23
+ let email = '';
24
+ let password = '';
25
+ let error = '';
26
+ let loading = false;
27
+
28
+ async function handleSubmit() {
29
+ error = '';
30
+ loading = true;
31
+ try {
32
+ const { token, user } = await login({ email, password });
33
+ auth.login(token, user);
34
+ window.location.href = '/';
35
+ } catch (e) {
36
+ error = e.message || 'Login failed';
37
+ } finally {
38
+ loading = false;
39
+ }
40
+ }
41
+
42
+ function onKeydown(e) {
43
+ if (e.key === 'Enter') handleSubmit();
44
+ }
45
+ </script>
46
+
47
+ <svelte:head><title>Sign in — Plum</title></svelte:head>
48
+
49
+ <div class="page" data-theme={$theme}>
50
+ <div class="card">
51
+ <div class="brand">
52
+ <span class="brand-serif">Pl</span><span class="brand-sans">um</span>
53
+ </div>
54
+ <h1 class="title">Sign in</h1>
55
+ <p class="subtitle">Access your test workspace</p>
56
+
57
+ <div class="fields">
58
+ <div class="field">
59
+ <label class="label" for="email">Email</label>
60
+ <input
61
+ id="email"
62
+ type="email"
63
+ class="input"
64
+ bind:value={email}
65
+ placeholder="jane@example.com"
66
+ autocomplete="email"
67
+ on:keydown={onKeydown}
68
+ />
69
+ </div>
70
+ <div class="field">
71
+ <label class="label" for="password">Password</label>
72
+ <input
73
+ id="password"
74
+ type="password"
75
+ class="input"
76
+ bind:value={password}
77
+ placeholder="••••••••"
78
+ autocomplete="current-password"
79
+ on:keydown={onKeydown}
80
+ />
81
+ </div>
82
+ </div>
83
+
84
+ {#if error}
85
+ <p class="error">{error}</p>
86
+ {/if}
87
+
88
+ <button class="submit-btn" on:click={handleSubmit} disabled={loading || !email || !password}>
89
+ {loading ? 'Signing in…' : 'Sign in'}
90
+ </button>
91
+ </div>
92
+ </div>
93
+
94
+ <style>
95
+ .page {
96
+ min-height: 100vh;
97
+ background: var(--bg);
98
+ display: flex;
99
+ align-items: center;
100
+ justify-content: center;
101
+ padding: 1rem;
102
+ }
103
+
104
+ .card {
105
+ width: 100%;
106
+ max-width: 380px;
107
+ background: var(--bg-elevated);
108
+ border: 1px solid var(--border);
109
+ border-radius: var(--radius-lg);
110
+ padding: 2.5rem 2rem;
111
+ display: flex;
112
+ flex-direction: column;
113
+ gap: 1.25rem;
114
+ }
115
+
116
+ .brand {
117
+ font-size: 1.5rem;
118
+ letter-spacing: -0.02em;
119
+ margin-bottom: -0.25rem;
120
+ }
121
+
122
+ .brand-serif {
123
+ font-family: var(--font-display);
124
+ font-weight: 400;
125
+ color: var(--accent);
126
+ }
127
+
128
+ .brand-sans {
129
+ font-family: var(--font-body);
130
+ font-weight: 400;
131
+ color: var(--text);
132
+ }
133
+
134
+ .title {
135
+ font-size: 1.5rem;
136
+ font-weight: 600;
137
+ color: var(--text);
138
+ margin: 0;
139
+ }
140
+
141
+ .subtitle {
142
+ font-size: 0.875rem;
143
+ color: var(--text-muted);
144
+ margin: -0.75rem 0 0;
145
+ }
146
+
147
+ .fields {
148
+ display: flex;
149
+ flex-direction: column;
150
+ gap: 0.875rem;
151
+ }
152
+
153
+ .field {
154
+ display: flex;
155
+ flex-direction: column;
156
+ gap: 0.375rem;
157
+ }
158
+
159
+ .label {
160
+ font-size: 0.8125rem;
161
+ font-weight: 500;
162
+ color: var(--text);
163
+ }
164
+
165
+ .input {
166
+ height: 38px;
167
+ padding: 0 0.75rem;
168
+ font-family: var(--font-body);
169
+ font-size: 0.875rem;
170
+ color: var(--text);
171
+ background: var(--bg);
172
+ border: 1px solid var(--border);
173
+ border-radius: var(--radius-sm);
174
+ outline: none;
175
+ transition: border-color var(--duration-fast);
176
+ }
177
+
178
+ .input:focus {
179
+ border-color: var(--accent);
180
+ }
181
+
182
+ .error {
183
+ font-size: 0.8125rem;
184
+ color: var(--fail);
185
+ margin: -0.25rem 0 0;
186
+ }
187
+
188
+ .submit-btn {
189
+ height: 40px;
190
+ background: var(--accent);
191
+ color: #fff;
192
+ border: none;
193
+ border-radius: var(--radius-sm);
194
+ font-family: var(--font-body);
195
+ font-size: 0.875rem;
196
+ font-weight: 500;
197
+ cursor: pointer;
198
+ transition: opacity var(--duration-fast);
199
+ }
200
+
201
+ .submit-btn:disabled {
202
+ opacity: 0.5;
203
+ cursor: not-allowed;
204
+ }
205
+
206
+ .submit-btn:not(:disabled):hover {
207
+ opacity: 0.88;
208
+ }
209
+ </style>
@@ -25,6 +25,7 @@
25
25
  toggleCronJob
26
26
  } from '$lib/api/schedules';
27
27
  import { fetchRunners } from '$lib/api/runners';
28
+ import { fetchIntegrations } from '$lib/api/settings';
28
29
  import { activeCronJobs } from '$lib/stores/runner';
29
30
  import { BROWSERS, TOAST_TIMEOUT_MS } from '$lib/constants';
30
31
  import { stagger } from '$lib/utils/format';
@@ -50,6 +51,7 @@
50
51
 
51
52
  let cronJobs = [];
52
53
  let availableRunners = [];
54
+ let integrations = { discordWebhookUrl: '', slackWebhookUrl: '', notifyPublicUrl: '' };
53
55
  let toast = null;
54
56
 
55
57
  let modalOpen = false;
@@ -64,7 +66,9 @@
64
66
  tags: '',
65
67
  workers: 1,
66
68
  browser: 'chromium',
67
- runnerIds: ['built-in']
69
+ runnerIds: ['built-in'],
70
+ notifyDiscord: false,
71
+ notifySlack: false
68
72
  };
69
73
  let selectedSchedule = '';
70
74
  let useCustomCron = false;
@@ -137,7 +141,9 @@
137
141
  tags: '',
138
142
  workers: 1,
139
143
  browser: 'chromium',
140
- runnerIds: ['built-in']
144
+ runnerIds: ['built-in'],
145
+ notifyDiscord: false,
146
+ notifySlack: false
141
147
  };
142
148
  selectedSchedule = '';
143
149
  useCustomCron = false;
@@ -157,7 +163,9 @@
157
163
  tags: job.tags,
158
164
  workers: job.workers ?? 1,
159
165
  browser: job.browser ?? 'chromium',
160
- runnerIds: prunedIds.length > 0 ? prunedIds : ['built-in']
166
+ runnerIds: prunedIds.length > 0 ? prunedIds : ['built-in'],
167
+ notifyDiscord: job.notifyDiscord ?? false,
168
+ notifySlack: job.notifySlack ?? false
161
169
  };
162
170
  const isPreset = scheduleOptions.some((o) => o.value === job.cronExpression);
163
171
  useCustomCron = !isPreset;
@@ -231,10 +239,15 @@
231
239
  }
232
240
 
233
241
  onMount(async () => {
234
- cronJobs = await fetchCronJobs();
235
- try {
236
- availableRunners = await fetchRunners();
237
- } catch {}
242
+ [cronJobs, availableRunners, integrations] = await Promise.all([
243
+ fetchCronJobs(),
244
+ fetchRunners().catch(() => []),
245
+ fetchIntegrations().catch(() => ({
246
+ discordWebhookUrl: '',
247
+ slackWebhookUrl: '',
248
+ notifyPublicUrl: ''
249
+ }))
250
+ ]);
238
251
  });
239
252
  </script>
240
253
 
@@ -373,6 +386,26 @@
373
386
  </div>
374
387
  </div>
375
388
 
389
+ {#if integrations.discordWebhookUrl || integrations.slackWebhookUrl}
390
+ <div class="field">
391
+ <div class="field-label"><span>Notifications</span></div>
392
+ <div class="notify-checks">
393
+ {#if integrations.discordWebhookUrl}
394
+ <label class="notify-check-option">
395
+ <input type="checkbox" bind:checked={form.notifyDiscord} />
396
+ <span>Discord</span>
397
+ </label>
398
+ {/if}
399
+ {#if integrations.slackWebhookUrl}
400
+ <label class="notify-check-option">
401
+ <input type="checkbox" bind:checked={form.notifySlack} />
402
+ <span>Slack</span>
403
+ </label>
404
+ {/if}
405
+ </div>
406
+ </div>
407
+ {/if}
408
+
376
409
  {#if formError}
377
410
  <p class="form-error">{formError}</p>
378
411
  {/if}
@@ -859,4 +892,29 @@
859
892
  text-overflow: ellipsis;
860
893
  max-width: 180px;
861
894
  }
895
+
896
+ /* Notification checkboxes in modal */
897
+ .notify-checks {
898
+ display: flex;
899
+ flex-direction: row;
900
+ gap: 1rem;
901
+ padding: 0.375rem 0;
902
+ }
903
+
904
+ .notify-check-option {
905
+ display: flex;
906
+ align-items: center;
907
+ gap: 0.5rem;
908
+ font-size: 0.8125rem;
909
+ color: var(--text);
910
+ cursor: pointer;
911
+ }
912
+
913
+ .notify-check-option input[type='checkbox'] {
914
+ accent-color: var(--accent);
915
+ width: 13px;
916
+ height: 13px;
917
+ flex-shrink: 0;
918
+ cursor: pointer;
919
+ }
862
920
  </style>