Skip to content

Commit b588a48

Browse files
committed
test: assert runtime selector fill evidence
1 parent b756f8c commit b588a48

1 file changed

Lines changed: 30 additions & 11 deletions

File tree

‎src/daemon/handlers/__tests__/interaction.test.ts‎

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -517,15 +517,36 @@ test('click simple iOS id selector uses direct runner selector tap without snaps
517517
}
518518
});
519519

520-
test('fill simple iOS id selector uses direct runner selector fill without snapshot coordinates', async () => {
520+
test('fill simple iOS id selector resolves runtime text input evidence before coordinate fill', async () => {
521521
const sessionStore = makeSessionStore();
522-
const sessionName = 'ios-direct-selector-fill';
522+
const sessionName = 'ios-runtime-selector-fill';
523523
sessionStore.set(sessionName, makeIosSession(sessionName, { appBundleId: 'com.example.app' }));
524524

525-
mockDispatch.mockResolvedValue({
525+
mockCaptureSnapshotForSession.mockResolvedValueOnce({
526+
nodes: attachRefs([
527+
{
528+
index: 0,
529+
type: 'Application',
530+
rect: { x: 0, y: 0, width: 440, height: 956 },
531+
},
532+
{
533+
index: 1,
534+
parentIndex: 0,
535+
type: 'TextField',
536+
identifier: 'email',
537+
label: 'Email',
538+
rect: { x: 40, y: 80, width: 300, height: 44 },
539+
enabled: true,
540+
hittable: false,
541+
},
542+
]),
543+
createdAt: Date.now(),
544+
backend: 'xctest',
545+
});
546+
mockDispatch.mockResolvedValueOnce({
526547
message: 'filled',
527-
x: 439.5,
528-
y: 100.5,
548+
x: 190,
549+
y: 102,
529550
referenceWidth: 440,
530551
referenceHeight: 956,
531552
});
@@ -544,15 +565,13 @@ test('fill simple iOS id selector uses direct runner selector fill without snaps
544565
});
545566

546567
expect(response?.ok).toBe(true);
568+
expect(mockCaptureSnapshotForSession).toHaveBeenCalledTimes(1);
547569
expect(mockDispatch).toHaveBeenCalledTimes(1);
548570
expect(mockDispatch.mock.calls[0]?.[1]).toBe('fill');
549-
expect(mockDispatch.mock.calls[0]?.[2]).toEqual(['[email protected]']);
571+
expect(mockDispatch.mock.calls[0]?.[2]).toEqual(['190', '102', '[email protected]']);
550572
const context = mockDispatch.mock.calls[0]?.[4] as Record<string, unknown>;
551-
expect(context.directElementSelector).toEqual({
552-
key: 'id',
553-
value: 'email',
554-
raw: 'id="email"',
555-
});
573+
expect(context.directElementSelector).toBeUndefined();
574+
expect(context.resolvedTextInputTarget).toBe(true);
556575
expect(context.delayMs).toBe(25);
557576
if (response?.ok) {
558577
expect(response.data?.selector).toBe('id="email"');

0 commit comments

Comments
 (0)