plum-e2e 2.5.3 → 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
|
|
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
|
|
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
|
|
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 })
|
|
@@ -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>
|
|
@@ -91,7 +91,9 @@
|
|
|
91
91
|
$: filtered = suites
|
|
92
92
|
.map((suite) => {
|
|
93
93
|
if (!q) return suite;
|
|
94
|
-
const suiteMatches =
|
|
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) ||
|