8cea7dee20
- SiteForge Enterprise V8.10.0-dev.1 upstream source (210 tests) - Fix: v8_workflows._mapped_input now reads both 类型/分类 columns so WXR imports keep post/product types instead of collapsing to page - Docs: trade-pro theme port spec (R3) and implementation plan Co-Authored-By: Claude Code <noreply@anthropic.com>
50 lines
2.2 KiB
Python
50 lines
2.2 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())
|