plum-e2e 1.3.6 → 2.1.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/README.md +61 -3
- package/backend/app.js +5 -0
- package/backend/config/scripts/create-test.mjs +172 -0
- package/backend/config/scripts/generate-report.js +2 -1
- package/backend/middleware/jwtAuth.js +33 -0
- package/backend/middleware/requireAdmin.js +25 -0
- package/backend/package.json +2 -0
- package/backend/prisma/migrations/20260618000000_add_test_repository/migration.sql +133 -0
- package/backend/prisma/migrations/20260618000001_add_user_roles/migration.sql +3 -0
- package/backend/prisma/migrations/20260618000002_drop_automated_tag/migration.sql +2 -0
- package/backend/prisma/migrations/20260618000003_entry_assignee/migration.sql +2 -0
- package/backend/prisma/schema.prisma +118 -10
- package/backend/routes/auth.routes.js +96 -0
- package/backend/routes/settings.routes.js +44 -8
- package/backend/routes/test-cases.routes.js +80 -0
- package/backend/routes/test-runs.routes.js +122 -0
- package/backend/routes/test-suites.routes.js +92 -0
- package/backend/routes/users.routes.js +67 -0
- package/backend/scripts/create-test.js +7 -6
- package/backend/services/reportService.js +96 -4
- package/backend/services/runnerService.js +16 -1
- package/backend/services/settingsService.js +18 -2
- package/backend/services/testCaseService.js +139 -0
- package/backend/services/testRunService.js +203 -0
- package/backend/services/testSuiteService.js +191 -0
- package/backend/services/userService.js +114 -0
- package/backend/websockets/socketHandler.js +19 -6
- package/bin/plum.js +105 -9
- package/frontend/src/lib/api/auth.js +69 -0
- package/frontend/src/lib/api/repository.js +256 -0
- package/frontend/src/lib/api/users.js +52 -0
- package/frontend/src/lib/components/layout/Nav.svelte +116 -4
- package/frontend/src/lib/components/layout/RunnerPanel.svelte +243 -29
- package/frontend/src/lib/components/ui/Modal.svelte +8 -1
- package/frontend/src/lib/constants.js +2 -0
- package/frontend/src/lib/stores/auth.js +60 -0
- package/frontend/src/lib/stores/runner.js +9 -2
- package/frontend/src/routes/+layout.svelte +32 -4
- package/frontend/src/routes/+page.svelte +1 -1
- package/frontend/src/routes/login/+page.svelte +209 -0
- package/frontend/src/routes/scheduled-tests/+page.svelte +3 -1
- package/frontend/src/routes/settings/+page.svelte +586 -5
- package/frontend/src/routes/setup/+page.svelte +249 -0
- package/frontend/src/routes/test-repository/+page.svelte +1379 -0
- package/frontend/src/routes/test-repository/runs/[id]/+page.svelte +1549 -0
- package/frontend/src/routes/test-repository/suites/[id]/+page.svelte +1490 -0
- 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>
|
|
@@ -148,14 +148,16 @@
|
|
|
148
148
|
function openEditModal(job) {
|
|
149
149
|
isEditing = true;
|
|
150
150
|
editTaskName = job.taskName;
|
|
151
|
+
const validIds = new Set(['built-in', ...availableRunners.map((r) => r.id)]);
|
|
151
152
|
const storedIds = job.runnerIds ? job.runnerIds.split(',').map((s) => s.trim()) : ['built-in'];
|
|
153
|
+
const prunedIds = storedIds.filter((id) => validIds.has(id));
|
|
152
154
|
form = {
|
|
153
155
|
taskName: job.taskName,
|
|
154
156
|
cronExpression: job.cronExpression,
|
|
155
157
|
tags: job.tags,
|
|
156
158
|
workers: job.workers ?? 1,
|
|
157
159
|
browser: job.browser ?? 'chromium',
|
|
158
|
-
runnerIds:
|
|
160
|
+
runnerIds: prunedIds.length > 0 ? prunedIds : ['built-in']
|
|
159
161
|
};
|
|
160
162
|
const isPreset = scheduleOptions.some((o) => o.value === job.cronExpression);
|
|
161
163
|
useCustomCron = !isPreset;
|