wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.15k stars 1.92k forks source link

Can't tap Return on iOS keyboard due to visibility check #4546

Open crazyvan opened 1 month ago

crazyvan commented 1 month ago

What happened?

Attempt to tap the Return button on the iOS keyboard with:

await element(by.label('return')).tap();

fails with:

View is not hittable at its visible point. Error: Failed to interact with the screen at point: {639, 361}.

The following works fine:

await element(by.label('return')).tap({ x: 20, y: 20 });

The attributes of the element are:

{
  visible: true,
  hittable: true,
  enabled: true,
  className: 'UIAccessibilityElementKBKey',
  label: 'return',
  isAccessibilityElement: true,
  elementSafeBounds: { y: 169, x: 295, width: 98, height: 46 },
  frame: { y: 730, x: 295, width: 98, height: 46 },
  identifier: 'Return',
  activationPoint: { x: 344, y: 192 },
  normalizedActivationPoint: { x: 0.5, y: 0.5 }
}

What was the expected behaviour?

No response

Was it tested on latest Detox?

Did your test throw out a timeout?

Help us reproduce this issue!

Try to tap Return on iOS keyboard on iPhone 15 (iOS 17.5).

In what environment did this happen?

Detox version: 20.25.1 React Native version: 0.71.12 Has Fabric (React Native's new rendering system) enabled: no Node version: 22.5.1 Device model: iPhone 15 iOS version: 17.5 macOS version: Sonoma 14.6.1 Xcode version: 15.4 Test-runner (select one): jest

Detox logs

Detox logs ``` paste logs here! ```

Device logs

Device logs ``` 12:26:00.891 detox[11851] E ws-client get element attributes 12:26:00.893 detox[11851] i user { visible: true, hittable: true, enabled: true, className: 'UIAccessibilityElementKBKey', label: 'return', isAccessibilityElement: true, elementSafeBounds: { y: 169, x: 295, width: 98, height: 46 }, frame: { y: 730, x: 295, width: 98, height: 46 }, identifier: 'Return', activationPoint: { x: 344, y: 192 }, normalizedActivationPoint: { x: 0.5, y: 0.5 } } origin: at e2e/utils/keyboard.ts:23:36 12:26:00.894 detox[11851] i ws-client send message data: {"type":"invoke","params":{"type":"action","action":"tap","predicate":{"type":"label","value":"return","isRegex":false}},"messageId":23} RUNS e2e/tests/organicRegistration.e2e.ts 12:26:00.895 detox[11847] i ws-server@52866 get 12:26:00.895 detox[11851] B ws-client tap:"action","action":"tap","predicate":{"type":"label","value":"return","isRegex" data: { "type": "action", "action": "tap", "predicate": { "type": "label", "value": "return", "isRegex": false } } stack: closeKeyboard (/e2e/utils/keyboard.ts:20:43) processTicksAndRejections (node:internal/process/task_queues:95:5) /e2e/tests/organicRegistration.e2e.ts:122:17 RUNS e2e/tests/organicRegistration.e2e.ts 12:26:00.895 detox[11847] i ws-server@52886 send data: { "type": "invoke", "params": { "type": "action", "action": "tap", "predicate": { "type": "label", "value": "return", "isRegex": false } }, "messageId": 23 } 12:26:00.908 detox[11847] i ws-server@52886 get data: {"params":{"DetoxFailureInformation":{"object":"; layer = >","selector":"dtx_assertHittableAtPoint:","lineNumber":546,"file":"UIView+DetoxUtils.m"},"details":"View is not hittable at its visible point. Error: Failed to interact with the screen at point: {639, 361}.","NSLocalizedDescription":"View is not hittable at its visible point. Error: Failed to interact with the screen at point: {639, 361}."},"messageId":23,"type":"testFailed"} 12:26:00.908 detox[11847] i ws-server@52866 send data: { "params": { "DetoxFailureInformation": { "object": "; layer = >", "selector": "dtx_assertHittableAtPoint:", "lineNumber": 546, "file": "UIView+DetoxUtils.m" }, "details": "View is not hittable at its visible point. Error: Failed to interact with the screen at point: {639, 361}.", "NSLocalizedDescription": "View is not hittable at its visible point. Error: Failed to interact with the screen at point: {639, 361}." }, "messageId": 23, 12:26:00.909 detox[11851] i ws-client get message data: {"params":{"DetoxFailureInformation":{"object":"; layer = >","selector":"dtx_assertHittableAtPoint:","lineNumber":546,"file":"UIView+DetoxUtils.m"},"details":"View is not hittable at its visible point. Error: Failed to interact with the screen at point: {639, 361}.","NSLocalizedDescription":"View is not hittable at its visible point. Error: Failed to interact with the screen at point: {639, 361}."},"messageId":23,"type":"testFailed"} 12:26:00.911 detox[11851] E ws-client tap error: Test Failed: View is not hittable at its visible point. Error: Failed to interact with the screen at point: {639, 361}. 12:26:00.911 detox[11851] E user NameDetails screen - full name split error message is visible after clearing last name and tapping submit error: Test Failed: View is not hittable at its visible point. Error: Failed to interact with the screen at point: {639, 361}. 12:26:00.912 detox[11851] B artifacts-manager onTestFnFailure args: ({"error":{"name":"DetoxRuntimeError"}}) 12:26:00.913 detox[11851] E artifacts-manager onTestFnFailure 12:26:00.913 detox[11851] E lifecycle test_fn error: Test Failed: View is not hittable at its visible point. Error: Failed to interact with the screen at point: {639, 361}. 12:26:00.915 detox[11851] B artifacts-manager onTestDone args: ({"title":"test form validation, screen navigation and components","fullName":"Organic registration test form validation, screen navigation and components","status":"failed","invocations":1,"timedOut":false}) 12:26:00.916 detox[11851] E artifacts-manager onTestDone 12:26:00.917 detox[11851] E lifecycle test form validation, screen navigation and components 12:26:00.917 detox[11851] i lifecycle Organic registration: test form validation, screen navigation and components [FAIL] 12:26:00.919 detox[11851] B lifecycle afterAll 12:26:00.919 detox[11851] B device terminateApp args: () 12:26:00.919 detox[11851] B artifacts-manager onBeforeTerminateApp args: ({"deviceId":"A5929223-8D2D-4DE0-B55C-103E36EFF83A","bundleId":"uk.co.credabilityapptest"}) 12:26:00.920 detox[11851] E artifacts-manager onBeforeTerminateApp 12:26:00.920 detox[11851] i child-process:EXEC_CMD /usr/bin/xcrun simctl terminate A5929223-8D2D-4DE0-B55C-103E36EFF83A uk.co.credabilityapptest 12:26:00.920 detox[11851] i child-process:EXEC_TRY Terminating uk.co.credabilityapptest... RUNS e2e/tests/organicRegistration.e2e.ts 12:26:01.146 detox[11847] i ws-server app exited session 5d87e6e6-90a4-ed5e-0d93-bd6ebfd10932 12:26:01.146 detox[11847] i ws-server@52866 send data: { "type": "appDisconnected" 12:26:01.146 detox[11851] i ws-client get message data: {"type":"appDisconnected"} 12:26:01.151 detox[11851] i child-process:EXEC_SUCCESS uk.co.credabilityapptest terminated 12:26:01.152 detox[11851] B artifacts-manager onTerminateApp args: ({"deviceId":"A5929223-8D2D-4DE0-B55C-103E36EFF83A","bundleId":"uk.co.credabilityapptest"}) 12:26:01.152 detox[11851] E artifacts-manager onTerminateApp 12:26:01.152 detox[11851] E device terminateApp 12:26:01.152 detox[11851] E lifecycle afterAll 12:26:01.152 detox[11851] B artifacts-manager onRunDescribeFinish args: ({"name":"Organic registration"}) 12:26:01.152 detox[11851] E artifacts-manager onRunDescribeFinish 12:26:01.152 detox[11851] E lifecycle Organic registration 12:26:01.153 detox[11851] B artifacts-manager onRunDescribeFinish args: ({"name":"ROOT_DESCRIBE_BLOCK"}) 12:26:01.153 detox[11851] E artifacts-manager onRunDescribeFinish 12:26:01.153 detox[11851] E lifecycle run the tests 12:26:01.161 detox[11851] B lifecycle tear down environment 12:26:01.162 detox[11851] B artifacts-manager onBeforeCleanup args: () 12:26:01.162 detox[11851] E artifacts-manager onBeforeCleanup RUNS e2e/tests/organicRegistration.e2e.ts 12:26:01.163 detox[11851] i ipc dispatching event to primary-11847 /tmp/detox.primary-11847 : deallocateDevice , { deviceCookie: { id: 'A5929223-8D2D-4DE0-B55C-103E36EFF83A', udid: 'A5929223-8D2D-4DE0-B55C-103E36EFF83A', type: 'ios.simulator' } } RUNS e2e/tests/organicRegistration.e2e.ts 12:26:01.164 detox[11847] i ipc received event of : deallocateDevice { deviceCookie: { id: 'A5929223-8D2D-4DE0-B55C-103E36EFF83A', udid: 'A5929223-8D2D-4DE0-B55C-103E36EFF83A', type: 'ios.simulator' } } 12:26:01.164 detox[11847] B device@0 free: A5929223-8D2D-4DE0-B55C-103E36EFF83A data: {} 12:26:01.165 detox[11851] i ipc ## received events ##D2D-4DE0-B55C-103E36EFF83A 12:26:01.165 detox[11851] i ipc detected event deallocateDeviceDone {} 12:26:01.165 detox[11851] E lifecycle tear down environment 12:26:01.166 detox[11851] E lifecycle e2e/tests/organicRegistration.e2e.ts FAIL e2e/tests/organicRegistration.e2e.ts (41.11 s) Organic registration ✕ test form validation, screen navigation and components (10030 ms) ● Organic registration › test form validation, screen navigation and components Test Failed: View is not hittable at its visible point. Error: Failed to interact with the screen at point: {639, 361}. 18 | .getAttributes() 19 | .then((res) => console.log(res)); > 20 | await element(by.label('return')).tap(); | ^ 21 | // await element(by.label('return')).tap({ x: 20, y: 20 }); 22 | } 23 | }; at closeKeyboard (utils/keyboard.ts:20:43) at tests/organicRegistration.e2e.ts:122:17 Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 0 total Time: 41.377 s ```

More data, please!

ui.viewhierarchy.zip

mat1asl0pez commented 1 month ago

await element(by.id('my_input_field')).tapReturnKey()

this worked for me⬆️