feat(2): Q1.2 — n8n Phase-2 parity + functional + robust install (full e2e green)
- tests/n8n/PARITY.md: parity table (health_check ported) + 2 recipe-specific functional tests with rationale + data-integrity section pointing to Phase-1d/1e lifecycle overlays. - tests/n8n/functional/test_health_check.py: parity port of recipe-info/n8n/tests/health_check.py — SOURCE comment. - tests/n8n/functional/test_rest_settings.py: NEW recipe-specific — polls /rest/settings until response is application/json (not the 'n8n is starting up' SPA placeholder); asserts known n8n public-settings keys (userManagement/defaultLocale/authCookie) in the 'data' envelope. Proves the editor SPA's primary API contract is intact. - tests/n8n/functional/test_login_state.py: NEW recipe-specific — polls /rest/login until response is JSON; proves the user-management/auth subsystem initialized on top of the public-settings layer. - tests/n8n/test_install.py: install overlay's Playwright now polls page.goto until status==200 (n8n's / route can return 404 briefly while the SPA route registers on top of /healthz=200). Bounded poll, no bare sleep, raise on persistent failure — same robustness pattern as Phase-1e exec_in_app. Cold-verifiable on cc-ci (log /root/ccci-q1-n8n-r3.log): RECIPE=n8n cc-ci-run runner/run_recipe_ci.py all 5 stages PASS, deploy-count=1, head_ref=63dd3e0f==chaos-version=63dd3e0f, version 3.1.0+2.9.4 -> 3.2.0+2.20.6 (HC1 non-vacuous), 5 lifecycle assertions + 3 custom-stage assertions all PASS. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -20,6 +20,10 @@ def test_serving_and_editor(live_app, meta):
|
||||
assert status == 200, f"expected 200 from {live_app}/healthz, got {status}"
|
||||
|
||||
# A real browser loads the live n8n editor SPA over HTTPS.
|
||||
# n8n's boot is staged: /healthz returns 200 before / route is registered. So we may briefly
|
||||
# get 404 from /, then a 200 with the "starting up" placeholder, then the actual SPA. Poll
|
||||
# page.goto until status==200 (route registered) — Phase 1e exec_in_app pattern: bounded poll,
|
||||
# no bare sleep, raise on persistent failure.
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
url = f"https://{live_app}/"
|
||||
@ -28,11 +32,20 @@ def test_serving_and_editor(live_app, meta):
|
||||
try:
|
||||
ctx = browser.new_context(ignore_https_errors=True)
|
||||
page = ctx.new_page()
|
||||
resp = page.goto(url, wait_until="domcontentloaded", timeout=60000)
|
||||
assert resp is not None and resp.status in (
|
||||
200,
|
||||
304,
|
||||
), f"page status {resp and resp.status}"
|
||||
import time
|
||||
|
||||
deadline = time.time() + 120
|
||||
resp = None
|
||||
last_status = 0
|
||||
while time.time() < deadline:
|
||||
resp = page.goto(url, wait_until="domcontentloaded", timeout=30000)
|
||||
last_status = resp.status if resp is not None else 0
|
||||
if last_status in (200, 304):
|
||||
break
|
||||
time.sleep(3)
|
||||
assert resp is not None and last_status in (200, 304), (
|
||||
f"page status {last_status} after polling — n8n route never came up"
|
||||
)
|
||||
body = page.content().lower()
|
||||
assert "n8n" in body or "<html" in body, "no n8n content served"
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user