Files
progcode/verification/keyboard-check.txt
T
2026-10-26 14:26:17 +03:00

35 lines
2.9 KiB
Plaintext

### Result
{"focus":[{"tag":"A","text":"</> ProgCode.Ru","id":"","outline":"solid"},{"tag":"A","text":"Архив","id":"","outline":"solid"},{"tag":"A","text":"JSON-инструмент","id":"","outline":"solid"},{"tag":"A","text":"Об источниках","id":"","outline":"solid"},{"tag":"A","text":"Читать архив ↓","id":"","outline":"solid"},{"tag":"INPUT","text":"","id":"search","outline":"solid"}],"searchResults":3,"topicPressed":"true","valid":"{\n \"ok\": true\n}","invalid":"Ошибка JSON: Expected property name or '}' in JSON at position 1 (line 1 column 2)"}
### Ran Playwright code
```js
await (async page => {
await page.setViewportSize({width:390,height:844});
await page.goto('http://127.0.0.1:52964/');
const focus=[];
for(let i=0;i<12;i++){if(await page.locator('#search').evaluate(e=>e===document.activeElement))break;await page.keyboard.press('Tab');focus.push(await page.evaluate(()=>({tag:document.activeElement.tagName,text:document.activeElement.textContent, id:document.activeElement.id,outline:getComputedStyle(document.activeElement).outlineStyle})));}
if(await page.locator('#search').evaluate(e=>e!==document.activeElement)) throw Error('Search is not keyboard reachable');
await page.keyboard.type('Bitrix');
const found=await page.locator('.article-card').count();if(found!==3)throw Error('Search expected 3');
await page.keyboard.press('ControlOrMeta+A');await page.keyboard.press('Backspace');
for(let i=0;i<3;i++)await page.keyboard.press('Tab');
await page.keyboard.press('Enter');
const topic=await page.getByRole('button',{name:'Bitrix',exact:true}).getAttribute('aria-pressed');if(topic!=='true')throw Error('Topic keyboard failed');
await page.goto('http://127.0.0.1:52964/tools/');
for(let i=0;i<12;i++){if(await page.locator('#json').evaluate(e=>e===document.activeElement))break;await page.keyboard.press('Tab');}
if(await page.locator('#json').evaluate(e=>e!==document.activeElement))throw Error('Textarea keyboard focus failed');
await page.keyboard.press('ControlOrMeta+A');await page.keyboard.type('{"ok":true}');
await page.keyboard.press('Tab');await page.keyboard.press('Enter');
const valid=await page.getByRole('status').innerText();if(!valid.includes('"ok": true'))throw Error('Valid JSON failed');
await page.keyboard.press('Shift+Tab');await page.keyboard.press('ControlOrMeta+A');await page.keyboard.type('{broken');
await page.keyboard.press('Tab');await page.keyboard.press('Enter');
const invalid=await page.getByRole('status').innerText();if(!invalid.includes('Ошибка JSON'))throw Error('Error JSON failed');
await page.screenshot({path:'/tmp/progcode-keyboard-focus.png'});
await page.screenshot({path:'/tmp/progcode-mobile-tools-full.png',fullPage:true});
return {focus,searchResults:found,topicPressed:topic,valid,invalid};
}
)(page);
```
### Page
- Page URL: http://127.0.0.1:52964/tools/
- Page Title: ProgCode.Ru — архив программиста