[object Object]

← back to Wallco Ai

deploy: run PDP theme smoke test as step [5b/6] after health check (rc3=skip if no browser, else block on theme-wiring failure)

a1e2cc71f73be068cb583aa4b4694bfdb2f355bd · 2026-06-01 16:51:15 -0700 · Steve Abrams

Files touched

Diff

commit a1e2cc71f73be068cb583aa4b4694bfdb2f355bd
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Jun 1 16:51:15 2026 -0700

    deploy: run PDP theme smoke test as step [5b/6] after health check (rc3=skip if no browser, else block on theme-wiring failure)
---
 deploy-kamatera.sh           | 16 ++++++++++++++++
 scripts/smoke-test-themes.js | 22 ++++++++++++++++++----
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/deploy-kamatera.sh b/deploy-kamatera.sh
index c115c41..66e3032 100755
--- a/deploy-kamatera.sh
+++ b/deploy-kamatera.sh
@@ -169,6 +169,22 @@ if [ "$STATUS" != "200" ]; then
   exit 1
 fi
 
+# 6b. PDP theme smoke test — themes must be FULLY WIRED (Steve standing rule).
+# Loads every theme variant + the v11 Wallpaper/Wall Mural toggle against the
+# just-deployed site and asserts each control re-renders its dependent DOM.
+# rc 0 = pass, rc 3 = environment can't run a browser (skip), else = FAIL.
+echo "[5b/6] PDP theme smoke test → https://$SITE"
+SMOKE_RC=0
+BASE="https://$SITE" node "$LOCAL_DIR/scripts/smoke-test-themes.js" || SMOKE_RC=$?
+if [ "$SMOKE_RC" = "0" ]; then
+  echo "  OK — all PDP theme smoke checks passed."
+elif [ "$SMOKE_RC" = "3" ]; then
+  echo "  SKIPPED — no usable browser/Playwright in this environment; theme smoke test not run."
+else
+  echo "ERROR: PDP theme smoke test FAILED (rc=$SMOKE_RC) — a theme is not fully wired (see output above)."
+  exit 1
+fi
+
 # 7. Nginx vhost (create if not present)
 echo "[6/6] nginx vhost..."
 VHOST_SRC="/etc/nginx/sites-available/$SITE"
diff --git a/scripts/smoke-test-themes.js b/scripts/smoke-test-themes.js
index 18f9c95..7e59886 100644
--- a/scripts/smoke-test-themes.js
+++ b/scripts/smoke-test-themes.js
@@ -19,17 +19,26 @@
  *   node scripts/smoke-test-themes.js <designId> <BASE>
  *
  * Playwright is resolved from a sibling project if not installed locally.
+ *
+ * Exit codes (so the deploy can tell "broken theme" from "can't run here"):
+ *   0  all checks passed
+ *   1  a theme is NOT fully wired (smoke failure) — deploy should block
+ *   2  unexpected harness error
+ *   3  environment can't run the test (no Playwright / no browser / no design)
+ *      — deploy should SKIP, not fail
  */
 'use strict';
 
+const EXIT_SKIP = 3;
+
 function loadChromium() {
   const tries = [
     'playwright',
     '/Users/stevestudio2/Projects/animals/node_modules/playwright',
   ];
   for (const t of tries) { try { return require(t).chromium; } catch {} }
-  console.error('FATAL: playwright not found (tried: ' + tries.join(', ') + ')');
-  process.exit(2);
+  console.error('SKIP: playwright not found (tried: ' + tries.join(', ') + ')');
+  process.exit(EXIT_SKIP);
 }
 
 const BASE = process.argv[3] || process.env.BASE || 'https://wallco.ai';
@@ -61,7 +70,7 @@ async function pickDesignId() {
 
 (async () => {
   const id = process.argv[2] || await pickDesignId();
-  if (!id) { console.error('FATAL: no design id (API gave none)'); process.exit(2); }
+  if (!id) { console.error('SKIP: no design id (API gave none / site unreachable)'); process.exit(EXIT_SKIP); }
   console.log(`\nPDP theme smoke test — base=${BASE} design=#${id}\n`);
 
   const chromium = loadChromium();
@@ -70,7 +79,12 @@ async function pickDesignId() {
     browser = await chromium.launch();
   } catch (e) {
     // Bundled browser missing — fall back to the system Google Chrome install.
-    browser = await chromium.launch({ channel: 'chrome' });
+    try {
+      browser = await chromium.launch({ channel: 'chrome' });
+    } catch (e2) {
+      console.error('SKIP: no usable browser (bundled Chromium absent and system Chrome launch failed): ' + e2.message.split('\n')[0]);
+      process.exit(EXIT_SKIP);
+    }
   }
   const ctx = await browser.newContext({ viewport: { width: 1400, height: 1100 } });
 

← 8919030 add PDP theme smoke test — verifies every theme renders + v1  ·  back to Wallco Ai  ·  security: admin-gate the entire /api/generator/* surface + / 64c2db6 →