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
20 changes: 13 additions & 7 deletions src/commands/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,11 +718,15 @@ const launchSub = defineCommand({
},
});

/** Shared by the typed-action subcommands: the Maestro switch. */
/**
* Shared by the typed-action subcommands. It chose Maestro over the device's
* direct path when a device session had two engines. It has one now, so the
* flag is still taken, for scripts that pass it, and does nothing.
*/
const maestroArg = {
type: 'boolean',
default: false,
description: 'Run the action as a Maestro flow instead of directly on the device',
description: 'Deprecated: has no effect. Device sessions have a single engine',
} as const;

/** A percentage of the screen from a flag value, or a usage error. */
Expand Down Expand Up @@ -755,10 +759,7 @@ async function performAction(
) {
const ctx = await context(args);
const sessionId = await resolveSessionId(ctx.apiUrl, ctx.auth, id);
const { result, session } = await DeviceGateway.action(ctx.apiUrl, ctx.auth, sessionId, {
...body,
...(args.maestro ? { mode: 'maestro' as const } : {}),
});
const { result, session } = await DeviceGateway.action(ctx.apiUrl, ctx.auth, sessionId, body);
return {
session,
data: { result } as { result: DeviceCommandResult },
Expand Down Expand Up @@ -1087,7 +1088,12 @@ async function waitForCommand(ctx: Ctx, id: string, commandId: string): Promise<
}

const runSub = defineCommand({
meta: { name: 'run', description: 'Run a Maestro flow (or a directory of flows) on the device, and wait for the result' },
meta: {
name: 'run',
description:
'Run a Maestro flow (or a directory of flows) on the device, and wait for the result. ' +
'A device session runs the common Maestro commands and no flow scripts (runScript, evalScript)',
},
args: {
...commonArgs,
id: idArg,
Expand Down
5 changes: 3 additions & 2 deletions src/types/domain/device-session.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ export interface DevicePoint {
}

/**
* One typed action for POST /device/sessions/:id/actions. `mode: 'maestro'`
* runs it as a Maestro flow instead of on the device directly.
* One typed action for POST /device/sessions/:id/actions. `mode` is
* deprecated: the API still accepts `'maestro'` and ignores it, and the CLI
* no longer sends it.
*/
export type DeviceActionRequest =
| { id?: string; mode?: 'maestro'; text?: string; type: 'tap'; x?: number; y?: number }
Expand Down
7 changes: 4 additions & 3 deletions test/unit/device-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,11 @@ describe('dcd device', () => {
expect(calls).to.have.length(0);
});

it('--maestro asks for the Maestro path', async () => {
it('--maestro is still accepted and changes nothing: device sessions have one engine', async () => {
const calls = stubFetch(ok);
await runJson('tap', { id: 'a-b-c', text: 'OK', maestro: true });
expect(calls[0].body).to.deep.equal({ type: 'tap', text: 'OK', mode: 'maestro' });
const { exit } = await runJson('tap', { id: 'a-b-c', text: 'OK', maestro: true });
expect(exit).to.equal(0);
expect(calls[0].body).to.deep.equal({ type: 'tap', text: 'OK' });
});

it('type sends the text, sensitive when asked, and keeps it out of the envelope', async () => {
Expand Down
Loading