601451f22b
Overlay ~150 upstream items onto our V8.12 base, preserving trade-pro
theme, registry tests, and design docs. Re-applied our patch set
(discovery/env_for/blocks.css/type-mapping/theme_color/frontend entries,
test_theme_pro_v3 mods) — all anchors survived upstream evolution.
New platform enhancement (fixes upgrade-introduced regression):
multilingual.site_locale now honors settings_json.locale, plus
PUT /api/i18n/sites/{id}/locale — standalone English sites get
<html lang='en'> under the V8.15 locale-rewrite pipeline.
compose: adopt V8.21.3 (image 8.21.3-dev.1, /api/ready probes, MySQL/S3
env) with project name pinned to siteforge-v8-10 (data volumes).
Tests: 356 passed / 11 failed — all 11 confirmed pre-existing in
pristine V8.21.3 on this host (10 upstream Windows env + our build test
now green after locale fix). Patch registry updated in plan doc.
Co-Authored-By: Claude Code <noreply@anthropic.com>
75 lines
2.9 KiB
Python
75 lines
2.9 KiB
Python
"""V8.12 workbench usability, security boundaries and backend compatibility."""
|
|
from app.version import VERSION
|
|
from test_factory import client
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
|
|
def test_workbench_has_real_entry_and_assets(client):
|
|
html=client.get('/').text
|
|
assert '/ui/workspace.js' in html and 'sitePicker' in html
|
|
assert client.get('/ui/workspace.js').status_code==200
|
|
assert client.get('/ui/workspace.css').status_code==200
|
|
|
|
|
|
def test_authorized_site_restoration_and_browser_history(client):
|
|
js=client.get('/ui/workspace.js').text
|
|
assert 'siteforge:selected-site' in js
|
|
assert "state.sites.some(x=>x.id===id)" in js
|
|
assert "state.sites.some(x=>x.id===id)" in js
|
|
assert "window.addEventListener('popstate'" in js
|
|
assert "history[replace?'replaceState':'pushState']" in js
|
|
assert "const token=++state.selectionToken" in js
|
|
|
|
|
|
def test_build_screen_recovers_durable_worker_jobs(client):
|
|
js=client.get('/ui/workspace.js').text
|
|
assert '/api/enterprise/sites/' in js
|
|
assert 'function activeJobs()' in js
|
|
assert 'refreshBuilds()' in js
|
|
assert 'cancel-job' in js and 'async function cancelJob' in js
|
|
assert '交付前检查' in js and '/migration/readiness' in js
|
|
assert 'setInterval' in js and '!document.hidden' in js
|
|
|
|
|
|
def test_build_rejects_download_while_incomplete(client):
|
|
js=client.get('/ui/workspace.js').text
|
|
assert '尚未完成,暂不能下载' in js
|
|
assert 'status' in js and "['done','completed','success','complete']" in js
|
|
|
|
|
|
def test_safe_import_is_default_and_direct_import_is_explicit(client):
|
|
js=client.get('/ui/workspace.js').text
|
|
assert '推荐:先预演再导入' in js
|
|
assert '直接写入网站(不可批次回滚)' in js
|
|
assert '安全导入与批次回滚' in js
|
|
assert "if(!confirm('将文件内容直接写入" in js
|
|
|
|
|
|
def test_wizard_does_not_claim_design_automatically_finished(client):
|
|
js=client.get('/ui/workspace.js').text
|
|
assert 'optional:true,view:\'design\'' in js
|
|
assert '不自动标记为完成' not in js or '设计可以随时修改' in js
|
|
|
|
|
|
def test_live_job_endpoint_can_list_user_site_jobs(client):
|
|
site=client.post('/api/sites',json={'name':'UI V8.12 smoke','theme':'corporate'})
|
|
assert site.status_code==201,site.text
|
|
sid=site.json()['id']
|
|
result=client.get(f'/api/enterprise/sites/{sid}/jobs')
|
|
assert result.status_code==200,result.text
|
|
assert isinstance(result.json(),list)
|
|
audit=client.get(f'/api/factory/sites/{sid}/migration/readiness')
|
|
assert audit.status_code==200,audit.text
|
|
assert 'gates' in audit.json()
|
|
|
|
|
|
def test_version_is_updated(client):
|
|
assert client.get('/api/health').json()['version']==VERSION
|
|
|
|
|
|
def test_js_standalone_syntax():
|
|
root=Path(__file__).resolve().parents[1]
|
|
proc=subprocess.run(['node','--check',str(root/'app/static/workspace.js')],capture_output=True,text=True)
|
|
assert proc.returncode==0,proc.stderr
|