Detox: typeText behaviour seems inconsistent

Created on 1 Jul 2019  路  12Comments  路  Source: wix/Detox

Describe the bug
When running the same test code several times in a row, the resulting behaviour varies when using typeText(). Some runs perform as expected, others don't.

To Reproduce

  • [x] I have tested this issue on the latest Detox release and it still reproduces

I am seeing this error on the code in this commit on mapswipe.

  1. detox build -c android.emuandroid26.debug && detox test -c android.emuandroid26.debug --loglevel trace
  2. Repeat step 1 several times, and observe a different outcome. See videos attached.

If possible, please provide a small demo project that reproduces the issue, or attach a video with the reproduction - this would be very appreciated.

Expected behavior
The same code should result in the same test outcome on every run.

Screenshots
Here are a few videos showing said behaviour:

First field is missed
screencast_missed_username


and the corresponding log (just for this test case)

Example: should create an account
detox[8856] TRACE: [Detox.js/DETOX_AFTER_EACH] passed test: "Example should switch to login and password reset screens"
detox[8856] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onAfterEach({ title: 'should switch to login and password reset screens',
  fullName: 'Example should switch to login and password reset screens',
  status: 'passed',
  timedOut: false })
detox[8856] TRACE: [Detox.js/DETOX_BEFORE_EACH] running test: "Example should create an account"
detox[8856] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeEach({ title: 'should create an account',
  fullName: 'Example should create an account',
  status: 'running' })
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"reactNativeReload","params":{},"messageId":-1000}
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=tester action=reactNativeReload (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=testee action=ready (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":-1000,"type":"ready","params":{}}

detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAssertion"},"method":"assertMatcher","args":[{"type":"Invocation","value":{"target":{"type":"Cl$
ss","value":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_screen"]}}]}},{"typ$
":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForSufficientlyVisible","args":[]}}]},"messageId":10}
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":10,"type":"invokeResult","params":{"result":"(null)"}}

detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v$
lue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_screen"]}}]}},{"type":"Inv$
cation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAction"},"method":"scrollInDirection","args":[{"type":"Integer","value":4},{"type":"Double","value":150}]}}]},"messageId":11}
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":11,"type":"invokeResult","params":{"result":"(null)"}}

detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v$
lue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_username"]}}]}},{"type":"I$
vocation","value":{"target":{"type":"Class","value":"androidx.test.espresso.action.ViewActions"},"method":"typeText","args":["ci_user_1561993590533"]}}]},"messageId":12}
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":12,"type":"invokeResult","params":{"result":"(null)"}}

detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v$
lue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_email"]}}]}},{"type":"Invo$
ation","value":{"target":{"type":"Class","value":"androidx.test.espresso.action.ViewActions"},"method":"typeText","args":["[email protected]"]}}]},"messageId":13}
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":13,"type":"invokeResult","params":{"result":"(null)"}}

detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v$
lue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_screen"]}}]}},{"type":"Inv$
cation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAction"},"method":"scrollInDirection","args":[{"type":"Integer","value":4},{"type":"Double","value":100}]}}]},"messageId":14}
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":14,"type":"invokeResult","params":{"result":"(null)"}}

detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v$
lue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_password"]}}]}},{"type":"I$
vocation","value":{"target":{"type":"Class","value":"androidx.test.espresso.action.ViewActions"},"method":"typeText","args":["password_1561993590533"]}}]},"messageId":15}
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":15,"type":"invokeResult","params":{"result":"(null)"}}

detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v$
lue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_password"]}}]}},{"type":"I$
vocation","value":{"target":{"type":"Class","value":"androidx.test.espresso.action.ViewActions"},"method":"typeText","args":["\n"]}}]},"messageId":16}
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":16,"type":"invokeResult","params":{"result":"(null)"}}

detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","va
lue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_screen"]}}]}},{"type":"Invo
cation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAction"},"method":"scrollToEdge","args":[{"type":"Integer","value":4}]}}]},"messageId":17}
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":17,"type":"invokeResult","params":{"result":"(null)"}}

detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","va
lue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_button"]}}]}},{"type":"Invo
cation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxViewActions"},"method":"click","args":[]}}]},"messageId":18}
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":18,"type":"invokeResult","params":{"result":"(null)"}}

detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAssertion"},"method":"assertMatcher","args":[{"type":"Invocation","value":{"target":{"type":"Cla
ss","value":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForAtIndex","args":[{"type":"Integer","value":1
},{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["recommended_cards_view"]}}]}}]}},{"type":"Invocation","value":{"target":{"type":"Class","value":"c
om.wix.detox.espresso.DetoxMatcher"},"method":"matcherForSufficientlyVisible","args":[]}}]},"messageId":19}
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=testee action=error (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":19,"type":"error","params":{"error":"'at least 75 percent of the view's area is displayed to the user.' doesn't match the selected view.\nExpected: at least 75 percent o
f the view's area is displayed to the user.\n     Got: null\n"}}

Example: should create an account [FAIL]

behaves as expected

screencast_ok3


and the matching logs.

Example: should create an account
detox[27819] TRACE: [Detox.js/DETOX_AFTER_EACH] passed test: "Example should switch to login and password reset screens"
detox[27819] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onAfterEach({ title: 'should switch to login and password reset screens',
  fullName: 'Example should switch to login and password reset screens',
  status: 'passed',
  timedOut: false })
detox[27819] TRACE: [Detox.js/DETOX_BEFORE_EACH] running test: "Example should create an account"
detox[27819] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeEach({ title: 'should create an account',
  fullName: 'Example should create an account',
  status: 'running' })
detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"reactNativeReload","params":{},"messageId":-1000}
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=tester action=reactNativeReload (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=testee action=ready (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":-1000,"type":"ready","params":{}}

detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAssertion"},"method":"assertMatcher","args":[{"type":"Invocation","value":{"target":{"type":"Cl
ass","value":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_screen"]}}]}},{"typ
e":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForSufficientlyVisible","args":[]}}]},"messageId":10}
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":10,"type":"invokeResult","params":{"result":"(null)"}}

detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_screen"]}}]}},{"type":"Inv
ocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAction"},"method":"scrollInDirection","args":[{"type":"Integer","value":4},{"type":"Double","value":150}]}}]},"messageId":11}
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":11,"type":"invokeResult","params":{"result":"(null)"}}

detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_username"]}}]}},{"type":"I
nvocation","value":{"target":{"type":"Class","value":"androidx.test.espresso.action.ViewActions"},"method":"typeText","args":["ci_user_1561994395894"]}}]},"messageId":12}
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":12,"type":"invokeResult","params":{"result":"(null)"}}

detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_email"]}}]}},{"type":"Invo
cation","value":{"target":{"type":"Class","value":"androidx.test.espresso.action.ViewActions"},"method":"typeText","args":["[email protected]"]}}]},"messageId":13}
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":13,"type":"invokeResult","params":{"result":"(null)"}}

detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_screen"]}}]}},{"type":"Inv
ocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAction"},"method":"scrollInDirection","args":[{"type":"Integer","value":4},{"type":"Double","value":100}]}}]},"messageId":14}
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":14,"type":"invokeResult","params":{"result":"(null)"}}

detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_password"]}}]}},{"type":"I
nvocation","value":{"target":{"type":"Class","value":"androidx.test.espresso.action.ViewActions"},"method":"typeText","args":["password_1561994395894"]}}]},"messageId":15}
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":15,"type":"invokeResult","params":{"result":"(null)"}}

detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_password"]}}]}},{"type":"I
nvocation","value":{"target":{"type":"Class","value":"androidx.test.espresso.action.ViewActions"},"method":"typeText","args":["\n"]}}]},"messageId":16}
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":16,"type":"invokeResult","params":{"result":"(null)"}}

detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_screen"]}}]}},{"type":"Inv
ocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAction"},"method":"scrollToEdge","args":[{"type":"Integer","value":4}]}}]},"messageId":17}
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":17,"type":"invokeResult","params":{"result":"(null)"}}

detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_button"]}}]}},{"type":"Inv
ocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxViewActions"},"method":"click","args":[]}}]},"messageId":18}
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":18,"type":"invokeResult","params":{"result":"(null)"}}

detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAssertion"},"method":"assertMatcher","args":[{"type":"Invocation","value":{"target":{"type":"Cl
ass","value":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForAtIndex","args":[{"type":"Integer","value":
1},{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["recommended_cards_view"]}}]}}]}},{"type":"Invocation","value":{"target":{"type":"Class","value":"
com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForSufficientlyVisible","args":[]}}]},"messageId":19}
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=1f60744f-5dcd-b89c-8481-fb6ddf25098b)
detox[27819] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":19,"type":"invokeResult","params":{"result":"(null)"}}

Example: should create an account [OK]

Environment (please complete the following information):

  • Detox: 13.0.1 (13.0.0 had the same problem)
  • React Native: 0.58.0
  • Node: 8.16.0
  • Device: android emulator 27.3.10-4969155 (KVM 12.0.0) - android 8.0 (Oreo) API 26
  • OS: Linux 4.15 Linux Mint 18 (Sarah)

Device and Verbose Detox Logs
Below is the start of the log, before the specific test case's log that I have attached above to help match logs and screencasts. I hope this makes sense!


Startup logs

detox[8848] INFO:  [test.js] configuration="android.emuandroid26.debug" loglevel="trace" artifactsLocation="artifacts/android.emuandroid26.debug.2019-07-01 15-06-21Z" recordLogs="none" takeScreenshots="manual" recordVideos="none" recordPe$
formance="none" reportSpecs=true node_modules/.bin/jest --config=e2e/config.json --maxWorkers=1 '--testNamePattern=^((?!:ios:).)*$' "e2e"
watchman warning:  Recrawled this watch 2 times, most recently because:
somepath: IN_Q_OVERFLOW
To resolve, please review the information on
https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl
To clear this warning, run:
`watchman watch-del somepath ; watchman watch-project somepath`

detox[8856] INFO:  [DetoxServer.js] server listening on localhost:36811...
detox[8856] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:36811
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"login","params":{"sessionId":"cb14770e-9574-6733-1313-2017e313774b","role":"tester"},"messageId":0}
detox[8856] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=cb14770e-9574-6733-1313-2017e313774b
detox[8856] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=cb14770e-9574-6733-1313-2017e313774b
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"loginSuccess","params":{"sessionId":"cb14770e-9574-6733-1313-2017e313774b","role":"tester"},"messageId":0}

detox[8856] DEBUG: [exec.js/EXEC_CMD, #0] android-sdk-path/emulator/emulator -list-avds --verbose
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #0] 480x800-kitkat4.4
android26

detox[8856] DEBUG: [exec.js/EXEC_CMD, #1] android-sdk-path/platform-tools/adb  devices
detox[8856] DEBUG: [exec.js/EXEC_SUCCESS, #1] List of devices attached
emulator-5554   device


detox[8856] TRACE: [EmulatorTelnet.js/TELNET_CONNECTING] port: 5554, host: localhost
detox[8856] DEBUG: [exec.js/EXEC_CMD, #2] android-sdk-path/platform-tools/adb -s emulator-5554 shell "getprop dev.bootcomplete"
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #2] 1

detox[8856] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBootDevice({ coldBoot: false, deviceId: 'emulator-5554' })
detox[8856] DEBUG: [exec.js/EXEC_CMD, #3] android-sdk-path/platform-tools/adb -s emulator-5554 shell "getprop ro.build.version.sdk"
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #3] 26

detox[8856] DEBUG: [exec.js/EXEC_CMD, #4] android-sdk-path/platform-tools/adb -s emulator-5554 shell "dumpsys power | grep \"^[ ]*m[UW].*=\""
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #4]   mWakefulness=Awake
  mWakefulnessChanging=false
  mWakeLockSummary=0x0
  mUserActivitySummary=0x1
  mWakeUpWhenPluggedOrUnpluggedConfig=false
  mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig=false
  mUserActivityTimeoutOverrideFromWindowManager=-1
  mUserInactiveOverrideFromWindowManager=false

detox[8856] DEBUG: [exec.js/EXEC_CMD, #5] android-sdk-path/build-tools/28.0.3/aapt dump badging "somepath/android/app/build/outputs/apk/dev/debug/app-dev-debug.apk" | grep -e "package:
name="
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #5] package: name='org.missingmaps.mapswipe.dev' versionCode='10328' versionName='1.3.28-dev' platformBuildVersionName='1.3.28-dev' compileSdkVersion='28' compileSdkVersionCodename='9'

detox[8856] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeUninstallApp({ deviceId: 'emulator-5554',
  bundleId: 'org.missingmaps.mapswipe.dev' })
detox[8856] DEBUG: [exec.js/EXEC_CMD, #6] android-sdk-path/platform-tools/adb -s emulator-5554 shell "pm list packages org.missingmaps.mapswipe.dev"
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #6] package:org.missingmaps.mapswipe.dev
package:org.missingmaps.mapswipe.dev.test

detox[8856] DEBUG: [exec.js/EXEC_CMD, #7] android-sdk-path/platform-tools/adb -s emulator-5554 uninstall org.missingmaps.mapswipe.dev
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #7] Success

detox[8856] DEBUG: [exec.js/EXEC_CMD, #8] android-sdk-path/platform-tools/adb -s emulator-5554 shell "pm list packages org.missingmaps.mapswipe.dev.test"
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #8] package:org.missingmaps.mapswipe.dev.test

detox[8856] DEBUG: [exec.js/EXEC_CMD, #9] android-sdk-path/platform-tools/adb -s emulator-5554 uninstall org.missingmaps.mapswipe.dev.test
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #9] Success

detox[8856] DEBUG: [exec.js/EXEC_CMD, #10] android-sdk-path/platform-tools/adb -s emulator-5554 install -r -g -t "somepath/android/app/build/outputs/apk/dev/debug/app-dev-debug.apk"
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #10] Success

detox[8856] DEBUG: [exec.js/EXEC_CMD, #11] android-sdk-path/platform-tools/adb -s emulator-5554 install -r -g -t "somepath/android/app/build/outputs/apk/androidTest/dev/debug/app-dev-de
bug-androidTest.apk"
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #11] Success

detox[8856] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeTerminateApp({ deviceId: 'emulator-5554',
  bundleId: 'org.missingmaps.mapswipe.dev' })
detox[8856] DEBUG: [exec.js/EXEC_CMD, #12] android-sdk-path/platform-tools/adb -s emulator-5554 shell "am force-stop org.missingmaps.mapswipe.dev"
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #12]
detox[8856] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeLaunchApp({ deviceId: 'emulator-5554',
  bundleId: 'org.missingmaps.mapswipe.dev',
  launchArgs:
   { detoxServer: 'ws://localhost:36811',
     detoxSessionId: 'cb14770e-9574-6733-1313-2017e313774b' } })
detox[8856] DEBUG: [exec.js/EXEC_CMD, #13] android-sdk-path/platform-tools/adb -s emulator-5554 shell "date +\"%m-%d %T.000\""
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #13] 07-01 16:06:26.000

detox[8856] DEBUG: [exec.js/EXEC_CMD, #14] android-sdk-path/platform-tools/adb -s emulator-5554 shell "pm list instrumentation"
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #14] instrumentation:com.android.emulator.smoketests/android.support.test.runner.AndroidJUnitRunner (target=com.android.emulator.smoketests)
instrumentation:com.android.smoketest.tests/com.android.smoketest.SmokeTestRunner (target=com.android.smoketest)
instrumentation:com.example.android.apis/.app.LocalSampleInstrumentation (target=com.example.android.apis)
instrumentation:org.chromium.webview_shell/.WebViewLayoutTestRunner (target=org.chromium.webview_shell)
instrumentation:org.missingmaps.mapswipe.dev.test/androidx.test.runner.AndroidJUnitRunner (target=org.missingmaps.mapswipe.dev)

detox[8856] DEBUG: [exec.js/SPAWN_CMD, #15] [pid=9062] android-sdk-path/platform-tools/adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:36811 -e detoxSessionId cb14770e-9574-6733-1313-20
17e313774b -e debug ZmFsc2U= org.missingmaps.mapswipe.dev.test/androidx.test.runner.AndroidJUnitRunner
detox[8856] TRACE: [exec.js/SPAWN_STDOUT, #15] INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
org.missingmaps.mapswipe.DetoxTest:
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: test=runDetoxTests
INSTRUMENTATION_STATUS: class=org.missingmaps.mapswipe.DetoxTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS_CODE: 1

detox[8856] DEBUG: [exec.js/EXEC_CMD, #16] android-sdk-path/platform-tools/adb -s emulator-5554 shell "ps | grep \"org\.missingmaps\.mapswipe\.dev$\""
detox[8856] TRACE: [exec.js/EXEC_SUCCESS, #16] u0_a219      21513  1492  928372  87468 SyS_epoll_wait      0 S org.missingmaps.mapswipe.dev

detox[21513] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onLaunchApp({ deviceId: 'emulator-5554',
  bundleId: 'org.missingmaps.mapswipe.dev',
  launchArgs:
   { detoxServer: 'ws://localhost:36811',
     detoxSessionId: 'cb14770e-9574-6733-1313-2017e313774b' },
  pid: 21513 })
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"isReady","params":{},"messageId":-1000}
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=tester action=isReady (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] DEBUG: [DetoxServer.js/LOGIN] role=testee, sessionId=cb14770e-9574-6733-1313-2017e313774b
detox[8856] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=testee, sessionId=cb14770e-9574-6733-1313-2017e313774b
detox[8856] TRACE: [DetoxServer.js/MESSAGE] role=testee action=ready (sessionId=cb14770e-9574-6733-1313-2017e313774b)
detox[8856] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":-1000,"type":"ready","params":{}}

detox[8856] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeAll()

acceptebug android

Most helpful comment

I've successfully managed to have this issue reproduced in Detox' own test app. What I see leads to a bug in Espresso, where the internal tap event (right before typing is initiated) is ignored - possibly like in #1485 .

All 12 comments

I see that the first text field is not tapped or typed into. Doesn't seem like an issue with typeText().

@LeoNatan I'm not sure what you mean. The code that is like this:

        await expect(element(by.id('signup_screen'))).toBeVisible();
        await element(by.id('signup_screen')).scroll(150, 'down');
        await element(by.id('signup_username')).typeText(username);  // this is the first field
        await element(by.id('signup_email')).typeText(email);  // second field
        await element(by.id('signup_screen')).scroll(100, 'down');
        await element(by.id('signup_password')).typeText(password);  // third field
        await element(by.id('signup_password')).tapReturnKey();
        await element(by.id('signup_screen')).scrollTo('bottom');
        await element(by.id('signup_button')).tap();

Do you mean that I should add a .tap() on the first field before .typeText()?

Try tapping on each text field before typing. There might be a bug there.

Thanks for your super fast replies! I tried adding taps before each typeText and couldn't see the bug happen again.
When I removed the taps again, I had a couple of correct runs, and then this one:
The second field is missed, and its content goes into the first one (note that I swapped 2 lines in the code, see below):
screencast_failed

    await element(by.id('signup_screen')).scroll(150, 'down');
    await element(by.id('signup_username')).typeText(username);
    await element(by.id('signup_screen')).scroll(100, 'down');  // swapped this line before typing email
    await element(by.id('signup_email')).typeText(email);
    await element(by.id('signup_password')).typeText(password);


logs

Example: should create an account
detox[10909] TRACE: [Detox.js/DETOX_AFTER_EACH] passed test: "Example should switch to login and password reset screens"
detox[10909] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onAfterEach({ title: 'should switch to login and password reset screens',
  fullName: 'Example should switch to login and password reset screens',
  status: 'passed',
  timedOut: false })
detox[10909] TRACE: [Detox.js/DETOX_BEFORE_EACH] running test: "Example should create an account"
detox[10909] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeEach({ title: 'should create an account',
  fullName: 'Example should create an account',
  status: 'running' })
detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"reactNativeReload","params":{},"messageId":-1000}
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=tester action=reactNativeReload (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=testee action=ready (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":-1000,"type":"ready","params":{}}

detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAssertion"},"method":"assertMatcher","args":[{"type":"Invocation","value":{"target":{"type":"Cl
ass","value":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_screen"]}}]}},{"typ
e":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForSufficientlyVisible","args":[]}}]},"messageId":10}
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":10,"type":"invokeResult","params":{"result":"(null)"}}

detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_screen"]}}]}},{"type":"Inv
ocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAction"},"method":"scrollInDirection","args":[{"type":"Integer","value":4},{"type":"Double","value":150}]}}]},"messageId":11}
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":11,"type":"invokeResult","params":{"result":"(null)"}}

detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_username"]}}]}},{"type":"I
nvocation","value":{"target":{"type":"Class","value":"androidx.test.espresso.action.ViewActions"},"method":"typeText","args":["ci_user_1561997608815"]}}]},"messageId":12}
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":12,"type":"invokeResult","params":{"result":"(null)"}}

detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_screen"]}}]}},{"type":"Inv
ocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAction"},"method":"scrollInDirection","args":[{"type":"Integer","value":4},{"type":"Double","value":100}]}}]},"messageId":13}
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":13,"type":"invokeResult","params":{"result":"(null)"}}

detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_email"]}}]}},{"type":"Invo
cation","value":{"target":{"type":"Class","value":"androidx.test.espresso.action.ViewActions"},"method":"typeText","args":["[email protected]"]}}]},"messageId":14}
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":14,"type":"invokeResult","params":{"result":"(null)"}}

detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_password"]}}]}},{"type":"I
nvocation","value":{"target":{"type":"Class","value":"androidx.test.espresso.action.ViewActions"},"method":"typeText","args":["password_1561997608815"]}}]},"messageId":15}
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":15,"type":"invokeResult","params":{"result":"(null)"}}

detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_password"]}}]}},{"type":"I
nvocation","value":{"target":{"type":"Class","value":"androidx.test.espresso.action.ViewActions"},"method":"typeText","args":["\n"]}}]},"messageId":16}
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":16,"type":"invokeResult","params":{"result":"(null)"}}
detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_screen"]}}]}},{"type":"Inv
ocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAction"},"method":"scrollToEdge","args":[{"type":"Integer","value":4}]}}]},"messageId":17}
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":17,"type":"invokeResult","params":{"result":"(null)"}}

detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.EspressoDetox"},"method":"perform","args":[{"type":"Invocation","value":{"target":{"type":"Class","v
alue":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["signup_button"]}}]}},{"type":"Inv
ocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxViewActions"},"method":"click","args":[]}}]},"messageId":18}
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":18,"type":"invokeResult","params":{"result":"(null)"}}

detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxAssertion"},"method":"assertMatcher","args":[{"type":"Invocation","value":{"target":{"type":"Cl
ass","value":"androidx.test.espresso.Espresso"},"method":"onView","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForAtIndex","args":[{"type":"Integer","value":
1},{"type":"Invocation","value":{"target":{"type":"Class","value":"com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForTestId","args":["recommended_cards_view"]}}]}}]}},{"type":"Invocation","value":{"target":{"type":"Class","value":"
com.wix.detox.espresso.DetoxMatcher"},"method":"matcherForSufficientlyVisible","args":[]}}]},"messageId":19}
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [DetoxServer.js/MESSAGE] role=testee action=error (sessionId=b2eaaf1c-d7b0-a550-fba8-ec64dab72a10)
detox[10909] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"messageId":19,"type":"error","params":{"error":"'at least 75 percent of the view's area is displayed to the user.' doesn't match the selected view.\nExpected: at least 75 percent
of the view's area is displayed to the user.\n     Got: null\n"}}

Example: should create an account [FAIL]

Please use tap() for the time being. We'll take a look at it.

@d4vidi Could you please take a look? Seems like espresso doesn't correctly tap on elements.

And one more example, where the first field is overwritten by what should go in the second one (I wonder if this could be linked to #1462):

        // no scrolling before this
        await element(by.id('signup_username')).typeText(username);
        await element(by.id('signup_screen')).scroll(150, 'down');
        await element(by.id('signup_email')).typeText(email);
        await element(by.id('signup_password')).typeText(password);

screencast_miss_email

After moving the code around a bit, I am getting the impression that the sequence scroll -> type is causing problems. I have not seen problems with the second typeText if I do scroll -> type -> type.

@LeoNatan I will use tap() for now, it does seem to work around the issue. Thanks for your help!
@d4vidi please let me know if you want me to try a few changes in my code.

In 13.0.1 we just had an important issue fixed related to post-scroll tapping.
Nevertheless I see that more problems still remain.
@laurentS thanks for this submission.
@viktorijasujetaite have you come across anything like this? @yedidyak?

I've successfully managed to have this issue reproduced in Detox' own test app. What I see leads to a bug in Espresso, where the internal tap event (right before typing is initiated) is ignored - possibly like in #1485 .

Well, seems I've really gone down the rabbit hole with this one - but at least I _do_ have a repro + solution now (!)

The reason behind the complexity of solving this is was that there were in fact 2 problems involved, one of which was in the swiping mechanism - which is allegedly implemented perfectly, which made it overly confusing.

The bottom lines are:

  1. The swiping mechanism is a simple one, and it works as follows: dispatch an action-down, move N times, action-up. While within the sequence, the view not only scrolls, but also gains momentum. So once the manual sequence is over, scrolling continues due to a fling. Therefore, past the sequence, we issue the traditional espresso wait-for-idle call, which should basically do the trick, and end once the fling is over. However, as it seems - and so I've proved this to be true: sometime the last bits of scrolling (due to fling) continues past the idle wait's return **. I haven't gotten around yet to investigating how this could possibly be, but one possibility is for the fling manager to be using (perhaps indirectly) the choreographer in order to sync, rather than by posting to the main thread. This is still a WIP.
  1. Espresso's typeText api (or at least the flavor we used) starts by issuing a native tap. However in RN the pure native tap isn't good enough - at least not on touch components (e.g. TouchableOpacity), because of the JS timers invoked on the JS side in order to deduce a long-tap and handle the ripple effect (yuck!). We already have a solution for this but it was not integrated into the typeText use case, hence often enough these simple preliminary taps became long-taps without us being aware of it.

Both problems are easy to fix and I will address them next week.


** in this case the following so-called 'preliminary' native tap done in order to put the next input box in focus (e.g. going from user name to password), is effectively intercepted by the scroll-view itself (i.e. hijacked by it from the input box itself) and the interpretation of it is 'abruptly stop scrolling'. Effectively, this is why the view never gets tapped on. For more info, this is by far the best explanation of how this works that I've found.

Updates with respect to previous comment:
seems that the reason why wait-for-idle returns prematurely - as explained in case 1, could be the fact that idle-wait has a limited 15ms lookahead view. Possibly, sometimes the end of flings, which is typically performed gradually slower and slower, is scheduled to occur somewhere behind that, and thus a single wait isn't enough. Bummer. If this is the case, it might have additional implication we are not aware this, need to keep this in mind.

Please try again with Detox 13.3.0.

Was this page helpful?
0 / 5 - 0 ratings