Loading [MathJax]/jax/output/CommonHTML/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >DetoxRuntimeError: NSInvalidArgumentException +[UIWindowScene _keyWindowScene]:无法识别的选择器发送到类0x12dd58db0

DetoxRuntimeError: NSInvalidArgumentException +[UIWindowScene _keyWindowScene]:无法识别的选择器发送到类0x12dd58db0
EN

Stack Overflow用户
提问于 2021-09-28 02:11:58
回答 1查看 230关注 0票数 0

我已经安装了-g detox-clidetox --save-dev (在项目根目录中),我可以构建应用程序,但当我尝试运行它时,我总是收到这个错误。我检查了执行情况,文本元素正在显示,但没有任何功能(toBeVisible、swipe、tap等)成功了。有人知道会是什么吗?谢谢。尽管有文字描述,但这不是登录流程,它只是在机载屏幕上滑动而已。

代码语言:javascript
运行
AI代码解释
复制
Login flow › should be able to login

    DetoxRuntimeError: The pending request #2 ("invoke") has been rejected due to the following error:

    The app has crashed, see the details below:

    Exception was thrown:
    NSInvalidArgumentException
    +[UIWindowScene _keyWindowScene]: unrecognized selector sent to class 0x12f6eedb0
    (
        0   CoreFoundation                      0x000000010f2984a4 __exceptionPreprocess + 226
        1   libobjc.A.dylib                     0x000000010bf3fbe7 objc_exception_throw + 48
        2   CoreFoundation                      0x000000010f2a703a __CFExceptionProem + 0
        3   CoreFoundation                      0x000000010f29c9bc ___forwarding___ + 1433
        4   CoreFoundation                      0x000000010f29eae8 _CF_forwarding_prep_0 + 120
        5   Detox                               0x000000010bf9aa12 +[UIWindow(DetoxUtils) dtx_allKeyWindowSceneWindows] + 43
        6   Detox                               0x000000010bf9e7d1 +[UIView(DetoxMatchers) dtx_findViewsInKeySceneWindowsPassingPredicate:] + 56
        7   Detox                               0x000000010bfbb853 Detox.Element.(views in _14E24C92C1353FEA1FC68E698CB917EF).getter : Swift.Array<__C.NSObject> + 211
        8   Detox                               0x000000010bfbbba1 Detox.Element.(view in _14E24C92C1353FEA1FC68E698CB917EF).getter : __C.NSObject + 49
        9   Detox                               0x000000010bfbd4e7 Detox.Element.isVisible() throws -> Swift.Bool + 39
        10  Detox                               0x000000010bfb5005 Detox.ToBeVisibleExpectation._evaluate() -> () + 101
        11  Detox                               0x000000010bfb4ae5 closure #1 () -> () in Detox.Expectation.evaluate(completionHandler: (Swift.Optional<Swift.Error>) -> ()) -> () + 101
        12  Detox                               0x000000010bfafc8c reabstraction thunk helper from @callee_guaranteed () -> () to @escaping @callee_guaranteed () -> () + 12
        13  Detox                               0x000000010bfad8ae reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 14
        14  Detox                               0x000000010bfa67fe +[DTXAssertionHandler try:error:] + 47
        15  Detox                               0x000000010bfb9e0c 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>) -> ()) -> () + 1852
        16  Detox                               0x000000010bfd3f30 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
        17  Detox                               0x000000010bfad8ae reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 14
        18  DetoxSync                           0x000000014367260d __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.132 + 184
        19  libdispatch.dylib                   0x0000000111724a82 _dispatch_call_block_and_release + 12
        20  libdispatch.dylib                   0x0000000111725c89 _dispatch_client_callout + 8
        21  libdispatch.dylib                   0x00000001117330a8 _dispatch_main_queue_callback_4CF + 1073
        22  CoreFoundation                      0x000000010f206125 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
        23  CoreFoundation                      0x000000010f200982 __CFRunLoopRun + 2772
        24  CoreFoundation                      0x000000010f1ff9cb CFRunLoopRunSpecific + 567
        25  GraphicsServices                    0x000000011546fcd3 GSEventRunModal + 139
        26  UIKitCore                           0x000000012e7ca457 -[UIApplication _run] + 928
        27  DetoxSync                           0x000000014366e2fd __detox_sync_UIApplication_run + 362
        28  UIKitCore                           0x000000012e7ceebf UIApplicationMain + 101
        29  Lykon                               0x00000001025825c0 main + 80
        30  dyld                                0x000000010ba4ae1e start_sim + 10
        31  ???                                 0x0000000000000001 0x0 + 1
    )

      11 |
      12 |   it('should be able to login', async () => {
    > 13 |     await expect(element(by.text('Want to become healthier?'))).toBeVisible();
         |                                                                 ^
      14 |     await element(by.text('Want to become healthier?')).swipe('left');
      15 |     await expect(element(by.text('Do like Ina, age 33'))).toBeVisible();
      16 |     await element(by.text('Do like Ina, age 33')).swipe('left');

      at _callee3$ (firstTest.e2e.js:13:65)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:63:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:294:22)
      at Generator.next (../node_modules/regenerator-runtime/runtime.js:119:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:63:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:155:20)
      at ../node_modules/regenerator-runtime/runtime.js:190:11

detox[29661] ERROR: [cli.js] Command failed: jest --config e2e/config.json --testNamePattern '^((?!:android:).)*$' --maxWorkers 1 e2e

➜  mobile-app git:(detox-config-new) ✗ detox test -c ios.sim.release
detox[29776] INFO:  [test.js] DETOX_CONFIGURATION="ios.sim.release" DETOX_REPORT_SPECS=true DETOX_START_TIMESTAMP=1632822349209 DETOX_USE_CUSTOM_LOGGER=true jest --config e2e/config.json --testNamePattern '^((?!:android:).)*$' --maxWorkers 1 e2e
detox[29777] INFO:  Login flow is assigned to 7575A670-2BDE-49EF-ADED-07AD59A1E43A iPhone 12
detox[29777] INFO:  [AppleSimUtils.js] com.lykon.app launched. To watch simulator logs, run:
        /usr/bin/xcrun simctl spawn 7575A670-2BDE-49EF-ADED-07AD59A1E43A log stream --level debug --style compact --predicate 'process == "Lykon"'
detox[29777] INFO:  Login flow: should be able to login
detox[29777] INFO:  Login flow: should be able to login [FAIL]

 FAIL  e2e/firstTest.e2e.js (21.925 s)
  Login flow
    ✕ should be able to login (12693 ms)

  ● Login flow › should be able to login

    DetoxRuntimeError: The pending request #2 ("invoke") has been rejected due to the following error:

    The app has crashed, see the details below:

    Exception was thrown:
    NSInvalidArgumentException
    +[UIWindowScene _keyWindowScene]: unrecognized selector sent to class 0x12dd58db0
    (
        0   CoreFoundation                      0x000000010d9024a4 __exceptionPreprocess + 226
        1   libobjc.A.dylib                     0x000000010a5a9be7 objc_exception_throw + 48
        2   CoreFoundation                      0x000000010d91103a __CFExceptionProem + 0
        3   CoreFoundation                      0x000000010d9069bc ___forwarding___ + 1433
        4   CoreFoundation                      0x000000010d908ae8 _CF_forwarding_prep_0 + 120
        5   Detox                               0x000000010a604a12 +[UIWindow(DetoxUtils) dtx_allKeyWindowSceneWindows] + 43
        6   Detox                               0x000000010a6087d1 +[UIView(DetoxMatchers) dtx_findViewsInKeySceneWindowsPassingPredicate:] + 56
        7   Detox                               0x000000010a625853 Detox.Element.(views in _14E24C92C1353FEA1FC68E698CB917EF).getter : Swift.Array<__C.NSObject> + 211
        8   Detox                               0x000000010a625ba1 Detox.Element.(view in _14E24C92C1353FEA1FC68E698CB917EF).getter : __C.NSObject + 49
        9   Detox                               0x000000010a6185b0 Detox.SwipeAction.perform(on: Detox.Element) -> Swift.Optional<Swift.Dictionary<Swift.String, Any>> + 1392
        10  Detox                               0x000000010a618709 vtable thunk for Detox.Action.(perform in _04ABBB5C7C570871DB67625EF38728EC)(on: Detox.Element) -> Swift.Optional<Swift.Dictionary<Swift.String, Any>> dispatching to Detox.SwipeAction.perform(on: Detox.Element) -> Swift.Optional<Swift.Dictionary<Swift.String, Any>> + 9
        11  Detox                               0x000000010a6154ef Detox.Action.(perform in _04ABBB5C7C570871DB67625EF38728EC)(on: Detox.Element, completionHandler: (Swift.Optional<Swift.Dictionary<Swift.String, Any>>, Swift.Optional<Swift.Error>) -> ()) -> () + 31
        12  Detox                               0x000000010a61ad6a partial apply forwarder for closure #1 () -> () in Detox.Action.perform(completionHandler: (Swift.Optional<Swift.Dictionary<Swift.String, Any>>, Swift.Optional<Swift.Error>) -> ()) -> () + 42
        13  Detox                               0x000000010a61adb1 partial apply forwarder for reabstraction thunk helper from @callee_guaranteed () -> () to @escaping @callee_guaranteed () -> () + 17
        14  Detox                               0x000000010a6178ae reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 14
        15  Detox                               0x000000010a6107fe +[DTXAssertionHandler try:error:] + 47
        16  Detox                               0x000000010a6155fe Detox.Action.perform(completionHandler: (Swift.Optional<Swift.Dictionary<Swift.String, Any>>, Swift.Optional<Swift.Error>) -> ()) -> () + 238
        17  Detox                               0x000000010a623aa4 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
        18  Detox                               0x000000010a63df30 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
        19  Detox                               0x000000010a6178ae reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 14
        20  DetoxSync                           0x0000000141cdc60d __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.132 + 184
        21  libdispatch.dylib                   0x000000010fd8ea82 _dispatch_call_block_and_release + 12
        22  libdispatch.dylib                   0x000000010fd8fc89 _dispatch_client_callout + 8
        23  libdispatch.dylib                   0x000000010fd9d0a8 _dispatch_main_queue_callback_4CF + 1073
        24  CoreFoundation                      0x000000010d870125 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
        25  CoreFoundation                      0x000000010d86a982 __CFRunLoopRun + 2772
        26  CoreFoundation                      0x000000010d8699cb CFRunLoopRunSpecific + 567
        27  GraphicsServices                    0x0000000113ad9cd3 GSEventRunModal + 139
        28  UIKitCore                           0x000000012ce34457 -[UIApplication _run] + 928
        29  DetoxSync                           0x0000000141cd82fd __detox_sync_UIApplication_run + 362
        30  UIKitCore                           0x000000012ce38ebf UIApplicationMain + 101
        31  Lykon                               0x0000000100bec5c0 main + 80
        32  dyld                                0x000000010a0b4e1e start_sim + 10
        33  ???                                 0x0000000000000001 0x0 + 1
    )

      12 |   it('should be able to login', async () => {
      13 |     //await expect(element(by.text('Want to become healthier?'))).toBeVisible();
    > 14 |     await element(by.text('Want to become healthier?')).swipe('left');
         |                                                         ^
      15 |     await expect(element(by.text('Do like Ina, age 33'))).toBeVisible();
      16 |     await element(by.text('Do like Ina, age 33')).swipe('left');
      17 |     await expect(element(by.text('Stop the second guessing'))).toBeVisible();

      at _callee3$ (firstTest.e2e.js:14:57)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:63:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:294:22)
      at Generator.next (../node_modules/regenerator-runtime/runtime.js:119:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:63:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:155:20)
      at ../node_modules/regenerator-runtime/runtime.js:190:11

detox[29776] ERROR: [cli.js] Command failed: jest --config e2e/config.json --testNamePattern '^((?!:android:).)*$' --maxWorkers 1 e2e

这是我第一次在Stack Overflow上问问题,我有点迷茫,不知道我应该提供什么信息。所以,如果你需要更多的信息,我很感谢你问我。谢谢。

e2e/config.json:

代码语言:javascript
运行
AI代码解释
复制
{
  "testEnvironment": "./environment",
  "testRunner": "jest-circus/runner",
  "testTimeout": 120000,
  "testRegex": "\\.e2e\\.js$",
  "reporters": ["detox/runners/jest/streamlineReporter"],
  "verbose": true
}

e2e/environment.js .js

代码语言:javascript
运行
AI代码解释
复制
const {
  DetoxCircusEnvironment,
  SpecReporter,
  WorkerAssignReporter
} = require('detox/runners/jest-circus');

class CustomDetoxEnvironment extends DetoxCircusEnvironment {
  constructor(config, context) {
    super(config, context);

    // Can be safely removed, if you are content with the default value (=300000ms)
    this.initTimeout = 300000;

    // This takes care of generating status logs on a per-spec basis. By default, Jest only reports at file-level.
    // This is strictly optional.
    this.registerListeners({
      SpecReporter,
      WorkerAssignReporter
    });
  }
}

module.exports = CustomDetoxEnvironment;
EN

回答 1

Stack Overflow用户

发布于 2021-10-05 07:29:04

在这篇PR https://github.com/wix/Detox/issues/2895升级到"detox": "^18.22.1"中讨论了iOS 15的问题时,解毒已经帮我解决了这个问题

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69359825

复制
相关文章

相似问题

添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档