Files
cms-SiteForge/tests/test_workspace_v810.py
浅念 8884e100f9 upgrade: adopt V8.31.1 (theme 1.3/1.4 redesigns, editor deep-canvas, guided launch, component library)
Overlay 190 upstream items (V8.22→8.31) preserving trade-pro theme,
registry tests, and design docs. Re-applied full patch set on identical
anchors (discovery/env_for/blocks.css/type-mapping/locale-override/
theme_color/frontend entries/test_theme_pro_v3 mods) plus compose pins.

Verified: theme suites 35/35; dual-baseline full run 415 passed vs
pristine 386+29 ours, FAILED-set diff EMPTY (same 10 Windows env fails).
Live: container 8.31.1-dev.1 healthy, hesupipe 192 entries intact,
trade-pro build 203 pages 0 errors.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-26 09:43:17 +08:00

50 lines
2.3 KiB
Python

"""V8.10 usability regression: simplified admin replaces only the default UI.
Preserves existing API endpoints and the opt-in legacy console.
"""
from pathlib import Path
from test_factory import client
def test_default_workspace_has_guided_navigation(client):
page=client.get('/')
assert page.status_code==200
for label in ('工作台','我的网站','网站概览','内容与页面','外观与设计',
'导入与迁移','生成与预览','检查并上线','网站设置','高级工具'):
assert label in page.text
assert '/ui/workspace.js' in page.text
assert '/ui/workspace.css' in page.text
assert '/production-v8' in page.text and '/operations' in page.text
def test_old_console_still_available_but_not_default(client):
assert '/ui/workspace.js' not in client.get('/classic').text
assert 'admin.js' in client.get('/classic').text
assert client.get('/production-v8').status_code==200
assert client.get('/factory-studio').status_code==200
def test_workspace_static_assets_and_login_guard(client):
js=client.get('/ui/workspace.js');css=client.get('/ui/workspace.css')
assert js.status_code==200 and css.status_code==200
assert 'X-SiteForge-CSRF' in js.text
assert 'encodeURIComponent' in js.text
assert '/api/sites' in js.text
assert 'grid-template-columns' in css.text
assert 'max-width:570px' in css.text
def test_workspace_new_site_and_content_api(client):
created=client.post('/api/sites',json={'name':'UI Acceptance','theme':'industrial','mode':'new'})
assert created.status_code==201
sid=created.json()['id']
assert len(client.get(f'/api/sites/{sid}/entries').json())==1
created_entry=client.post(f'/api/sites/{sid}/entries',json={
'type':'product','title':'P001 产品','route':'/products/p001/','summary':'测试产品'})
assert created_entry.status_code==201
edited=client.patch(f'/api/sites/{sid}/entries/{created_entry.json()["id"]}',
json={'summary':'用户界面已修改'})
assert edited.status_code==200
switched=client.patch(f'/api/sites/{sid}',json={'theme':'corporate'})
assert switched.status_code==200
assert any(e['summary']=='用户界面已修改' for e in client.get(f'/api/sites/{sid}/entries').json())