plum-e2e 2.5.3 → 2.5.5

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 })
@@ -463,14 +479,19 @@ async function serverUpdate() {
463
479
  isAlive(registry[String(nodeCfg.id)].pid)
464
480
  );
465
481
 
482
+ // Re-exec `plum` as a fresh process for the restart steps rather than
483
+ // calling serverRestart()/nodeRestart() directly — this same process
484
+ // already loaded the OLD code into memory before npm install ran above,
485
+ // so calling them in-process would rebuild using stale logic no matter
486
+ // how new the just-installed files on disk actually are.
466
487
  if (hasServerCfg) {
467
- clack.log.step('Rebuilding server with new version…');
468
- await serverRestart();
488
+ clack.log.step('Rebuilding server with the newly installed version…');
489
+ execSync('plum server restart', { stdio: 'inherit' });
469
490
  }
470
491
 
471
492
  if (nodeRunning) {
472
- clack.log.step('Restarting node runner with new version…');
473
- await nodeRestart();
493
+ clack.log.step('Restarting node runner with the newly installed version…');
494
+ execSync('plum node restart', { stdio: 'inherit' });
474
495
  }
475
496
 
476
497
  if (!hasServerCfg && !nodeRunning) {
@@ -710,6 +731,14 @@ async function openManageRunnersMenu(primaryUrl) {
710
731
  * "plum <command>" to run the desired command.
711
732
  * ------------------------------------------------------ */
712
733
  switch (command) {
734
+ case '--version':
735
+ case '-v':
736
+ case 'version': {
737
+ const pkg = JSON.parse(fs.readFileSync(path.join(plumRoot, 'package.json'), 'utf8'));
738
+ console.log(pkg.version);
739
+ break;
740
+ }
741
+
713
742
  case 'init': {
714
743
  clack.intro(pc.bgMagenta(pc.white(' 🟣 Plum — Init ')));
715
744
 
@@ -1169,6 +1198,7 @@ switch (command) {
1169
1198
  default:
1170
1199
  console.log('--------------------------------------\n');
1171
1200
  console.log('Usage: plum <command>\n');
1201
+ console.log(' --version, -v Print the installed Plum version');
1172
1202
  console.log(' init Set up a new Plum project');
1173
1203
  console.log(' server start Start the full UI stack (interactive)');
1174
1204
  console.log(' --headless <bool> Run browsers headless (true/false)');
@@ -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 = 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) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plum-e2e",
3
- "version": "2.5.3",
3
+ "version": "2.5.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/silverlunah/plum.git"