10 lines
1.4 KiB
Python
10 lines
1.4 KiB
Python
import json
|
|
from pathlib import Path
|
|
from playwright.sync_api import sync_playwright
|
|
out=Path('docs/ui-consistency/evidence/ot13-alert-operations')
|
|
with sync_playwright() as p:
|
|
b=p.chromium.launch(channel='chromium');pg=b.new_page(viewport={'width':1440,'height':1100});pg.goto('http://127.0.0.1:61281/live-tail-pilot?sample=alerts');pg.wait_for_timeout(700)
|
|
pg.request.post('http://127.0.0.1:61281/fixture/alarm-feed/alarm-a');pg.locator('tbody input').wait_for();f=pg.locator('tbody input').first;f.fill('');f.press('e');pg.wait_for_timeout(100)
|
|
result={'partialNumber':f.evaluate('(e)=>({value:e.value,badInput:e.validity.badInput})')};pg.get_by_role('button',name='Shelve (timed)',exact=True).click();pg.wait_for_timeout(400);pg.locator('#fixture-alarm-observe').click();result['commandsAfterInvalid']=pg.locator('#fixture-alarm-count').inner_text();result['until']=pg.locator('#fixture-alarm-until').inner_text()
|
|
f.focus();pg.evaluate('window.beforeInput=document.querySelector("tbody input")');pg.request.post('http://127.0.0.1:61281/fixture/alarm-feed/alarm-b');pg.wait_for_timeout(400);result['focusedRowAfterInsert']=pg.evaluate('({same:document.activeElement===window.beforeInput,row:window.beforeInput.closest("tr").textContent})');pg.screenshot(path=str(out/'before-native.png'));(out/'before-native.json').write_text(json.dumps(result,indent=2));print(json.dumps(result));b.close()
|