34 lines
1.8 KiB
Python
34 lines
1.8 KiB
Python
|
|
"""V8.21.2 task-first studio surface and backward-compatibility checks."""
|
||
|
|
from pathlib import Path
|
||
|
|
from bs4 import BeautifulSoup
|
||
|
|
ROOT=Path(__file__).resolve().parents[1]
|
||
|
|
|
||
|
|
def test_primary_workflow_is_visible_and_document_has_unique_controls():
|
||
|
|
soup=BeautifulSoup((ROOT/'app/templates/editor.html').read_text(), 'html.parser')
|
||
|
|
for control in ('saveDraftButton','publishDesignButton','sfAddBlock','sfGuideDialog','pageSelect','blockList','sitePreview','inspector','sfLibraryPanel'):
|
||
|
|
assert len(soup.select('#'+control))==1,control
|
||
|
|
assert soup.select_one('#saveDraftButton').find_parent('details') is None
|
||
|
|
assert soup.select_one('#publishDesignButton').find_parent('details') is None
|
||
|
|
assert soup.select_one('#sfLibraryPanel').has_attr('hidden')
|
||
|
|
assert len(soup.select('.sf-step'))==3
|
||
|
|
assert soup.select_one('#sitePreview')['sandbox']==['allow-scripts']
|
||
|
|
|
||
|
|
def test_editor_add_and_direct_canvas_selection():
|
||
|
|
js=(ROOT/'app/static/editor.js').read_text()
|
||
|
|
api=(ROOT/'app/main.py').read_text()
|
||
|
|
for method in ('toggleLibrary(force)','updateGuidance()','showHelp()','select(i)','arrayEditor(field,value,type)','itemField(field,index,key,value)','addItem(field)','removeItem(field,index)','moveItem(field,index,by)'):
|
||
|
|
assert method in js
|
||
|
|
assert "siteforge-select-block" in js
|
||
|
|
assert "siteforge-select-block" in api
|
||
|
|
assert 'event.source!==frame.contentWindow' in js
|
||
|
|
assert "studio-draft/publish" in js
|
||
|
|
assert 'expected_revision' in js
|
||
|
|
assert 'eval(' not in js
|
||
|
|
|
||
|
|
def test_no_change_to_block_blueprint_or_database_schema():
|
||
|
|
demo=ROOT/'examples/Studio_V8_21_2_新手友好版交互预览.html'
|
||
|
|
assert demo.exists()
|
||
|
|
assert '演示操作不会修改正式网站' in demo.read_text()
|
||
|
|
from app.version import VERSION
|
||
|
|
assert VERSION.startswith('8.21.') and VERSION.endswith('-dev.1')
|