feat: initial commit - Carinha Control Panel v1.0 com UI glassmorphism, watch-bar, emojis, braco robotico e conversa IA
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
from playwright.sync_api import sync_playwright
|
||||
import json
|
||||
with sync_playwright() as p:
|
||||
b=p.chromium.launch(headless=True); page=b.new_page(viewport={'width':1400,'height':1000})
|
||||
cfg=dict(disponivel=True,erro='',calibracao=[dict(canal=i,minimo=1400,maximo=1600) for i in range(8)],posturas=[],articulacoes=[dict(nome=n,canal=c) for n,c in zip(['Garra','Punho 1','Punho 2','Braço superior','Braço inferior','Antebraço','Base'],[0,1,2,3,4,5,7])])
|
||||
calls=[]; errors=[]
|
||||
def handle(route):
|
||||
if route.request.method=='POST':
|
||||
data=route.request.post_data_json; calls.append((route.request.url,data))
|
||||
if route.request.url.endswith('/config'): cfg.update(data)
|
||||
route.fulfill(content_type='application/json',body=json.dumps(cfg))
|
||||
page.route('**/braco/status',handle); page.route('**/braco/config',handle); page.route('**/braco/mover',handle); page.route('**/braco/parar',handle)
|
||||
page.on('pageerror',lambda e:errors.append(str(e)))
|
||||
page.goto('http://192.168.1.35:8100/braco');page.wait_for_selector('#joint6')
|
||||
assert page.locator('#sliders input').count()==7
|
||||
assert not page.locator('#enable').is_checked()
|
||||
page.locator('#joint1').evaluate("e=>{e.value=95;e.dispatchEvent(new Event('input'))}");page.wait_for_timeout(200)
|
||||
assert calls==[]
|
||||
page.locator('#enable').check();assert calls==[]
|
||||
page.locator('#joint1').evaluate("e=>{e.value=85;e.dispatchEvent(new Event('input'))}");page.wait_for_timeout(650)
|
||||
moves=[d for u,d in calls if u.endswith('/mover')]
|
||||
assert moves and moves[-1]['angulos'][1]==85,moves
|
||||
assert len(moves[0]['angulos'])==7
|
||||
page.locator('#stop').click();page.wait_for_timeout(200)
|
||||
assert calls[-1][0].endswith('/parar');assert not page.locator('#enable').is_checked()
|
||||
page.on('dialog',lambda d:d.accept('Teste centro'))
|
||||
page.locator('#savePose').click();page.wait_for_timeout(250)
|
||||
assert '1 posturas' in page.locator('#count').inner_text()
|
||||
page.locator('#enable').check();page.locator('#play').click();page.wait_for_timeout(1100)
|
||||
assert 'Sequência concluída' in page.locator('#console').inner_text()
|
||||
page.locator('#stop').click();page.wait_for_timeout(200)
|
||||
page.screenshot(path='C:/Users/JullioPC/Documents/Codex/2026-10-04/o/outputs/carinha-pc/docs/braco-painel.png',full_page=True)
|
||||
page.set_viewport_size({'width':390,'height':844})
|
||||
assert page.evaluate('document.documentElement.scrollWidth<=innerWidth')
|
||||
assert not errors,errors
|
||||
print('OK: sete sliders, opt-in, velocidade, parar, salvar/reproduzir, mobile; comandos simulados')
|
||||
b.close()
|
||||
Reference in New Issue
Block a user