plum-e2e 2.5.2 → 2.5.4

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/bin/plum.js CHANGED
@@ -285,6 +285,22 @@ function applyServerConfig(cfg) {
285
285
  // 127.0.0.1 sidesteps the DNS/happy-eyeballs mismatch entirely.
286
286
  const READY_POLL_INTERVAL_MS = 2000;
287
287
  const READY_POLL_MAX_ATTEMPTS = 90; // ~3 minutes
288
+ // Each poll attempt must itself be bounded — a single fetch() with no timeout
289
+ // can hang on a stale/dead connection (e.g. right after a container restart)
290
+ // and stall the whole loop indefinitely, regardless of the attempt budget
291
+ // above. This is what caused the intermittent endless "Waiting for server to
292
+ // be ready…" even when the server was already reachable elsewhere.
293
+ const FETCH_ATTEMPT_TIMEOUT_MS = 3000;
294
+
295
+ async function fetchWithTimeout(url, options = {}) {
296
+ const controller = new AbortController();
297
+ const timer = setTimeout(() => controller.abort(), FETCH_ATTEMPT_TIMEOUT_MS);
298
+ try {
299
+ return await fetch(url, { ...options, signal: controller.signal });
300
+ } finally {
301
+ clearTimeout(timer);
302
+ }
303
+ }
288
304
 
289
305
  async function waitForServerReady(apiBase) {
290
306
  const s = clack.spinner();
@@ -293,7 +309,7 @@ async function waitForServerReady(apiBase) {
293
309
  for (let i = 0; i < READY_POLL_MAX_ATTEMPTS; i++) {
294
310
  await new Promise((r) => setTimeout(r, READY_POLL_INTERVAL_MS));
295
311
  try {
296
- const res = await fetch(`${apiBase}/auth/needs-setup`);
312
+ const res = await fetchWithTimeout(`${apiBase}/auth/needs-setup`);
297
313
  if (res.ok) {
298
314
  ready = true;
299
315
  break;
@@ -316,7 +332,7 @@ async function waitForServerReady(apiBase) {
316
332
  async function runFirstUserSetup(apiBase, uiUrl) {
317
333
  let needsSetup = false;
318
334
  try {
319
- const res = await fetch(`${apiBase}/auth/needs-setup`);
335
+ const res = await fetchWithTimeout(`${apiBase}/auth/needs-setup`);
320
336
  const data = await res.json();
321
337
  needsSetup = data.needsSetup;
322
338
  } catch {}
@@ -349,7 +365,7 @@ async function runFirstUserSetup(apiBase, uiUrl) {
349
365
  }
350
366
 
351
367
  try {
352
- const res = await fetch(`${apiBase}/auth/setup`, {
368
+ const res = await fetchWithTimeout(`${apiBase}/auth/setup`, {
353
369
  method: 'POST',
354
370
  headers: { 'Content-Type': 'application/json' },
355
371
  body: JSON.stringify({ name, email, password })
@@ -17,15 +17,31 @@
17
17
 
18
18
  import { API_BASE } from '$lib/constants';
19
19
 
20
+ // A misconfigured or not-yet-routed API URL can accept a connection and never
21
+ // respond, rather than refusing outright — a plain fetch() would then hang
22
+ // forever with no error to catch. AUTH_TIMEOUT_MS bounds that so the UI always
23
+ // resolves one way or another instead of leaving the page blank indefinitely.
24
+ const AUTH_TIMEOUT_MS = 8000;
25
+
26
+ async function fetchWithTimeout(url, options = {}) {
27
+ const controller = new AbortController();
28
+ const timer = setTimeout(() => controller.abort(), AUTH_TIMEOUT_MS);
29
+ try {
30
+ return await fetch(url, { ...options, signal: controller.signal });
31
+ } finally {
32
+ clearTimeout(timer);
33
+ }
34
+ }
35
+
20
36
  export async function checkNeedsSetup() {
21
- const res = await fetch(`${API_BASE}/auth/needs-setup`);
37
+ const res = await fetchWithTimeout(`${API_BASE}/auth/needs-setup`);
22
38
  if (!res.ok) return false;
23
39
  const data = await res.json();
24
40
  return data.needsSetup;
25
41
  }
26
42
 
27
43
  export async function setup({ name, email, password }) {
28
- const res = await fetch(`${API_BASE}/auth/setup`, {
44
+ const res = await fetchWithTimeout(`${API_BASE}/auth/setup`, {
29
45
  method: 'POST',
30
46
  headers: { 'Content-Type': 'application/json' },
31
47
  body: JSON.stringify({ name, email, password })
@@ -36,7 +52,7 @@ export async function setup({ name, email, password }) {
36
52
  }
37
53
 
38
54
  export async function login({ email, password }) {
39
- const res = await fetch(`${API_BASE}/auth/login`, {
55
+ const res = await fetchWithTimeout(`${API_BASE}/auth/login`, {
40
56
  method: 'POST',
41
57
  headers: { 'Content-Type': 'application/json' },
42
58
  body: JSON.stringify({ email, password })
@@ -47,7 +63,7 @@ export async function login({ email, password }) {
47
63
  }
48
64
 
49
65
  export async function updateProfile({ token, name, email }) {
50
- const res = await fetch(`${API_BASE}/auth/update-profile`, {
66
+ const res = await fetchWithTimeout(`${API_BASE}/auth/update-profile`, {
51
67
  method: 'PUT',
52
68
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
53
69
  body: JSON.stringify({ name, email })
@@ -58,7 +74,7 @@ export async function updateProfile({ token, name, email }) {
58
74
  }
59
75
 
60
76
  export async function changePassword({ token, currentPassword, newPassword }) {
61
- const res = await fetch(`${API_BASE}/auth/change-password`, {
77
+ const res = await fetchWithTimeout(`${API_BASE}/auth/change-password`, {
62
78
  method: 'POST',
63
79
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
64
80
  body: JSON.stringify({ currentPassword, newPassword })
@@ -45,9 +45,11 @@
45
45
 
46
46
  try {
47
47
  const needsSetup = await checkNeedsSetup();
48
- goto(needsSetup ? '/setup' : '/login');
48
+ await goto(needsSetup ? '/setup' : '/login');
49
49
  } catch {
50
- goto('/login');
50
+ await goto('/login');
51
+ } finally {
52
+ ready = true;
51
53
  }
52
54
  });
53
55
  </script>
@@ -62,4 +64,18 @@
62
64
  </PageShell>
63
65
  <RunnerPanel />
64
66
  {/if}
67
+ {:else}
68
+ <div class="boot-loading">Loading…</div>
65
69
  {/if}
70
+
71
+ <style>
72
+ .boot-loading {
73
+ min-height: 100vh;
74
+ display: flex;
75
+ align-items: center;
76
+ justify-content: center;
77
+ background: var(--bg);
78
+ color: var(--text-muted);
79
+ font-size: 0.875rem;
80
+ }
81
+ </style>
@@ -91,7 +91,9 @@
91
91
  $: filtered = suites
92
92
  .map((suite) => {
93
93
  if (!q) return suite;
94
- const suiteMatches = suite.suiteName.toLowerCase().includes(q);
94
+ const suiteMatches =
95
+ suite.suiteName.toLowerCase().includes(q) ||
96
+ suiteIds(suite).some((id) => id.toLowerCase().includes(q));
95
97
  const matchedTests = suite.tests.filter(
96
98
  (t) =>
97
99
  t.testCase.toLowerCase().includes(q) ||
@@ -60,7 +60,9 @@
60
60
  <svelte:head><title>Sign in — Plum</title></svelte:head>
61
61
 
62
62
  <div class="page" data-theme={$theme}>
63
- {#if !checking}
63
+ {#if checking}
64
+ <p class="checking">Checking server…</p>
65
+ {:else}
64
66
  <div class="card">
65
67
  <div class="brand">
66
68
  <span class="brand-serif">Pl</span><span class="brand-sans">um</span>
@@ -116,6 +118,11 @@
116
118
  padding: 1rem;
117
119
  }
118
120
 
121
+ .checking {
122
+ color: var(--text-muted);
123
+ font-size: 0.875rem;
124
+ }
125
+
119
126
  .card {
120
127
  width: 100%;
121
128
  max-width: 380px;
@@ -65,7 +65,9 @@
65
65
  <svelte:head><title>Setup — Plum</title></svelte:head>
66
66
 
67
67
  <div class="page" data-theme={$theme}>
68
- {#if !checking}
68
+ {#if checking}
69
+ <p class="checking">Checking server…</p>
70
+ {:else}
69
71
  <div class="card">
70
72
  <div class="brand">
71
73
  <span class="brand-serif">Pl</span><span class="brand-sans">um</span>
@@ -136,6 +138,11 @@
136
138
  padding: 1rem;
137
139
  }
138
140
 
141
+ .checking {
142
+ color: var(--text-muted);
143
+ font-size: 0.875rem;
144
+ }
145
+
139
146
  .card {
140
147
  width: 100%;
141
148
  max-width: 400px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plum-e2e",
3
- "version": "2.5.2",
3
+ "version": "2.5.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/silverlunah/plum.git"