34 lines
1.7 KiB
Python
34 lines
1.7 KiB
Python
|
|
"""V8.27 novice-facing console: UI wiring + live API smoke."""
|
||
|
|
from pathlib import Path
|
||
|
|
from test_factory import client
|
||
|
|
|
||
|
|
ROOT=Path(__file__).resolve().parents[1]
|
||
|
|
|
||
|
|
def test_workspace_has_progress_and_safe_guidance(client):
|
||
|
|
r=client.get('/')
|
||
|
|
assert r.status_code==200
|
||
|
|
for text in ('建站操作指引','createProgressText','createSubmit','选择风格','确认创建','siteModal'):
|
||
|
|
assert text in r.text
|
||
|
|
assert '/ui/workspace-guide.js' in r.text
|
||
|
|
assert r.text.index('/ui/workspace-guide.js')<r.text.index('/ui/workspace.js')
|
||
|
|
assert client.get('/ui/workspace-guide.js').status_code==200
|
||
|
|
|
||
|
|
def test_guide_is_real_navigation_and_real_api(client):
|
||
|
|
js=client.get('/ui/workspace.js').text
|
||
|
|
for phrase in ('function guide()', 'function renderCreateStep()', 'function openCreateWizard()', "await api('/api/sites','POST',data)", "await selectSite(s.id,'guide')"):
|
||
|
|
assert phrase in js
|
||
|
|
assert '正式上线前需要发布条件检查' in client.get('/ui/workspace-guide.js').text
|
||
|
|
create=client.post('/api/sites',json={'name':'引导式新站','theme':'corporate','mode':'new'})
|
||
|
|
assert create.status_code==201
|
||
|
|
data=create.json()
|
||
|
|
entries=client.get(f"/api/sites/{data['id']}/entries").json()
|
||
|
|
assert len(entries)>=1
|
||
|
|
assert any(x['source']=='starter' for x in entries)
|
||
|
|
|
||
|
|
def test_existing_release_controls_and_permission_barriers_preserved(client):
|
||
|
|
assert client.get('/api/console/bootstrap').status_code==200
|
||
|
|
ws=client.get('/ui/workspace.js').text
|
||
|
|
for phrase in ('releasePreflight()', 'releaseApproval()', 'releaseDeploy()', 'releaseRollback('):
|
||
|
|
assert phrase in ws
|
||
|
|
assert client.get('/classic').status_code==200
|