Skip to content

Commit b115bbe

Browse files
committed
restore attempts
1 parent f6f3f7a commit b115bbe

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/core/dispatch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ export async function dispatchCommand(
165165
case 'scrollintoview': {
166166
const text = positionals.join(' ').trim();
167167
if (!text) throw new AppError('INVALID_ARGS', 'scrollintoview requires text');
168-
await interactor.scrollIntoView(text);
168+
const result = await interactor.scrollIntoView(text);
169+
if (result?.attempts) return { text, attempts: result.attempts };
169170
return { text };
170171
}
171172
case 'pinch': {
@@ -278,4 +279,3 @@ export async function dispatchCommand(
278279
throw new AppError('INVALID_ARGS', `Unknown command: ${command}`);
279280
}
280281
}
281-

src/utils/interactors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export type Interactor = {
4545
type(text: string): Promise<void>;
4646
fill(x: number, y: number, text: string): Promise<void>;
4747
scroll(direction: string, amount?: number): Promise<void>;
48-
scrollIntoView(text: string): Promise<void>;
48+
scrollIntoView(text: string): Promise<{ attempts?: number } | void>;
4949
screenshot(outPath: string): Promise<void>;
5050
};
5151

@@ -154,7 +154,7 @@ function createIosSimulatorInteractor(device: DeviceInfo, ctx: RunnerContext): I
154154
{ command: 'findText', text, appBundleId: ctx.appBundleId },
155155
runnerOpts,
156156
)) as { found?: boolean };
157-
if (found?.found) return;
157+
if (found?.found) return { attempts: attempt + 1 };
158158
await runIosRunnerCommand(
159159
device,
160160
{ command: 'swipe', direction: 'up', appBundleId: ctx.appBundleId },

0 commit comments

Comments
 (0)