Detox: Tap on Switch component fails in around 20% of the time

Created on 10 Feb 2020  路  15Comments  路  Source: wix/Detox

Description

I have a React-native Switch component that I need to tap on in an e2e test. In around 20% of the tests I can see a tap in the simulator, but the tap is not registered by the app.

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

Reproduction

Here is a repo that demonstrates the issue: https://github.com/compojoom/rnDetoxActionSheetBug/tree/switch-bug

I'm rendering a switch component several times on the screen. And in my test I'm trying to press those components.
https://github.com/compojoom/rnDetoxActionSheetBug/blob/switch-bug/App.js#L29;L57

https://github.com/compojoom/rnDetoxActionSheetBug/blob/switch-bug/e2e/firstTest.spec.js#L6;L36

This doesn't always happen. Sometimes the test completes successfully... On Android it seems to register the taps all the time.

Expected behavior

I would expect that the App would always register the tap as it happens when one manually presses the switch.

Screenshots

here is a video:

flacky-switch

Environment (please complete the following information):

  • Detox: 15.1.4
  • React Native: 0.61.5
  • Node: 13.6.0
  • Device: iphone 11 Pro
  • Xcode: 11.3.1
  • iOS: 13.3
  • macOS: 10.15.2

Logs

Here is trace when the first click fails:

etox[56455] INFO:  [test.js] configuration="ios.sim.debug" loglevel="trace" reportSpecs=true DETOX_START_TIMESTAMP=1581340575061 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 "e2e"
detox[56456] INFO:  [DetoxServer.js] server listening on localhost:57221...
detox[56456] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:57221
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"login","params":{"sessionId":"9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c","role":"tester"},"messageId":0}
detox[56456] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c
detox[56456] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"loginSuccess","params":{"sessionId":"9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c","role":"tester"},"messageId":0}

detox[56456] DEBUG: [exec.js/EXEC_CMD, #0] applesimutils --list --byType "iPhone 11 Pro"
detox[56456] TRACE: [exec.js/EXEC_SUCCESS, #0] [
  {
    "deviceType" : {
      "name" : "iPhone 11 Pro",
      "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone 11 Pro.simdevicetype",
      "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro"
    },
    "state" : "Booted",
    "isAvailable" : true,
    "name" : "iPhone 11 Pro",
    "udid" : "D32E8E61-6DB1-46C9-8242-38DB0B86A95C",
    "os" : {
      "buildversion" : "17C45",
      "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime",
      "isAvailable" : true,
      "name" : "iOS 13.3",
      "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-13-3",
      "version" : "13.3"
    }
  }
]

detox[56456] DEBUG: [exec.js/EXEC_CMD, #1] applesimutils --list --byId D32E8E61-6DB1-46C9-8242-38DB0B86A95C --maxResults 1
detox[56456] TRACE: [exec.js/EXEC_SUCCESS, #1] [
  {
    "deviceType" : {
      "name" : "iPhone 11 Pro",
      "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/DeviceTypes\/iPhone 11 Pro.simdevicetype",
      "identifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro"
    },
    "state" : "Booted",
    "isAvailable" : true,
    "name" : "iPhone 11 Pro",
    "udid" : "D32E8E61-6DB1-46C9-8242-38DB0B86A95C",
    "os" : {
      "buildversion" : "17C45",
      "bundlePath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime",
      "isAvailable" : true,
      "name" : "iOS 13.3",
      "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-13-3",
      "version" : "13.3"
    }
  }
]

detox[56456] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBootDevice({ coldBoot: false, deviceId: 'D32E8E61-6DB1-46C9-8242-38DB0B86A95C' })
detox[56456] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeUninstallApp({
  deviceId: 'D32E8E61-6DB1-46C9-8242-38DB0B86A95C',
  bundleId: 'org.reactjs.native.example.rnDetoxActionSheetBug'
})
detox[56456] DEBUG: [exec.js/EXEC_CMD, #2] /usr/bin/xcrun simctl uninstall D32E8E61-6DB1-46C9-8242-38DB0B86A95C org.reactjs.native.example.rnDetoxActionSheetBug
detox[56456] DEBUG: [exec.js/EXEC_TRY, #2] Uninstalling org.reactjs.native.example.rnDetoxActionSheetBug...
detox[56456] TRACE: [exec.js/EXEC_SUCCESS, #2]
detox[56456] DEBUG: [exec.js/EXEC_SUCCESS, #2] org.reactjs.native.example.rnDetoxActionSheetBug uninstalled
detox[56456] DEBUG: [exec.js/EXEC_CMD, #3] /usr/bin/xcrun simctl install D32E8E61-6DB1-46C9-8242-38DB0B86A95C "/Users/XXX/Development/rnDetoxActionSheetBug/ios/build/Build/Products/Debug-iphonesimulator/rnDetoxActionSheetBug.app"
detox[56456] DEBUG: [exec.js/EXEC_TRY, #3] Installing /Users/XXX/Development/rnDetoxActionSheetBug/ios/build/Build/Products/Debug-iphonesimulator/rnDetoxActionSheetBug.app...
detox[56456] TRACE: [exec.js/EXEC_SUCCESS, #3]
detox[56456] DEBUG: [exec.js/EXEC_SUCCESS, #3] /Users/XXX/Development/rnDetoxActionSheetBug/ios/build/Build/Products/Debug-iphonesimulator/rnDetoxActionSheetBug.app installed
detox[56456] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeTerminateApp({
  deviceId: 'D32E8E61-6DB1-46C9-8242-38DB0B86A95C',
  bundleId: 'org.reactjs.native.example.rnDetoxActionSheetBug'
})
detox[56456] DEBUG: [exec.js/EXEC_CMD, #4] /usr/bin/xcrun simctl terminate D32E8E61-6DB1-46C9-8242-38DB0B86A95C org.reactjs.native.example.rnDetoxActionSheetBug
detox[56456] DEBUG: [exec.js/EXEC_TRY, #4] Terminating org.reactjs.native.example.rnDetoxActionSheetBug...
detox[56456] TRACE: [exec.js/EXEC_SUCCESS, #4]
detox[56456] DEBUG: [exec.js/EXEC_SUCCESS, #4] org.reactjs.native.example.rnDetoxActionSheetBug terminated
detox[56456] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onTerminateApp({
  deviceId: 'D32E8E61-6DB1-46C9-8242-38DB0B86A95C',
  bundleId: 'org.reactjs.native.example.rnDetoxActionSheetBug'
})
detox[56456] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeLaunchApp({
  bundleId: 'org.reactjs.native.example.rnDetoxActionSheetBug',
  deviceId: 'D32E8E61-6DB1-46C9-8242-38DB0B86A95C',
  launchArgs: {
    detoxServer: 'ws://localhost:57221',
    detoxSessionId: '9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c'
  }
})
detox[56456] DEBUG: [exec.js/EXEC_CMD, #5] SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/XXX/Library/Detox/ios/2e7c24710b5b9ca03944d3841c83806444f7bf58/Detox.framework/Detox" /usr/bin/xcrun simctl launch D32E8E61-6DB1-46C9-8242-38DB0B86A95C org.reactjs.native.example.rnDetoxActionSheetBug --args -detoxServer "ws://localhost:57221" -detoxSessionId "9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c"
detox[56456] DEBUG: [exec.js/EXEC_TRY, #5] Launching org.reactjs.native.example.rnDetoxActionSheetBug...
detox[56456] TRACE: [exec.js/EXEC_SUCCESS, #5] org.reactjs.native.example.rnDetoxActionSheetBug: 56494

detox[56456] DEBUG: [exec.js/EXEC_CMD, #6] /usr/bin/xcrun simctl get_app_container D32E8E61-6DB1-46C9-8242-38DB0B86A95C org.reactjs.native.example.rnDetoxActionSheetBug
detox[56456] TRACE: [exec.js/EXEC_SUCCESS, #6] /Users/XXX/Library/Developer/CoreSimulator/Devices/D32E8E61-6DB1-46C9-8242-38DB0B86A95C/data/Containers/Bundle/Application/088DB581-006D-46B3-8021-461981633B49/rnDetoxActionSheetBug.app

detox[56456] INFO:  [AppleSimUtils.js] org.reactjs.native.example.rnDetoxActionSheetBug launched. To watch simulator logs, run:
        /usr/bin/xcrun simctl spawn D32E8E61-6DB1-46C9-8242-38DB0B86A95C log stream --level debug --style compact --predicate 'processImagePath beginsWith "/Users/XXX/Library/Developer/CoreSimulator/Devices/D32E8E61-6DB1-46C9-8242-38DB0B86A95C/data/Containers/Bundle/Application/088DB581-006D-46B3-8021-461981633B49/rnDetoxActionSheetBug.app"'
detox[56494] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onLaunchApp({
  bundleId: 'org.reactjs.native.example.rnDetoxActionSheetBug',
  deviceId: 'D32E8E61-6DB1-46C9-8242-38DB0B86A95C',
  launchArgs: {
    detoxServer: 'ws://localhost:57221',
    detoxSessionId: '9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c'
  },
  pid: 56494
})
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"isReady","params":{},"messageId":-1000}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=isReady (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] DEBUG: [DetoxServer.js/LOGIN] role=testee, sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c
detox[56456] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=testee, sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=ready (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"ready","messageId":-1000,"params":{}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"waitForActive","params":{},"messageId":1}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=waitForActive (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=waitForActiveDone (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"waitForActiveDone","messageId":1,"params":{}}

Example: should view actionsheet buttons
detox[56456] TRACE: [Detox.js/DETOX_BEFORE_EACH] running test: "Example should view actionsheet buttons"
detox[56456] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onTestStart({
  title: 'should view actionsheet buttons',
  fullName: 'Example should view actionsheet buttons',
  status: 'running'
})
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"reactNativeReload","params":{},"messageId":-1000}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=reactNativeReload (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=ready (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"ready","messageId":-1000,"params":{}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"ANetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":2}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":2,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"BNetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":3}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":3,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"CNetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":4}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":4,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"DNetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":5}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":5,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"ENetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":6}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":6,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"FNetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":7}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":7,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"ANetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":8}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":8,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"BNetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":9}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":9,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"CNetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":10}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":10,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"DNetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":11}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":11,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"ENetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":12}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":12,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"FNetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":13}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":13,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"ANetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":14}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":14,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"BNetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":15}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":15,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"CNetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":16}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":16,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"DNetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":17}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":17,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"ENetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":18}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=testee action=invokeResult (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)
detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"invokeResult","messageId":18,"params":{"result":"(GREYElementInteraction)"}}

detox[56456] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"invoke","params":{"target":{"type":"Invocation","value":{"target":{"type":"EarlGrey","value":"instance"},"method":"detox_selectElementWithMatcher:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYMatchers"},"method":"matcherForAccessibilityID:","args":[{"type":"NSString","value":"FNetworkSwitch"}]}}]}},"method":"performAction:","args":[{"type":"Invocation","value":{"target":{"type":"Class","value":"GREYActions"},"method":"actionForTap","args":[]}}]},"messageId":19}
detox[56456] TRACE: [DetoxServer.js/MESSAGE] role=tester action=invoke (sessionId=9d5cd13b-dc9e-fb0f-d830-f68ba3c3755c)

blocked triagbug ios 馃彋 stale

All 15 comments

Hmm
I'm not sure the issue here is with Detox. It could be React Native shenanigans. As you can see, the tap is sent correctly, and for a fraction of a second, the switch reacts to it (it flickers).

Do you mind quickly creating a native project, throwing a few switches in storyboard and trying to tap on them with Detox?

For example, RN is changing the value just after the user touches it:
https://github.com/facebook/react-native/blob/7bd1abec35f0aff0dddf0c1a68f79da29e00acdb/React/Views/RCTSliderManager.m#L45

Could be buggy logic in there.

Hey @LeoNatan!
What do you mean with "throwing a few switches in storyboard"? I do have a react-native project with few switches in it. The video is made with this: https://github.com/compojoom/rnDetoxActionSheetBug/blob/switch-bug/App.js#L29;L57

I meant native project, in Xcode, not RN.

Ah, ok. I'll try. It will take me some time as I've never created a native project :)

Do we have a guide on integrating detox in native projects? I didn't see anything in the docs folder.

Nope, should be exactly the same. Since there is no package.json, just create one and add the detox config. But build and test should be the same.

Ok, created the requested native project. https://github.com/compojoom/SwitchDetoxNative

The issue doesn't seem to happen there. The test has tapped on the Switch Components around 60 times and every time they respond fine.

So we are categorizing this as a RN bug now?

Great, thanks for following through.
It sounds like it is.

Hm, but how would someone fix this?
I've never been able to reproduce this manually. I've been tapping on those switch components like crazy and they always respond.

It's only when we run it through a e2e tests that those fail from time to time.

That鈥檚 a good question. We haven鈥檛 seen this either in any of our e2e tests here in Detox or internal ones.

To me it looks like some incorrect state management could be causing it. The reason I suspected in the first place is that I saw the RN switch flicker somewhat on the touch, meaning the native control gets the event. So, somehow, RN fudges the state and causes the value to reset. RN developers should look at the code and think when this could happen. Perhaps edge cases where state mutates early on (in the video it reproduces on the first one).

Ok, I'll open an issue in the react-native repo

Great. You can post the issue here if you want.

here is the link for future reference: https://github.com/facebook/react-native/issues/28032

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this reporsitory, read this discussion.

The issue has been closed for inactivity.

Was this page helpful?
0 / 5 - 0 ratings