排毒测试时,React Native 在初始屏幕上超时完成

Posted

技术标签:

【中文标题】排毒测试时,React Native 在初始屏幕上超时完成【英文标题】:React Native finishes in timeout on splash screen while detox test 【发布时间】:2018-04-30 03:14:27 【问题描述】:

说明

我遇到了超时问题,我不知道为什么。它请求权限,然后设置权限(可能)。在这一刻应用程序看起来已加载,但之后会显示带有微调器的黑屏片刻然后启动屏幕。此刻应用卡住了。

我发现一些关于超时的问题,但我尝试了很多在那里写的但没有任何效果。我的同事尝试使用相同的包版本在同一个项目上运行 Detox,并且没有问题。他拥有相同版本的 React Native、XCode、Node、Mocha 和 Detox。

我尝试了什么:

Node 的几个版本:8.1.3、8.9.1 和 9.1.0 重新安装节点 再次删除并安装 node_modules (yarn/npm) 更改排毒版本:5.9.4 和 5.8.1 更改 Mocha 版本:4.0.1 和 3.5.2 在ios模拟器中删除并安装App 升级 XCode (9.0.1 –> 9.1) 重新创建排毒版本, 删除 npm 缓存 删除排毒缓存

测试:

describe('Permissions', () => 
  beforeEach(async () => 
    await device.launchApp(permissions: 
      notifications: 'YES',
      location: 'always',
    );
    await device.reloadReactNative()
  );

  it('should have welcome screen', async () => 
    await element(by.id('searchCarsButton')).tap()
  )
)

Detox、Node、Device、Xcode 和 macOS 版本

排毒:5.9.4、5.8.1 节点:8.1.3 设备:ios 模拟器 Xcode:9.1 macOS:塞拉利昂 反应原生:0.44.0

设备和详细排毒日志

$ detox test --loglevel verbose
node_modules/.bin/mocha e2e --opts e2e/mocha.opts  --loglevel verbose    

detox-server info 14:33:10: server listening on localhost:50396...
detox verb ws onOpen [object Object]
detox verb ws send: "type":"login","params":"sessionId":"c14ee5fe-de13-5f60-b61f-ff487043587b","role":"tester","messageId":0
detox verb ws onMessage: "type":"loginSuccess","params":"sessionId":"c14ee5fe-de13-5f60-b61f-ff487043587b","role":"tester","messageId":0
detox verb ws  
detox verb 1: applesimutils --list "iPhone 7" --maxResults=1 
detox info 1: Searching for device matching iPhone 7... 
detox verb 1: stdout: [
detox verb 1: stdout:   
detox verb 1: stdout:     "state" : "Booted",
detox verb 1: stdout:     "availability" : "(available)",
detox verb 1: stdout:     "name" : "iPhone 7",
detox verb 1: stdout:     "udid" : "2EE82BFA-2351-4627-937C-B93904827F29",
detox verb 1: stdout:     "os" : 
detox verb 1: stdout:       "version" : "11.1",
detox verb 1: stdout:       "availability" : "(available)",
detox verb 1: stdout:       "name" : "iOS 11.1",
detox verb 1: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 1: stdout:       "buildversion" : "15B87"
detox verb 1: stdout:     
detox verb 1: stdout:   
detox verb 1: stdout: ]
detox verb 1: stdout: 
detox verb 2: applesimutils --list 
detox verb 2: stdout: [
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "Apple TV",
detox verb 2: stdout:     "udid" : "2F518141-A525-47B9-9A33-E5AEE34A92FA",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "tvOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.tvOS-11-1",
detox verb 2: stdout:       "buildversion" : "15J580"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "Apple TV 4K",
detox verb 2: stdout:     "udid" : "EA308CF4-5A1F-41EC-AB1C-9E081C6860B4",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "tvOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.tvOS-11-1",
detox verb 2: stdout:       "buildversion" : "15J580"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "Apple TV 4K (at 1080p)",
detox verb 2: stdout:     "udid" : "4A9D24CE-469A-4BA9-86C5-6A6418B906B1",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "tvOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.tvOS-11-1",
detox verb 2: stdout:       "buildversion" : "15J580"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPad (5th generation)",
detox verb 2: stdout:     "udid" : "BDD2070B-24B7-4748-9FCD-1A7A542B1741",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPad Air",
detox verb 2: stdout:     "udid" : "EE452C63-A1CB-47A4-9DDE-3C85586C4AB0",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPad Air 2",
detox verb 2: stdout:     "udid" : "8D7EE2CD-A09B-41A9-B7B5-0FEC4634AE1C",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPad Pro (10.5-inch)",
detox verb 2: stdout:     "udid" : "3487A5FF-3C7C-495A-BC8C-2B805908F3AB",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPad Pro (12.9-inch)",
detox verb 2: stdout:     "udid" : "EF72BAC9-BD3B-422A-917B-259E1D4F049D",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPad Pro (12.9-inch) (2nd generation)",
detox verb 2: stdout:     "udid" : "76F7BFE5-981E-4799-A42D-2B2C75CF6B89",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPad Pro (9.7-inch)",
detox verb 2: stdout:     "udid" : "81042BB1-C6D3-4C50-98B6-5DDD226C0A24",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPhone 5s",
detox verb 2: stdout:     "udid" : "DC5CBF57-1804-4FB1-84B1-B47D32371F8D",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPhone 6",
detox verb 2: stdout:     "udid" : "0073B75C-D6DF-4F35-981E-965420C1F660",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPhone 6 Plus",
detox verb 2: stdout:     "udid" : "A8FC2524-4819-49F2-8694-FB03C27C68EE",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPhone 6s",
detox verb 2: stdout:     "udid" : "4B963220-4BD9-4389-AB2D-D5B739578F86",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPhone 6s Plus",
detox verb 2: stdout:     "udid" : "4973CA12-2A69-42ED-A2C2-42AAB9FB2DB7",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Booted",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPhone 7",
detox verb 2: stdout:     "udid" : "2EE82BFA-2351-4627-937C-B93904827F29",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPhone 7 Plus",
detox verb 2: stdout:     "udid" : "9D7D03DD-10CE-4529-A356-62479A5A6C6A",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPhone 8",
detox verb 2: stdout:     "udid" : "4C3124D0-5353-4471-BB7B-9D9FB30298A7",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPhone 8 Plus",
detox verb 2: stdout:     "udid" : "D5350B7C-B7F9-4F36-B2F4-6D97D63C4869",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPhone SE",
detox verb 2: stdout:     "udid" : "6EA12F63-932D-456B-B74F-68732DC65EFE",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "iPhone X",
detox verb 2: stdout:     "udid" : "30AB0A5F-1E84-4747-AC74-882A0823177F",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "11.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "iOS 11.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.iOS-11-1",
detox verb 2: stdout:       "buildversion" : "15B87"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "Apple Watch - 38mm",
detox verb 2: stdout:     "udid" : "E0A4995F-4B50-4E6A-B13C-FC8863F4A677",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "4.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "watchOS 4.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.watchOS-4-1",
detox verb 2: stdout:       "buildversion" : "15R844"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "Apple Watch - 42mm",
detox verb 2: stdout:     "udid" : "4CD40B3E-A994-4852-9058-22EAC2B26882",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "4.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "watchOS 4.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.watchOS-4-1",
detox verb 2: stdout:       "buildversion" : "15R844"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "Apple Watch Series 2 - 38mm",
detox verb 2: stdout:     "udid" : "F9A49912-44A6-40EF-AC72-224E05461CF2",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "4.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "watchOS 4.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.watchOS-4-1",
detox verb 2: stdout:       "buildversion" : "15R844"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "Apple Watch Series 2 - 42mm",
detox verb 2: stdout:     "udid" : "F23C9051-AF9B-401E-8DEC-B19BA31C7C0E",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "4.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "watchOS 4.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.watchOS-4-1",
detox verb 2: stdout:       "buildversion" : "15R844"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "Apple Watch Series 3 - 38mm",
detox verb 2: stdout:     "udid" : "16D30FC1-9D10-462B-B28C-1DC54D6D78D0",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "4.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "watchOS 4.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.watchOS-4-1",
detox verb 2: stdout:       "buildversion" : "15R844"
detox verb 2: stdout:     
detox verb 2: stdout:   ,
detox verb 2: stdout:   
detox verb 2: stdout:     "state" : "Shutdown",
detox verb 2: stdout:     "availability" : "(available)",
detox verb 2: stdout:     "name" : "Apple Watch Series 3 - 42mm",
detox verb 2: stdout:     "udid" : "FE83E863-043D-4BB8-8C6F-3E0D5C39DD18",
detox verb 2: stdout:     "os" : 
detox verb 2: stdout:       "version" : "4.1",
detox verb 2: stdout:       "availability" : "(available)",
detox verb 2: stdout:       "name" : "watchOS 4.1",
detox verb 2: stdout:       "identifier" : "com.apple.CoreSimulator.SimRuntime.watchOS-4-1",
detox verb 2: stdout:       "buildversion" : "15R844"
detox verb 2: stdout:     
detox verb 2: stdout:   
detox verb 2: stdout: ]
detox verb 2: stdout: 
detox verb 3: /usr/bin/xcrun simctl uninstall 2EE82BFA-2351-4627-937C-B93904827F29 com.creativedock.hoppycar 
detox info 3: Uninstalling com.creativedock.hoppycar... 
detox info 3: com.creativedock.hoppycar uninstalled 
detox verb 4: /usr/bin/xcrun simctl install 2EE82BFA-2351-4627-937C-B93904827F29 /Applications/MAMP/htdocs/droover/ios/build/Build/Products/Debug-iphonesimulator/hoppycar.app 
detox info 4: Installing /Applications/MAMP/htdocs/droover/ios/build/Build/Products/Debug-iphonesimulator/hoppycar.app... 
detox info 4: /Applications/MAMP/htdocs/droover/ios/build/Build/Products/Debug-iphonesimulator/hoppycar.app installed 
detox verb 5: /usr/bin/xcrun simctl terminate 2EE82BFA-2351-4627-937C-B93904827F29 com.creativedock.hoppycar 
detox info 5: Terminating com.creativedock.hoppycar... 
detox info 5: com.creativedock.hoppycar terminated 
detox verb 6: /bin/cat /dev/null >$HOME/Library/Developer/CoreSimulator/Devices/2EE82BFA-2351-4627-937C-B93904827F29/data/tmp/detox.last_launch_app_log.out 2>$HOME/Library/Developer/CoreSimulator/Devices/2EE82BFA-2351-4627-937C-B93904827F29/data/tmp/detox.last_launch_app_log.err && SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/janvaclavik/Library/Detox/ios/dcbded2050005ff99b0bffc826182a2fb35fa7a4/Detox.framework/Detox" /usr/bin/xcrun simctl launch --stdout=/tmp/detox.last_launch_app_log.out --stderr=/tmp/detox.last_launch_app_log.err 2EE82BFA-2351-4627-937C-B93904827F29 com.creativedock.hoppycar --args -detoxServer ws://localhost:50396 -detoxSessionId c14ee5fe-de13-5f60-b61f-ff487043587b 
detox info 6: Launching com.creativedock.hoppycar... 
detox verb 6: stdout: com.creativedock.hoppycar: 28279
detox verb 6: stdout: 
detox info 6: com.creativedock.hoppycar launched. The stdout and stderr logs were recreated, you can watch them with:
        tail -F $HOME/Library/Developer/CoreSimulator/Devices/2EE82BFA-2351-4627-937C-B93904827F29/data/tmp/detox.last_launch_app_log.out,err 
detox verb ws send: "type":"isReady","params":,"messageId":-1000
detox verb ws onMessage: "type":"ready","messageId":-1000,"params":
detox verb ws  
  Permissions
detox verb 7: applesimutils --simulator 2EE82BFA-2351-4627-937C-B93904827F29 --bundle com.creativedock.hoppycar --setPermissions notifications=YES,location=always 
detox info 7: Trying to set permissions... 
detox info 7: Permissions are set 
detox verb 8: /bin/cat /dev/null >$HOME/Library/Developer/CoreSimulator/Devices/2EE82BFA-2351-4627-937C-B93904827F29/data/tmp/detox.last_launch_app_log.out 2>$HOME/Library/Developer/CoreSimulator/Devices/2EE82BFA-2351-4627-937C-B93904827F29/data/tmp/detox.last_launch_app_log.err && SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/janvaclavik/Library/Detox/ios/dcbded2050005ff99b0bffc826182a2fb35fa7a4/Detox.framework/Detox" /usr/bin/xcrun simctl launch --stdout=/tmp/detox.last_launch_app_log.out --stderr=/tmp/detox.last_launch_app_log.err 2EE82BFA-2351-4627-937C-B93904827F29 com.creativedock.hoppycar --args -detoxServer ws://localhost:50396 -detoxSessionId c14ee5fe-de13-5f60-b61f-ff487043587b 
detox info 8: Launching com.creativedock.hoppycar... 
detox verb 8: stdout: com.creativedock.hoppycar: 28306
detox verb 8: stdout: 
detox info 8: com.creativedock.hoppycar launched. The stdout and stderr logs were recreated, you can watch them with:
        tail -F $HOME/Library/Developer/CoreSimulator/Devices/2EE82BFA-2351-4627-937C-B93904827F29/data/tmp/detox.last_launch_app_log.out,err 
detox verb ws send: "type":"isReady","params":,"messageId":-1000
detox verb ws onMessage: "type":"ready","messageId":-1000,"params":
detox verb ws  
detox verb ws send: "type":"reactNativeReload","params":,"messageId":-1000
detox verb ws onMessage: "type":"ready","messageId":-1000,"params":
detox verb ws  
detox 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":"searchCarsButton"]],"method":"performAction:","args":["type":"Invocation","value":"target":"type":"Class","value":"GREYActions","method":"actionForTap","args":[]],"messageId":1
    1) should have welcome screen

detox verb ws send: "type":"cleanup","params":"stopRunner":true,"messageId":2
detox verb ws onMessage: "type":"cleanupDone","messageId":2,"params":
detox verb ws  

  0 passing (3m)
  1 failing

  1) Permissions should have welcome screen:
     Error: Timeout of 135000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.


child_process.js:631
    throw err;
    ^

Error: Command failed: node_modules/.bin/mocha e2e --opts e2e/mocha.opts  --loglevel verbose    
    at checkExecSyncError (child_process.js:588:13)
    at Object.execSync (child_process.js:628:13)
    at runMocha (/usr/local/lib/node_modules/detox/local-cli/detox-test.js:56:6)
    at Object.<anonymous> (/usr/local/lib/node_modules/detox/local-cli/detox-test.js:36:5)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)

detox.last_launch_app_log.out,err:

...
2017-11-13 12:20:55.393 dr[26453:980543] ☣️ DETOX:: Ignoring timer: 35 failure reason: "duration>1.5"
2017-11-13 12:20:57.402 dr[26453:980543] ☣️ DETOX:: Ignoring timer: 36 failure reason: "duration>1.5"
2017-11-13 12:20:59.410 dr[26453:980543] ☣️ DETOX:: Ignoring timer: 37 failure reason: "duration>1.5"
...

【问题讨论】:

我们遇到了同样的问题,但仍然没有解决方案。相同的 RN 版本。可惜RN升级没那么容易,所以我们可能不使用detox,真的很伤心。 【参考方案1】:

错误实际上是给你带来了问题。 "对于异步测试和钩子,确保调用了"done()";"

我相信您的问题是您正在使用异步将函数转换为 Promise,并且测试框架不知道何时完成。

删除你的 async/await 并使用普通的 .then() ,完成后调用 done() 函数。那应该结束测试。

更多信息在这里:https://mochajs.org/#asynchronous-code

【讨论】:

以上是关于排毒测试时,React Native 在初始屏幕上超时完成的主要内容,如果未能解决你的问题,请参考以下文章

排毒测试 + React Native + PouchDB 应用程序:由于一些 PouchDB 同步,我们的登录测试一直失败并超时?

使用 React Native 进行排毒 UI 测试非常慢

排毒:使用停止按钮测试 React-Native 微调器

如何用排毒模拟@react-native-community/geolocation?

排毒(Android):device.reloadReactNative 失败

排毒自动化框架指南:React Native?创建 End 2 端和集成测试框架