Integrate 0.9.8 NDS read-only lab, repair upstream hook and simplify setup guidance

This commit is contained in:
2026-11-30 21:13:35 +00:00
parent b9fe2e61d2
commit c3aa4688d8
57 changed files with 2894 additions and 36 deletions

View File

@@ -10,6 +10,9 @@ config=dict(version=1,tree='MARS_TREE',organization='HOME',units=['USERS','GROUP
rev='r1'; fail=False; created=0; errors=[]
def fixture(source,path,body):
global config,rev,created
if path=='/api/ncp-ip':
assert not body, 'Presets must not save automatically'
return dict(config={'enabled':False,'address':'192.168.1.10','slp':False},addresses=[{'address':'192.168.1.10','interface':'eth0'}],runtime='disabled',revision='ip1',valid=True)
if path=='/api/state':return state
if path=='/api/status':return {'mars-nwe-pcap.service':'ActiveState=active','mars-pcapd.service':'ActiveState=active'}
if path=='/api/directory':
@@ -31,9 +34,13 @@ with sync_playwright() as p:
page.evaluate("()=>{window.fetch=async(path,opts)=>{const d=await window.fixture(path,opts?.body?JSON.parse(opts.body):null);return {ok:!d.error,status:d.error?503:200,json:()=>d}};}")
html=(root/'index.html').read_text().replace('<link rel="stylesheet" href="/style.css">','<style>'+(root/'style.css').read_text()+'</style>').replace('<script src="/app.js" defer></script>','');page.set_content(html);page.add_script_tag(content=(root/'app.js').read_text());page.wait_for_function("document.getElementById('serverStatus').textContent==='active'")
page.locator('#directoryOpen').click();page.wait_for_function("document.getElementById('directoryChecks').textContent.includes('Betriebsmodus')")
assert 'Noch nicht verfügbar' in page.locator('#directoryChecks').inner_text()
assert 'Keine native NDS-Anmeldung' in page.locator('#directoryChecks').inner_text()
page.locator('#directoryNext').click();page.locator('#directoryTree').fill('INVALID NAME');page.locator('#directoryNext').click();assert 'zulässige' in page.locator('#directoryMessage').inner_text();page.locator('#directoryTree').fill('MARS_TREE');page.locator('#directoryNext').click();page.locator('#directoryAuto').click();page.locator('#directoryNext').click();assert 'Tree / Baum: leer lassen' in page.locator('#directoryClient').input_value();page.locator('#directorySave').click();page.wait_for_function("document.getElementById('directoryMessage').textContent.includes('gespeichert')");assert config['placements']
# A failed reload must not permit a save of stale data.
fail=True;page.locator('#directoryBack').click();page.locator('#directoryBack').click();page.locator('#directoryBack').click();page.locator('#directoryReload').click();page.wait_for_function("document.getElementById('directoryMessage').textContent.includes('Bitte erneut laden')");assert page.locator('#directoryNext').is_disabled();fail=False;page.locator('#directoryReload').click();page.wait_for_function("!document.getElementById('directoryNext').disabled");page.locator('#directoryBindery').click();page.wait_for_function("document.getElementById('bindSummary').textContent.includes('2 Objekte')")
page.locator('#createUser').click();page.locator('[name=name]').fill('alice');page.get_by_role('button',name='Sicheres Kennwort erzeugen').click();pw=page.locator('[name=password]').input_value();assert len(pw)==20 and all(c in '0123456789ABCDEF' for c in pw);page.locator('#actionSubmit').click();page.wait_for_function("document.getElementById('bindSummary').textContent.includes('3 Objekte')");assert created==1;assert page.locator('[name=password]').input_value()==''
page.evaluate("()=>document.querySelectorAll('dialog[open]').forEach(d=>d.close())")
page.locator('#ncpIpOpen').click();page.wait_for_function("!document.getElementById('ncpPresetIp').disabled")
page.locator('#ncpPresetIp').click();assert page.locator('#ncpIpEnabled').is_checked();assert page.locator('#ncpIpSlp').is_checked();assert page.locator('#ncpIpRestart').is_disabled()
page.locator('#ncpPresetIpx').click();assert not page.locator('#ncpIpEnabled').is_checked();assert not page.locator('#ncpIpSlp').is_checked()
assert not errors,errors;print('PASS Chromium mobile 390x844: wizard, mode disclosure, invalid input, auto assignment, save, failed reload, recovery, generated password, user creation, cleared password (mock API)');b.close()