Merge branch 'worktree-agent-ae4ea8a7cf042aa35'
This commit is contained in:
@@ -55,7 +55,7 @@ In JSON, a step can also set `wait` (ms), `timeout`, `name`, `ms` and `frames`.
|
||||
| `drag=<target>>dx,dy` | press on the target, move by dx,dy in `steps` (12) moves `gap` (16) ms apart, release (JSON `dx`, `dy`, `steps`, `gap`; `hold: true` keeps the button down to capture mid-drag) |
|
||||
| `size=WxH` | resize without reloading |
|
||||
| `labels=name` | write the visible semantics labels, keys and rects to JSON |
|
||||
| `film=<target>` | screencast a click for `--film-ms` (900) and write the frames plus a contact sheet |
|
||||
| `film=<target>` | screencast a click for `--film-ms` (900) and write the frames plus a contact sheet; `film=press:Alt+t` films a key chord (as `press=`) instead |
|
||||
| `wait=ms` | sleep |
|
||||
| `files=a.ttf[,b.ttf]` | answer the next file chooser the page opens with these files (paths relative to the working directory); put it before the click that opens the picker |
|
||||
| `swipe=<target>>dx,dy` | one-finger touch swipe (needs `--touch true`, which emulates a touch screen once semantics is on) |
|
||||
|
||||
@@ -175,7 +175,8 @@ try {
|
||||
case 'tabs': await save(file(value || 'tabs', 'json'), JSON.stringify(await browser.targets(), null, 2)); break;
|
||||
case 'labels': await save(file(value || 'labels', 'json'), JSON.stringify(await page.labels(), null, 2)); break;
|
||||
case 'film': {
|
||||
const name = step.name ?? `film-${describe(parseTarget(value)).replace(/\W+/g, '-').replace(/^-|-$/g, '')}`;
|
||||
const what = String(value).startsWith('press:') ? String(value) : describe(parseTarget(value));
|
||||
const name = step.name ?? `film-${what.replace(/\W+/g, '-').replace(/^-|-$/g, '')}`;
|
||||
const frames = await page.film(value, Number(step.ms ?? opts['film-ms']));
|
||||
const dir = join(out, name.replace(/[^\w.-]+/g, '_'));
|
||||
await mkdir(dir, { recursive: true });
|
||||
|
||||
@@ -207,7 +207,9 @@ export function flutterPage(browser, log, { touch = false } = {}) {
|
||||
// viewport before another screencast, otherwise Chrome can crop frames.
|
||||
await send('Page.bringToFront');
|
||||
await resize(viewport.width, viewport.height);
|
||||
const point = await locate(target);
|
||||
// `press:Alt+t` films a key chord instead of a click.
|
||||
const chord = typeof target === 'string' && target.startsWith('press:') ? target.slice(6) : null;
|
||||
const point = chord ? null : await locate(target);
|
||||
const frames = [];
|
||||
const ack = (p) => {
|
||||
frames.push({ data: p.data, t: p.metadata.timestamp });
|
||||
@@ -217,7 +219,8 @@ export function flutterPage(browser, log, { touch = false } = {}) {
|
||||
await send('Page.startScreencast', { format: 'png', everyNthFrame: 1, maxWidth: viewport.width, maxHeight: viewport.height });
|
||||
await delay(300);
|
||||
const clickAt = Date.now() / 1000;
|
||||
await tap(point);
|
||||
if (chord) await this.press(chord);
|
||||
else await tap(point);
|
||||
await delay(ms);
|
||||
await send('Page.stopScreencast');
|
||||
await delay(100);
|
||||
|
||||
Reference in New Issue
Block a user