From 61f006f62d907c7e5b5d406048006cdc9230c889 Mon Sep 17 00:00:00 2001 From: Will Anderson Date: Mon, 11 May 2026 08:19:30 -0500 Subject: [PATCH] Fix CI JS corruption from obfuscator stdout; clean up flaky test guards - Strip [javascript-obfuscator-cli] progress line from elc --obfuscate output before writing to dist/js/ (was prepended to every compiled JS file, causing browser parse errors on stage) - Remove spurious waitForFunction(signUpWithEmail) guards from buyer-name and buyer-email structural tests (pure DOM tests, no auth) - Switch chat.spec.ts beforeEach to domcontentloaded (SSR elements present at DOM ready; networkidle caused cold-start timeouts) --- .gitea/workflows/stage.yaml | 3 ++- tests/e2e/chat.spec.ts | 4 ++-- tests/e2e/checkout-stripe.spec.ts | 2 -- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/stage.yaml b/.gitea/workflows/stage.yaml index 034401e..8ae8874 100644 --- a/.gitea/workflows/stage.yaml +++ b/.gitea/workflows/stage.yaml @@ -207,10 +207,11 @@ jobs: [ -f "$f" ] || continue name=$(basename "$f" .el) echo "Compiling $f..." - "$ELC" --target=js --bundle --minify --obfuscate "$f" > "dist/js/${name}.js" || { + "$ELC" --target=js --bundle --minify --obfuscate "$f" > /tmp/_elc_out.js || { echo "elc FAILED on $f" exit 1 } + sed '/^\[javascript-obfuscator/d' /tmp/_elc_out.js > "dist/js/${name}.js" echo " compiled: $f -> dist/js/${name}.js" done rm -f src/js/el_runtime.js diff --git a/tests/e2e/chat.spec.ts b/tests/e2e/chat.spec.ts index e81a45e..aa4948a 100644 --- a/tests/e2e/chat.spec.ts +++ b/tests/e2e/chat.spec.ts @@ -7,7 +7,7 @@ import { test, expect } from '@playwright/test'; test.describe('Demo chat widget — structure', () => { test.beforeEach(async ({ page }) => { await page.goto('/'); - await page.waitForLoadState('networkidle'); + await page.waitForLoadState('domcontentloaded'); }); test('Demo panel (#neuron-demo-panel) is in the DOM', async ({ page }) => { @@ -41,7 +41,7 @@ test.describe('Demo chat widget — auth gate', () => { .forEach(k => localStorage.removeItem(k)); }); await page.reload(); - await page.waitForLoadState('networkidle'); + await page.waitForLoadState('domcontentloaded'); }); test('Send button is disabled when unauthenticated', async ({ page }) => { diff --git a/tests/e2e/checkout-stripe.spec.ts b/tests/e2e/checkout-stripe.spec.ts index c2ef86a..9725e73 100644 --- a/tests/e2e/checkout-stripe.spec.ts +++ b/tests/e2e/checkout-stripe.spec.ts @@ -186,7 +186,6 @@ test('[professional] payment-message div starts hidden', async ({ page }) => { test('[professional] buyer-name input is present and fillable', async ({ page }) => { await page.goto('/checkout?plan=professional'); - await page.waitForFunction(() => typeof (window as any).signUpWithEmail === 'function', { timeout: 10000 }); await expect(page.locator('#buyer-name')).toBeAttached(); await page.fill('#buyer-name', 'Test User'); expect(await page.locator('#buyer-name').inputValue()).toBe('Test User'); @@ -194,7 +193,6 @@ test('[professional] buyer-name input is present and fillable', async ({ page }) test('[professional] buyer-email input is present and fillable', async ({ page }) => { await page.goto('/checkout?plan=professional'); - await page.waitForFunction(() => typeof (window as any).signUpWithEmail === 'function', { timeout: 10000 }); await expect(page.locator('#buyer-email')).toBeAttached(); await page.fill('#buyer-email', 'test@example.com'); expect(await page.locator('#buyer-email').inputValue()).toBe('test@example.com'); -- 2.52.0