Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detox error - Detox can't seem to connect to the test app(s) on real devices #2989

Closed
AshrafRizvi01 opened this issue Sep 20, 2021 · 6 comments

Comments

@AshrafRizvi01
Copy link

AshrafRizvi01 commented Sep 20, 2021

### HINT: 

The test app might have crashed prematurely, or has had trouble setting up the connection.
Refer to our troubleshooting guide, for full details: https://github.com/wix/Detox/blob/master/docs/Troubleshooting.RunningTests.md#tests-execution-hangs 

detox[738] ERROR: [Client.js/ERROR] �[31mDetox can't seem to connect to the test app(s)!

HINT:

Have you forgotten to call 'device.launchApp()' in the beginning of your test?�
I have added device.launch and the app launces
Refer to our troubleshooting guide, for full details: https://github.com/wix/Detox/blob/master/docs/Troubleshooting.RunningTests.md#tests-execution-hangs
Implemented everything and the issue happens even on Android 8

The following package could not be delivered:�[39m

{�type: 'invoke',� params: [Object],
'MessageId: 2` }

Till now the tests were working fine suddenly it started going on timeouts and then on updating detox, it doesn't work

Note: The same set up works fine on an emulator but fails on real devices

Device Logs -

W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=XXX flg=0x4000010 (has extras) } to com.google.android.packageinstaller/com.android.packageinstaller.PackageInstalledReceiver
09-20 20:15:01.581  1384  1429 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:XXX.test flg=0x4000010 (has extras) } to com.android.musicfx/.Compatibility$Receiver
09-20 20:15:01.582  1384  1429 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:XXX flg=0x4000010 (has extras) } to com.android.vending/com.google.android.finsky.packagemanager.impl.PackageMonitorReceiverImpl$RegisteredReceiver
09-20 20:15:01.582  1384  1429 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:XXX flg=0x4000010 (has extras) } to com.google.android.gms/.games.chimera.GamesSystemBroadcastReceiverProxy
09-20 20:15:01.582  1384  1429 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=XXX flg=0x4000010 (has extras) } to com.google.android.gms/.gass.chimera.PackageChangeBroadcastReceiver
09-20 20:15:01.582  1384  1429 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=XXX flg=0x4000010 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
09-20 20:15:01.583  2544  2910 W AiAiAutofill: Failed to set whitelist for augmented autofill service.
09-20 20:15:01.583  2544  2910 W AiAiAutofill: java.lang.SecurityException: caller is not user's Augmented Autofill Service
09-20 20:15:01.583  2544  2910 W AiAiAutofill: 	at android.view.autofill.AutofillManager.setAugmentedAutofillWhitelist(AutofillManager.java:1943)
@AshrafRizvi01
Copy link
Author

Any updates on this one?

@noomorph
Copy link
Collaborator

Do you see any hints like this?

@dooleyb1
Copy link

dooleyb1 commented Sep 28, 2021

I'm currently experiencing a similar issue, detox tests were working fine however I have just recently migrated to a MacBook with an M1 Apple Silicon chip.

The app loads on the simulator via detox test -c ios.sim.debug fine, however, when trying to perform a simple query & press of a button on an iOS simulator like below I am experiencing the following:

await element(by.id('not-now')).tap();
detox[60504] TRACE: [WSS_SEND_TO, #app] {"type":"invoke","params":{"type":"action","action":"tap","predicate":{"type":"id","value":"not-now"}},"messageId":2}
detox[60504] TRACE: [WSS_GET_FROM, #app] {"type":"AppWillTerminateWithError","params":{"errorDetails":"Exception was thrown: \nNSInvalidArgumentException\n+[UIWindowScene _keyWindowScene]: unrecognized selector sent to class 0x1326cc5f8\n(\n\t0   CoreFoundation                      0x0000000112cb2ba4 __exceptionPreprocess + 226\n\t1   libobjc.A.dylib                     0x000000010f1f7be7 objc_exception_throw + 48\n\t2   CoreFoundation                      0x0000000112cc173a __CFExceptionProem + 0\n\t3   CoreFoundation                      0x0000000112cb70bc ___forwarding___ + 1433\n\t4   CoreFoundation                      0x0000000112cb91e8 _CF_forwarding_prep_0 + 120\n\t5   Detox                               0x000000010ed1ca12 +[UIWindow(DetoxUtils) dtx_allKeyWindowSceneWindows] + 43\n\t6   Detox                               0x000000010ed207d1 +[UIView(DetoxMatchers) dtx_findViewsInKeySceneWindowsPassingPredicate:] + 56\n\t7   Detox                               0x000000010ed3d853 Detox.Element.(views in _14E24C92C1353FEA1FC68E698CB917EF).getter : Swift.Array<__C.NSObject> + 211\n\t8   Detox                               0x000000010ed3dba1 Detox.Element.(view in _14E24C92C1353FEA1FC68E698CB917EF).getter : __C.NSObject + 49\n\t9   Detox                               0x000000010ed2dd00 Detox.TapAction.perform(on: Detox.Element) -> Swift.Optional<Swift.Dictionary<Swift.String, Any>> + 416\n\t10  Detox                               0x000000010ed2dd59 vtable thunk for Detox.Action.(perform in _04ABBB5C7C570871DB67625EF38728EC)(on: Detox.Element) -> Swift.Optional<Swift.Dictionary<Swift.String, Any>> dispatching to Detox.TapAction.perform(on: Detox.Element) -> Swift.Optional<Swift.Dictionary<Swift.String, Any>> + 9\n\t11  Detox                               0x000000010ed2d4ef Detox.Action.(perform in _04ABBB5C7C570871DB67625EF38728EC)(on: Detox.Element, completionHandler: (Swift.Optional<Swift.Dictionary<Swift.String, Any>>, Swift.Optional<Swift.Error>) -> ()) -> () + 31\n\t12  Detox                               0x000000010ed32d6a partial apply forwarder for closure #1 () -> () in Detox.Action.perform(completionHandler: (Swift.Optional<Swift.Dictionary<Swift.String, Any>>, Swift.Optional<Swift.Error>) -> ()) -> () + 42\n\t13  Detox                               0x000000010ed32db1 partial apply forwarder for reabstraction thunk helper from @callee_guaranteed () -> () to @escaping @callee_guaranteed () -> () + 17\n\t14  Detox                               0x000000010ed2f8ae reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 14\n\t15  Detox                               0x000000010ed287fe +[DTXAssertionHandler try:error:] + 47\n\t16  Detox                               0x000000010ed2d5fe Detox.Action.perform(completionHandler: (Swift.Optional<Swift.Dictionary<Swift.String, Any>>, Swift.Optional<Swift.Error>) -> ()) -> () + 238\n\t17  Detox                               0x000000010ed3baa4 function signature specialization <Arg[1] = Dead, Arg[2] = Owned To Guaranteed, Arg[3] = Owned To Guaranteed> of function signature specialization <Arg[1] = [Closure Propagated : closure #1 (Swift.Optional<Swift.Dictionary<Swift.String, Any>>, Swift.Optional<Swift.Error>) -> () in closure #2 () -> () in Detox.DetoxManager.webSocket(_: Detox.WebSocket, didReceiveAction: Swift.String, params: Swift.Dictionary<Swift.String, Any>, messageId: __C.NSNumber) -> (), Argument Types : [Detox.DetoxManager__C.NSNumber]> of static Detox.InvocationManager.invoke(dictionaryRepresentation: Swift.Dictionary<Swift.String, Any>, completionHandler: (Swift.Optional<Swift.Dictionary<Swift.String, Any>>, Swift.Optional<Swift.Error>) -> ()) -> () + 980\n\t18  Detox                               0x000000010ed55f30 partial apply forwarder for closure #2 () -> () in Detox.DetoxManager.webSocket(_: Detox.WebSocket, didReceiveAction: Swift.String, params: Swift.Dictionary<Swift.String, Any>, messageId: __C.NSNumber) -> () + 64\n\t19  Detox                               0x000000010ed2f8ae reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 14\n\t20  DetoxSync                           0x00000001417a760d __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.132 + 184\n\t21  libdispatch.dylib                   0x0000000117334876 _dispatch_call_block_and_release + 12\n\t22  libdispatch.dylib                   0x0000000117335a56 _dispatch_client_callout + 8\n\t23  libdispatch.dylib                   0x0000000117342e20 _dispatch_main_queue_callback_4CF + 1073\n\t24  CoreFoundation                      0x0000000112c2085d __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9\n\t25  CoreFoundation                      0x0000000112c1b0ba __CFRunLoopRun + 2772\n\t26  CoreFoundation                      0x0000000112c1a103 CFRunLoopRunSpecific + 567\n\t27  GraphicsServices                    0x0000000117d6bcd3 GSEventRunModal + 139\n\t28  UIKitCore                           0x0000000131796e63 -[UIApplication _run] + 928\n\t29  DetoxSync                           0x00000001417a32fd __detox_sync_UIApplication_run + 362\n\t30  UIKitCore                           0x000000013179ba53 UIApplicationMain + 101\n\t31  Community                           0x0000000104022278 main + 104\n\t32  dyld                                0x000000010e7c7e1e start_sim + 10\n\t33  ???                                 0x0000000000000001 0x0 + 1\n)","queueName":"com.apple.main-thread","exceptionName":"NSInvalidArgumentException","exceptionReason":"+[UIWindowScene _keyWindowScene]: unrecognized selector sent to class 0x1326cc5f8","threadNumber":1},"messageId":-10000}

Has anything changed in regards to selectors? (unrecognized selector sent to class)

@d4vidi
Copy link
Collaborator

d4vidi commented Sep 30, 2021

@dooleyb1 this sounds somewhat related to iOS 15 support. Could you retry with Detox 18.22.0 or newer?

@vjoby-wavefin
Copy link

vjoby-wavefin commented Sep 30, 2021

@dooleyb1 this sounds somewhat related to iOS 15 support. Could you retry with Detox 18.22.0 or newer?

I can confirm that 18.22.0 is not working as well
The app installs and I see my splash screen for a second and it closes
Below is the error i see

detox[60795] TRACE: [EXEC_TRY_FAIL, #9] An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=5):
The request to open "PACKAGE_BUNDLE" failed.
Unexpected error type.
Underlying error (domain=BSServiceConnectionErrorDomain, code=3):
        The operation couldn’t be completed. XPC error received on message reply handler
        XPC error received on message reply handler

@d4vidi
Copy link
Collaborator

d4vidi commented Oct 3, 2021

@vjoby-wavefin seems I had lost focus for a minute there, before...
We don't support real iOS devices - at least not yet. We have plans on doing so, but it'll take time.

@d4vidi d4vidi closed this as completed Oct 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants