{"action":"created","issue":{"url":"https://api.github.com/repos/wix/detox/issues/691","repository_url":"https://api.github.com/repos/wix/detox","labels_url":"https://api.github.com/repos/wix/detox/issues/691/labels{/name}","comments_url":"https://api.github.com/repos/wix/detox/issues/691/comments","events_url":"https://api.github.com/repos/wix/detox/issues/691/events","html_url":"https://github.com/wix/detox/issues/691","id":317796319,"number":691,"title":"[iOS] when .tap() in test, device.reloadReactNative() stalls indefinitely","user":{"login":"wildseansy","id":177857,"avatar_url":"https://avatars1.githubusercontent.com/u/177857?v=4","gravatar_id":"","url":"https://api.github.com/users/wildseansy","html_url":"https://github.com/wildseansy","followers_url":"https://api.github.com/users/wildseansy/followers","following_url":"https://api.github.com/users/wildseansy/following{/other_user}","gists_url":"https://api.github.com/users/wildseansy/gists{/gist_id}","starred_url":"https://api.github.com/users/wildseansy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildseansy/subscriptions","organizations_url":"https://api.github.com/users/wildseansy/orgs","repos_url":"https://api.github.com/users/wildseansy/repos","events_url":"https://api.github.com/users/wildseansy/events{/privacy}","received_events_url":"https://api.github.com/users/wildseansy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-04-25T21:14:12Z","updated_at":"2018-04-25T22:28:29Z","closed_at":null,"author_association":"NONE","body":"#### Description\r\nWhen tests don't include a tap, `device.reloadReactNative()` completes successfully. However when a call to `.tap()` is included, reloadReactNative never completes.\r\n\r\nLikely related to #617.  A workaround for this - you can call the following instead of `device.reloadReactNative()` and tests will function correctly, at the cost of a longer delay.\r\n\r\n```javascript\r\n  beforeEach(async () => {\r\n    device.terminateApp()\r\n    device.launchApp()\r\n  });\r\n```\r\n\r\n#### Steps to Reproduce\r\n###### logged_out.spec.js\r\n```javascript\r\nconst {device, expect, element, by} = require('detox');\r\ndescribe('Logged Out', () => {\r\n  beforeEach(async () => {\r\n    console.log('[debugging] Start react native reload');\r\n    await device.reloadReactNative();\r\n    console.log('[debugging] End react native reload');\r\n  });\r\n\r\n  it('First test with tap', async () => {    \r\n    //Commenting out this line allows app to reload react native & complete tests:\r\n    await element(by.id('logged_out/splash')).tap();\r\n    console.log('[debugging] AFTER tap');\r\n    await expect(element(by.id('logged_out/splash'))).toBeVisible();\r\n  });\r\n\r\n  it('Final test (never is hit)', async () => {\r\n    await expect(element(by.id('logged_out/splash'))).toBeVisible();\r\n  });\r\n});\r\n\r\n```\r\n\r\n#### Detox, Node, Device, Xcode and macOS Versions\r\n* Detox: 1.3.4\r\n* React Native: 0.55.3\r\n* Node: v8.11.1\r\n* Device: iPhone 7 Simulator (11.3)\r\n* Xcode: 9.3\r\n* macOS: 10.13.4\r\n\r\n######  Verbose Detox logs\r\n```bash\r\ndetox test --configuration ios.simebug --loglevel verbose\r\nnode_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration ios.sim.debug --loglevel verbose    --grep :android: --invert\r\n\r\n\r\ndetox verb ws onOpen [object Object]\r\ndetox verb ws send: {\"type\":\"login\",\"params\":{\"sessionId\":\"TestAppRun\",\"role\":\"tester\"},\"messageId\":0}\r\ndetox verb ws onMessage: {\"type\":\"loginSuccess\",\"params\":{\"sessionId\":\"TestAppRun\",\"role\":\"tester\"},\"messageId\":0}\r\ndetox verb ws\r\ndetox verb 1: applesimutils --list \"iPhone 7\" --maxResults=1\r\ndetox info 1: Searching for device matching iPhone 7...\r\ndetox verb 1: stdout: [\r\ndetox verb 1: stdout:   {\r\ndetox verb 1: stdout:     \"deviceType\" : {\r\ndetox verb 1: stdout:       \"name\" : \"iPhone 7\",\r\ndetox verb 1: stdout:       \"identifier\" : \"com.apple.CoreSimulator.SimDeviceType.iPhone-7\"\r\ndetox verb 1: stdout:     },\r\ndetox verb 1: stdout:     \"state\" : \"Booted\",\r\ndetox verb 1: stdout:     \"availability\" : \"(available)\",\r\ndetox verb 1: stdout:     \"name\" : \"iPhone 7\",\r\ndetox verb 1: stdout:     \"udid\" : \"687BBC11-27AA-49F6-BE1C-A438F6CD7FA7\",\r\ndetox verb 1: stdout:     \"os\" : {\r\ndetox verb 1: stdout:       \"version\" : \"11.3\",\r\ndetox verb 1: stdout:       \"availability\" : \"(available)\",\r\ndetox verb 1: stdout:       \"name\" : \"iOS 11.3\",\r\ndetox verb 1: stdout:       \"identifier\" : \"com.apple.CoreSimulator.SimRuntime.iOS-11-3\",\r\ndetox verb 1: stdout:       \"buildversion\" : \"15E217\"\r\ndetox verb 1: stdout:     }\r\ndetox verb 1: stdout:   }\r\ndetox verb 1: stdout: ]\r\ndetox verb 1: stdout:\r\ndetox verb 2: applesimutils --list\r\ndetox verb 2: stdout: [\r\ndetox verb 2: stdout:   {\r\ndetox verb 2: stdout:     \"deviceType\" : {\r\ndetox verb 2: stdout:       \"name\" : \"Apple TV\",\r\ndetox verb 2: stdout:       \"identifier\" : \"com.apple.CoreSimulator.SimDeviceType.Apple-TV-1080p\"\r\ndetox verb 2: stdout:     },\r\ndetox verb 2: stdout:     \"state\" : \"Shutdown\",\r\ndetox verb 2: stdout:     \"availability\" : \"(available)\",\r\ndetox verb 2: stdout:     \"name\" : \"Apple TV\",\r\ndetox verb 2: stdout:     \"udid\" : \"DD125448-CB1E-43CA-A95C-0A943277764E\",\r\ndetox verb 2: stdout:     \"os\" : {\r\ndetox verb 2: stdout:       \"version\" : \"11.3\",\r\ndetox verb 2: stdout:       \"availability\" : \"(available)\",\r\ndetox verb 2: stdout:       \"name\" : \"tvOS 11.3\",\r\ndetox verb 2: stdout:       \"identifier\" : \"com.apple.CoreSimulator.SimRuntime.tvOS-11-3\",\r\ndetox verb 2: stdout:       \"buildversion\" : \"15L211\"\r\ndetox verb 2: stdout:     }\r\ndetox verb 2: stdout:   },\r\n# ...redacted...\r\ndetox verb 2: stdout: ]\r\ndetox verb 2: stdout:\r\ndetox verb 3: /usr/bin/xcrun simctl uninstall 687BBC11-27AA-49F6-BE1C-A438F6CD7FA7 com.TestApp.TestAppRun\r\ndetox info 3: Uninstalling com.TestApp.TestAppRun...\r\ndetox info 3: com.TestApp.TestAppRun uninstalled\r\ndetox verb 4: /usr/bin/xcrun simctl install 687BBC11-27AA-49F6-BE1C-A438F6CD7FA7 \"/Users/me/proj/TestApp/TestApp-mobile/ios/build/Build/Products/Debug-iphonesimulator/TestAppDebug.app\"\r\ndetox info 4: Installing /Users/me/proj/TestApp/TestApp-mobile/ios/build/Build/Products/Debug-iphonesimulator/TestAppDebug.app...\r\ndetox info 4: /Users/me/proj/TestApp/TestApp-mobile/ios/build/Build/Products/Debug-iphonesimulator/TestAppDebug.app installed\r\ndetox verb 5: /usr/bin/xcrun simctl terminate 687BBC11-27AA-49F6-BE1C-A438F6CD7FA7 com.TestApp.TestAppRun\r\ndetox info 5: Terminating com.TestApp.TestAppRun...\r\ndetox info 5: com.TestApp.TestAppRun terminated\r\ndetox verb 6: /bin/cat /dev/null >$HOME/Library/Developer/CoreSimulator/Devices/687BBC11-27AA-49F6-BE1C-A438F6CD7FA7/data/tmp/detox.last_launch_app_log.out 2>$HOME/Library/Developer/CoreSimulator/Devices/687BBC11-27AA-49F6-BE1C-A438F6CD7FA7/data/tmp/detox.last_launch_app_log.err && SIMCTL_CHILD_DYLD_INSERT_LIBRARIES=\"/Users/me/Library/Detox/ios/199135aa280ba2724481caa91eb6468e1b2ebbd7/Detox.framework/Detox\" /usr/bin/xcrun simctl launch --stdout=/tmp/detox.last_launch_app_log.out --stderr=/tmp/detox.last_launch_app_log.err 687BBC11-27AA-49F6-BE1C-A438F6CD7FA7 com.TestApp.TestAppRun --args -detoxServer ws://localhost:8099 -detoxSessionId TestAppRun\r\ndetox info 6: Launching com.TestApp.TestAppRun...\r\ndetox verb 6: stdout: com.TestApp.TestAppRun: 78837\r\ndetox verb 6: stdout:\r\ndetox info 6: com.TestApp.TestAppRun launched. The stdout and stderr logs were recreated, you can watch them with:\r\n        tail -F $HOME/Library/Developer/CoreSimulator/Devices/687BBC11-27AA-49F6-BE1C-A438F6CD7FA7/data/tmp/detox.last_launch_app_log.{out,err}\r\ndetox verb ws send: {\"type\":\"isReady\",\"params\":{},\"messageId\":-1000}\r\ndetox verb ws onMessage: {\"type\":\"ready\",\"messageId\":-1000,\"params\":{}}\r\ndetox verb ws\r\n  Logged Out\r\n[debugging] Start react native reload\r\ndetox verb ws send: {\"type\":\"reactNativeReload\",\"params\":{},\"messageId\":-1000}\r\ndetox verb ws onMessage: {\"type\":\"ready\",\"messageId\":-1000,\"params\":{}}\r\ndetox verb ws\r\n[debugging] End react native reload\r\ndetox verb ws 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\":\"logged_out/splash\"}]}}]}},\"method\":\"assertWithMatcher:\",\"args\":[{\"type\":\"Invocation\",\"value\":{\"target\":{\"type\":\"Class\",\"value\":\"GREYMatchers\"},\"method\":\"matcherForSufficientlyVisible\",\"args\":[]}}]},\"messageId\":1}\r\ndetox verb ws onMessage: {\"type\":\"invokeResult\",\"messageId\":1,\"params\":{\"result\":\"(GREYElementInteraction)\"}}\r\ndetox verb ws\r\ndetox verb ws 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\":\"logged_out/splash\"}]}}]}},\"method\":\"performAction:\",\"args\":[{\"type\":\"Invocation\",\"value\":{\"target\":{\"type\":\"Class\",\"value\":\"GREYActions\"},\"method\":\"actionForTap\",\"args\":[]}}]},\"messageId\":2}\r\ndetox verb ws onMessage: {\"type\":\"invokeResult\",\"messageId\":2,\"params\":{\"result\":\"(GREYElementInteraction)\"}}\r\ndetox verb ws\r\n[debugging] AFTER tap\r\n    ✓ Test with tap (1291ms)\r\n[debugging] Start react native reload\r\ndetox verb ws send: {\"type\":\"reactNativeReload\",\"params\":{},\"messageId\":-1000}\r\n\r\n  1 passing (2m)\r\n\r\n    1) \"before each\" hook for \"Final test\"\r\n\r\ndetox verb 7: /usr/bin/xcrun simctl terminate 687BBC11-27AA-49F6-BE1C-A438F6CD7FA7 com.TestApp.TestAppRun\r\ndetox info 7: Terminating com.TestApp.TestAppRun...\r\ndetox info 7: com.TestApp.TestAppRun terminated\r\ndetox verb ws send: {\"type\":\"cleanup\",\"params\":{\"stopRunner\":true},\"messageId\":3}\r\ndetox verb ws onMessage: {\"type\":\"cleanupDone\",\"messageId\":3,\"params\":{}}\r\ndetox verb ws\r\n```\r\n\r\n###### websocket server\r\n```bash\r\n$ detox run-server\r\ndetox-server info 13:56:45: server listening on localhost:8099...\r\ndetox-server wss 13:56:47: role=tester login (sessionId=TestAppRun)\r\ndetox-server wss 13:56:47: role=tester action=loginSuccess (sessionId=TestAppRun)\r\ndetox-server wss 13:56:53: role=tester action=isReady (sessionId=TestAppRun)\r\ndetox-server wss 13:56:53: role=testee not connected, cannot fw action (sessionId=TestAppRun)\r\ndetox-server wss 13:56:54: role=testee login (sessionId=TestAppRun)\r\ndetox-server wss 13:56:54: role=testee action=loginSuccess (sessionId=TestAppRun)\r\ndetox-server wss 13:56:58: role=testee action=ready (sessionId=TestAppRun)\r\ndetox-server wss 13:56:58: role=tester action=reactNativeReload (sessionId=TestAppRun)\r\ndetox-server wss 13:56:59: role=testee action=ready (sessionId=TestAppRun)\r\ndetox-server wss 13:56:59: role=tester action=invoke (sessionId=TestAppRun)\r\ndetox-server wss 13:57:00: role=testee action=invokeResult (sessionId=TestAppRun)\r\ndetox-server wss 13:57:00: role=tester action=invoke (sessionId=TestAppRun)\r\ndetox-server wss 13:57:00: role=testee action=invokeResult (sessionId=TestAppRun)\r\ndetox-server wss 13:57:00: role=tester action=reactNativeReload (sessionId=TestAppRun)\r\ndetox-server wss 13:59:00: role=tester action=cleanup (sessionId=TestAppRun)\r\ndetox-server wss 13:59:00: role=testee action=cleanupDone (sessionId=TestAppRun)\r\ndetox-server wss 13:59:00: role=tester disconnect (sessionId=TestAppRun)\r\ndetox-server wss 13:59:00: role=testee disconnect (sessionId=TestAppRun)\r\n```\r\n\r\n###### detox config\r\n```javascript\r\n  \"detox\": {\r\n    \"test-runner\": \"mocha\",\r\n    \"runner-config\": \"e2e/mocha.opts\",\r\n    \"specs\": \"e2e\",\r\n    \"configurations\": {\r\n      \"ios.sim.release\": {\r\n        \"binaryPath\": \"ios/build/Build/Products/Release-iphonesimulator/TestAppDebug.app\",\r\n        \"build\": \"export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/TestAppRun.xcworkspace -scheme TestAppDebug -configuration Release -sdk iphonesimulator -derivedDataPath ios/build -quiet\",\r\n        \"type\": \"ios.simulator\",\r\n        \"name\": \"iPhone 7\"\r\n      },\r\n      \"ios.sim.debug\": {\r\n        \"binaryPath\": \"ios/build/Build/Products/Debug-iphonesimulator/TestAppDebug.app\",\r\n        \"build\": \"xcodebuild -workspace ios/TestAppRun.xcworkspace -scheme TestAppDebug -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build\",\r\n        \"type\": \"ios.simulator\",\r\n        \"name\": \"iPhone 7\",\r\n        \"session\": {\r\n          \"server\": \"ws://localhost:8099\",\r\n          \"sessionId\": \"TestAppRun\"\r\n        }\r\n      }\r\n    }\r\n  }\r\n```\r\n\r\n###### detox.last_launch_app_log.err\r\nThere was no exception in the logs, so won't include unless requested."},"comment":{"url":"https://api.github.com/repos/wix/detox/issues/comments/384453841","html_url":"https://github.com/wix/detox/issues/691#issuecomment-384453841","issue_url":"https://api.github.com/repos/wix/detox/issues/691","id":384453841,"user":{"login":"rotemmiz","id":1361404,"avatar_url":"https://avatars3.githubusercontent.com/u/1361404?v=4","gravatar_id":"","url":"https://api.github.com/users/rotemmiz","html_url":"https://github.com/rotemmiz","followers_url":"https://api.github.com/users/rotemmiz/followers","following_url":"https://api.github.com/users/rotemmiz/following{/other_user}","gists_url":"https://api.github.com/users/rotemmiz/gists{/gist_id}","starred_url":"https://api.github.com/users/rotemmiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rotemmiz/subscriptions","organizations_url":"https://api.github.com/users/rotemmiz/orgs","repos_url":"https://api.github.com/users/rotemmiz/repos","events_url":"https://api.github.com/users/rotemmiz/events{/privacy}","received_events_url":"https://api.github.com/users/rotemmiz/received_events","type":"User","site_admin":false},"created_at":"2018-04-25T22:28:29Z","updated_at":"2018-04-25T22:28:29Z","author_association":"OWNER","body":"Can you please also add simulator logs?\r\nAnd use --debug-synchronization to see if your application is busy after invoking tap()."}}
{"actor":{"display_login":"rotemmiz"}}