feat(stream-test): drive the whole browse scenario with real input

Make every action real keyboard/mouse via xdotool, not just the visible
browsing: address-bar navigation (Ctrl+L + char-by-char typing), the YouTube
settings gear -> 화질 -> 1080p menu (real clicks, verified hd1080), the autoplay
toggle, the play button, and fullscreen via the real 'f' key (F11 isn't honored
by this WM; 'f' yields true 1080p fullscreen without pausing). CDP/DOM API is
now used only to read state for verification.
This commit is contained in:
javis-bot
2026-06-10 14:11:58 +09:00
parent 1e30a49562
commit 2cdd159fc1
3 changed files with 91 additions and 37 deletions

View File

@@ -100,4 +100,26 @@ export async function humanScroll(page, dir, notches, overLocator) {
await sleep(rand(250, 600));
}
// Press a single key (real keyboard).
export async function humanKey(key) { await xdo(['key', '--clearmodifiers', key]); await sleep(rand(120, 300)); }
// Navigate like a person: focus the address bar (Ctrl+L), type the URL one char
// at a time, press Enter.
export async function navigateOmnibox(text) {
await xdo(['key', '--clearmodifiers', 'ctrl+l']); await sleep(rand(300, 600));
await humanType(text); await sleep(rand(150, 320));
await xdo(['key', '--clearmodifiers', 'Return']);
}
// Move the real cursor over an element (hover, no click) - e.g. to reveal a
// video player's controls or to focus it for a keyboard shortcut.
export async function humanHover(page, locator) {
const box = await locator.boundingBox().catch(() => null);
if (!box) return;
const g = await page.evaluate(() => ({ sx: window.screenX, sy: window.screenY, ow: window.outerWidth, oh: window.outerHeight, iw: window.innerWidth, ih: window.innerHeight }));
const bx = Math.max(0, Math.round((g.ow - g.iw) / 2));
const oy = g.sy + Math.max(0, g.oh - g.ih - bx);
await humanMove(Math.round(g.sx + bx + box.x + box.width * 0.5), Math.round(oy + box.y + box.height * 0.4));
}
export { sleep, rand };