Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/provider-revyl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"devDependencies": {
"@agent-device/capture-kit": "workspace:*",
"@agent-device/contracts": "workspace:*",
"@agent-device/gestures": "workspace:*",
"@agent-device/host-kit": "workspace:*",
"@agent-device/kernel": "workspace:*",
"@agent-device/provider-webdriver": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions packages/provider-revyl/src/facts-runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ const EXPECTED_CELLS = {
perfNativeCaptureReattach: 'mode',
perfNativeCaptureStart: 'mode',
perfProfileReport: 'mode',
performDirectionalFlingPlan: 'mode',
performGesturePlan: 'mode',
performDirectionalFlingPlan: 'available',
performGesturePlan: 'available',
performMultiTouchGesturePlan: 'mode',
performTargetAuthoredDrag: 'mode',
power: 'mode',
Expand Down
24 changes: 20 additions & 4 deletions packages/provider-revyl/src/interaction-operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import {
bindProviderFocusInteractor,
focusRuntimeOperationFacts,
} from '@agent-device/contracts/focus-runtime';
import { gestureRuntimeOperationFacts } from '@agent-device/contracts/gesture-runtime';
import {
bindProviderGestureInteractor,
gestureRuntimeOperationFacts,
} from '@agent-device/contracts/gesture-runtime';
import {
bindProviderScrollInteractor,
scrollRuntimeOperationFacts,
Expand Down Expand Up @@ -52,10 +55,13 @@ const typeTextUnavailable = unavailableFact(
PLATFORM_RUNTIME_REASONS.unsupportedProviderMode.reason,
'Revyl enters text at a point; run fill <field> "text" instead of type.',
);
/** The worker executes actions, not gesture plans; a plan has no action to send it to. */
/**
* The worker's one gesture action is a single-finger `/drag`, so a plan with a second contact or a
* held contact has no action to send it to.
*/
const gestureUnavailable = unavailableFact(
PLATFORM_RUNTIME_REASONS.unsupportedProviderMode.reason,
'Revyl does not expose portable gesture execution.',
'Revyl performs a one-finger fling or pan as one timed drag; it has no multi-touch or held-drag action.',
);
/**
* Revyl's `/key` action accepts ENTER and BACKSPACE: one key rather than a keyboard surface. It
Expand Down Expand Up @@ -156,8 +162,12 @@ export function revylInteractionOperationFacts(liveSession?: RuntimeOperationUna
longPress: cell,
fill: cell,
}),
// A one-finger fling or pan is one timed drag of the plan's path. Whether this worker can time a
// drag is a property of its session, so the interactor refuses a worker that cannot.
...gestureRuntimeOperationFacts({
unsupported: liveSession ?? gestureUnavailable,
plan: cell,
directionalFling: cell,
}),
// A scroll is one drag of the planned finger path, so it needs no gesture execution.
...scrollRuntimeOperationFacts({ scroll: cell }),
Expand Down Expand Up @@ -243,7 +253,7 @@ export function revylSettingsOperationFacts(device: Pick<DeviceInfo, 'platform'>

/**
* Binds the operations that reach the device through the session's interactor: the two captures,
* focus, touch and scroll. Refused cells stay absent from the binding, so a refusal is the facts'
* focus, touch, one-finger gestures and scroll. Refused cells stay absent from the binding, so a refusal is the facts'
* answer and never a call that reaches a throwing interactor.
*/
export function bindRevylInteractionOperations(
Expand Down Expand Up @@ -278,6 +288,12 @@ export function bindRevylInteractionOperations(
facts: revylInteractionOperationFacts(),
pause: async (milliseconds: number) => await sleep(milliseconds, undefined, { signal }),
}),
...bindProviderGestureInteractor({
device,
signal,
resolveInteractor,
facts: revylInteractionOperationFacts(),
}),
...bindProviderScrollInteractor({ device, signal, resolveInteractor }),
});
}
71 changes: 71 additions & 0 deletions packages/provider-revyl/src/interactor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
type RevylFixtureBackend,
} from './revyl-backend.fixtures.ts';
import type { Interactor } from '@agent-device/contracts/interactor-types';
import type { GesturePlan } from '@agent-device/contracts/gesture-plan-types';
import { buildGesturePlan } from '@agent-device/gestures/gesture-plan';
import { REVYL_IOS_HIERARCHY } from './revyl-ios-hierarchy.fixtures.ts';

const ANDROID_HIERARCHY =
Expand Down Expand Up @@ -359,6 +361,75 @@ test('a scroll that names a duration is refused rather than run at another speed
);
});

const FLING_LEFT: GesturePlan = {
topology: 'single',
intent: 'fling',
executionProfile: 'endpoint-hold',
durationMs: 100,
viewport: { x: 0, y: 0, width: 390, height: 844 },
pointers: [
{
pointerId: 0,
samples: [
{ offsetMs: 0, point: { x: 300.4, y: 400.6 } },
{ offsetMs: 100, point: { x: 120, y: 400.6 } },
],
},
],
};

test('a fling is one drag of its path over its duration on a worker that times drags', async () => {
const { fixture, interactor } = await liveInteractor('android', { dragDuration: true });
const report = await interactor.performGesture?.(FLING_LEFT);

assert.equal(fixture.paths().filter((request) => request.endsWith('/drag')).length, 1);
assert.deepEqual(fixture.bodyFor('drag'), {
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved
start_x: 300,
start_y: 401,
end_x: 120,
end_y: 401,
duration_ms: 100,
});
assert.equal((report as Record<string, unknown>).durationMs, 100);
});

test('a fling is refused rather than run at the speed a worker that cannot time drags picks', async () => {
const { fixture, interactor } = await liveInteractor('android');

await assert.rejects(
() => interactor.performGesture!(FLING_LEFT),
(error: unknown) =>
error instanceof AppError &&
error.code === 'UNSUPPORTED_OPERATION' &&
error.details?.reason === 'unsupported-provider-mode',
);
assert.equal(
fixture.paths().some((request) => request.endsWith('/drag')),
false,
);
});

test('a Split View swipe is refused before any drag, since a straight drag cannot reach Split View', async () => {
const { fixture, interactor } = await liveInteractor('ios', { dragDuration: true });
const plan = buildGesturePlan(
{ intent: 'fling', preset: 'split-view-left' },
{ x: 0, y: 0, width: 390, height: 844 },
'ios',
);

await assert.rejects(
() => interactor.performGesture!(plan),
(error: unknown) =>
error instanceof AppError &&
error.code === 'UNSUPPORTED_OPERATION' &&
error.details?.reason === 'split_view_unavailable',
);
assert.equal(
fixture.paths().some((request) => request.endsWith('/drag')),
false,
);
});

test('a session whose health reported no screen refuses to plan a scroll', async () => {
const { fixture, interactor } = await liveInteractor('ios', { withoutScreen: true });
await assert.rejects(
Expand Down
62 changes: 62 additions & 0 deletions packages/provider-revyl/src/interactor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { isDeepLinkTarget } from '@agent-device/contracts/command';
import type { ScrollExecutionOptions } from '@agent-device/contracts/scroll-command';
import {
buildScrollGesturePlan,
isSplitViewContactOrigin,
splitViewUnavailableError,
type ScrollDirection,
} from '@agent-device/contracts/scroll-gesture';
import type {
Expand All @@ -16,6 +18,7 @@ import type {
SnapshotOptions,
} from '@agent-device/contracts/interactor-types';
import type { DeviceRotation } from '@agent-device/contracts/device';
import type { GesturePlan } from '@agent-device/contracts/gesture-plan-types';
import {
parseAppearanceAction,
parsePermissionAction,
Expand Down Expand Up @@ -328,6 +331,65 @@ class RevylInteractor implements Interactor {
};
}

/**
* A one-finger fling or pan as one `/drag` from the plan's first sample to its last, over the
* plan's duration. The fling's speed is its distance over that duration, so the drag must carry
* `duration_ms`: a worker whose `health` does not report `supports_explicit_drag_duration` picks
* its own speed, and the gesture is refused there rather than run as a slow swipe that reports a
* fling. The planner has already held every sample inside the viewport.
*
* A straight drag keeps only the two endpoints, so a plan whose path has a corner or a held
* stretch between them is refused rather than flattened. Split View presets are such paths and
* also need a system edge contact, so they refuse with the Split View reason.
*/
async performGesture(plan: GesturePlan): Promise<Record<string, unknown>> {
if (plan.topology !== 'single') {
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved
throw unsupported(
'gesture',
'Revyl performs a one-finger fling or pan as one timed drag; it has no multi-touch action.',
);
}
if (isSplitViewContactOrigin(plan.contactOrigin)) {
throw splitViewUnavailableError('Revyl does not support Split View');
}
const samples = plan.pointers[0].samples;
if (samples.length > 2) {
throw unsupported(
'gesture',
'Revyl performs a gesture as one straight timed drag; it cannot follow a path with intermediate points.',
);
}
if (!this.session.dragDuration) {
throw new AppError(
'UNSUPPORTED_OPERATION',
'This Revyl worker cannot be told how fast a drag travels, so it cannot perform a timed gesture.',
{
reason: PLATFORM_RUNTIME_REASONS.unsupportedProviderMode.reason,
command: 'gesture',
gesture: plan.intent,
runId: this.session.runId,
hint: 'Use scroll, which runs the drag at the speed Revyl gives it.',
},
);
}
const start = samples[0].point;
const end = samples.at(-1)!.point;
const drag = {
x1: Math.round(start.x),
y1: Math.round(start.y),
x2: Math.round(end.x),
y2: Math.round(end.y),
};
await this.workerAction('drag', {
start_x: drag.x1,
start_y: drag.y1,
end_x: drag.x2,
end_y: drag.y2,
duration_ms: plan.durationMs,
});
return { backend: 'revyl-device-proxy', ...drag, durationMs: plan.durationMs };
}

/** Refuses a drag duration this worker cannot honor; Revyl's `duration_ms` starts at 1. */
private requireDragDuration(durationMs: number): void {
if (!this.session.dragDuration) {
Expand Down
4 changes: 3 additions & 1 deletion packages/provider-revyl/src/platform-runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ test('a live session binds the interactor-backed operations and refuses the rest
assert.ok(binding.operations.openApplication);
assert.ok(binding.operations.home);
assert.equal(binding.operations.tapRef, undefined);
assert.equal(binding.operations.performGesturePlan, undefined);
assert.ok(binding.operations.performGesturePlan);
assert.ok(binding.operations.performDirectionalFlingPlan);
assert.equal(binding.operations.performMultiTouchGesturePlan, undefined);
assert.equal(binding.operations.keyboardStatus, undefined);
assert.equal(binding.operations.screenRecordingStart, undefined);
assert.equal(binding.operations.appLogInspect, undefined);
Expand Down
3 changes: 3 additions & 0 deletions packages/provider-revyl/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
{
"path": "../contracts"
},
{
"path": "../gestures"
},
{
"path": "../host-kit"
},
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions scripts/capability-matrix/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ export const MATRIX_SECTIONS: readonly MatrixSection[] = [
link: docs('commands', 'pointer-and-gestures'),
advertises: ['performGesturePlan', 'captureSnapshot'],
note: 'Multi-touch plans are part of `gesture` where the target runs them; a plan using an operation the target lacks fails at that step.',
cells: {
'revyl-ios': {
text: 'One-finger only, on a worker that reports drag duration',
admits: ['performGesturePlan', 'captureSnapshot'],
},
'revyl-android': {
text: 'One-finger only, on a worker that reports drag duration',
admits: ['performGesturePlan', 'captureSnapshot'],
},
},
},
{
id: 'hover-viewport',
Expand Down
2 changes: 1 addition & 1 deletion website/docs/docs/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ What a **Yes** does not claim:
| [Type into the focused field](/docs/commands#interactions) | Yes | Yes | Yes | Yes | Yes | Yes | No | No |
| [Long press](/docs/commands#interactions) | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| [Scroll](/docs/commands#scroll) | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| [Gesture plans and swipes](/docs/commands#pointer-and-gestures) | Yes | Yes | Yes | Yes | Yes | Yes | No | No |
| [Gesture plans and swipes](/docs/commands#pointer-and-gestures) | Yes | Yes | Yes | Yes | Yes | Yes | One-finger only, on a worker that reports drag duration | One-finger only, on a worker that reports drag duration |
| [Hover and viewport size](/docs/commands#web-automation) | No | No | No | No | No | No | No | No |
| [Read, accept, and dismiss system alerts](/docs/commands#wait-and-alerts) | No | No | No | No | Yes | Yes | No | No |
| [Keyboard dismiss, enter, and status](/docs/commands#keyboard) | Yes | Dismiss only; status and enter unsupported | Yes | Dismiss only; status and enter unsupported | Yes | Yes | No | No |
Expand Down
11 changes: 10 additions & 1 deletion website/docs/docs/revyl.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ A Revyl session runs the commands that reach a device through Revyl's device act
the drag takes, from 1 to 10000 ms, when Revyl's worker supports it. An older worker picks the
speed itself, so there the flag refuses rather than running the drag at a speed nobody chose.
`fill --delay-ms` is paced by typing one character per pause.
- `swipe`, `gesture swipe left|right|left-edge|right-edge`, `gesture fling`, and one-finger
`gesture pan` without `--hold-ms`. Each gesture sends one drag from its start to its end that
takes the gesture's duration, so a fling moves as fast as it does on a local device. A swipe
with `--count` sends one such drag per repetition, in the direction `--pattern` gives it. This
needs a worker that supports setting the drag duration; on an older worker these gestures refuse
rather than run at a speed Revyl picks.
- `install` of a local build, `install-from-source` from a URL or CI artifact, `open` with the app's
bundle identifier or package name, `open` with a deep link or URL, and `close` for the app the
session opened.
Expand All @@ -114,7 +120,10 @@ report a refused command as a success:

- `type` refuses and points at `fill`, because Revyl enters text at a point rather than into the
field the platform happens to focus.
- `swipe` and `gesture` refuse. Use `scroll`, which plans the path itself and sends one drag.
- `gesture pinch`, `rotate`, `transform`, `tap`, and `drag`, two-finger `gesture pan`, and
`gesture pan --hold-ms` refuse, because Revyl has no multi-touch or held-drag action.
`gesture swipe split-view-left|split-view-right|split-view-exit` refuses with
`split_view_unavailable`, because a straight drag cannot enter or leave Split View.
- `keyboard`, `clipboard`, `alert`, `fold`, `telephony`, and `tv-remote` are not supported.
- The other `settings` refuse: `wifi`, `airplane`, `mobile-data`, `bluetooth`, `animations`,
`text-size`, `faceid`, `touchid`, and `fingerprint`. Revyl's devices refuse airplane mode, and the
Expand Down
Loading