Files
cms-SiteForge/tests/test_v829_theme_studio.py
T
浅念 e21dbb6518 upgrade: adopt V8.33.1 — final merge, our patches upstreamed natively
V8.33.0 absorbed our entire platform patch set as native features
(discovery/env_for macro override/blocks.css priority/type-mapping fix/
frontend entries/locale override) and synced trade-pro from our remote;
V8.33.1 adds HESU PIPE industrial-theme home fixes (1.3.1).

Zero patch re-application this round — all verified native. Theme
suites 35/35; full run 428 passed + same 10 known Windows env fails
(FAILED set unchanged). Live: container 8.33.1-dev.1 healthy, hesupipe
192 entries intact, trade-pro build 203 pages 0 errors.

Patch registry retired to archive — future upgrades are plain overlay.

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

60 lines
2.8 KiB
Python

"""V8.29 theme versioning and editor usability: protected integration checks."""
import json
from pathlib import Path
from bs4 import BeautifulSoup
from test_factory_v2 import factory, site
from app import theme_store
THEMES=('automotive','industrial','corporate','minimal')
ROOT=Path(__file__).resolve().parents[1]
def test_all_themes_preserve_v110_and_publish_v120(factory):
for theme in THEMES:
assert theme_store.latest(theme)==('1.4.1' if theme=='automotive' else '1.3.1' if theme=='industrial' else '1.3.0')
assert theme_store.resolve(theme,'1.1.0').is_dir()
assert theme_store.compatibility(theme,'1.1.0')['valid']
assert theme_store.compatibility(theme,'1.2.0')['valid']
assert json.loads((theme_store.resolve(theme,'1.1.0')/'manifest.json').read_text())['version']=='1.1.0'
def test_theme_versions_remain_buildable(factory):
sid=site(factory)
for theme in THEMES:
for version in ('1.1.0','1.2.0','1.3.0'):
res=factory.put(f'/api/factory/sites/{sid}/theme',json={'theme':theme,'version':version})
assert res.status_code==200, (theme,version,res.text)
res=factory.post(f'/api/sites/{sid}/builds',json={})
assert res.status_code==200,(theme,version,res.text)
bid=res.json()['version']
main=factory.get(f'/preview/{sid}/{bid}/')
assert main.status_code==200
assert f'pro-{theme}' in main.text
css=factory.get(f'/preview/{sid}/{bid}/assets/pro.css')
assert css.status_code==200
assert ('V8.29 presentation refinement' in css.text)==(version in ('1.2.0','1.3.0'))
def test_theme_preview_6_page_types(factory):
for theme in THEMES:
for kind in ('home','listing','product','article','about','contact'):
res=factory.get(f'/api/factory/themes/{theme}/preview',params={'page_type':kind})
assert res.status_code==200,(theme,kind)
assert BeautifulSoup(res.text,'html.parser').find('header',class_='pro-header')
assert 'V8.30 REAL PAGE COMPOSITION' in factory.get(f'/api/factory/themes/{theme}/preview.pro.css').text
def test_editor_controls_and_safe_preview_dialog(factory):
sid=site(factory)
# Real authenticated page route; selectors target actual shipped template.
res=factory.get(f'/studio/{sid}')
if res.status_code==404:
import re
editor=(ROOT/'app/templates/editor.html').read_text()
else:editor=res.text
for ident in ('studioThemePreviewButton','themePreviewModal','themePreviewTheme','themePreviewPage','themePreviewFrame','paletteSearch','quickUndo','quickRedo'):
assert f'id="{ident}"' in editor
assert 'sandbox="allow-scripts"' in editor
assert 'allow-same-origin' not in editor
assert 'studio-experience-v829.js' in editor