- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
应用程序在 Android 和 iOS 模拟器中都运行良好。我正在尝试使用 Jest 设置 Detox 以进行端到端测试我的 react-native 应用程序。在模拟器中,我可以看到一些移动,但应用程序未启动,并且出现以下错误(除了“设备未定义”之外,我还收到“app-debug-androidTest.apk:没有这样的文件或目录”错误,所以不确定是什么是这里的根本原因)。
控制台
>detox test --configuration android.emu.debug
node_modules/.bin/jest e2e --config=e2e/config.json --runInBand
server listening on localhost:64281...
(node:75639) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
console.log e2e/firstTest.spec.js:3
**********before each called
console.log e2e/firstTest.spec.js:9
***************first test
FAIL e2e/firstTest.spec.js (123.358s)
Example
✕ should have welcome screen (120009ms)
● Example › should have welcome screen
ChildProcessError: Command failed: /Users/xxx/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r -g /Users/xxx/Projects/xxxxxx/android/app/build/outputs/apk/app-debug-androidTest.apk
adb: failed to stat /Users/xxx/Projects/xxxxxx/android/app/build/outputs/apk/app-debug-androidTest.apk: No such file or directory
`/Users/xxx/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r -g /Users/xxx/Projects/xxxxxx/android/app/build/outputs/apk/app-debug-androidTest.apk` (exited with error code 1)
at callback (../node_modules/child-process-promise/lib/index.js:33:27)
● Example › should have welcome screen
ReferenceError: device is not defined
2 | beforeEach(async () => {
3 | console.log('**********before each called');
> 4 | await device.reloadReactNative();
5 | console.log('**********before each end');
6 | });
7 |
at Object._callee$ (firstTest.spec.js:4:1)
at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:296:22)
at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
at invoke (../node_modules/regenerator-runtime/runtime.js:152:20)
at ../node_modules/regenerator-runtime/runtime.js:195:11
at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:194:16)
at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:217:13)
at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
at Object.<anonymous>.runtime.async (../node_modules/regenerator-runtime/runtime.js:241:14)
at Object._callee (firstTest.spec.js:2:57)
● Example › should have welcome screen
Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.
at ../node_modules/jest-jasmine2/build/queue_runner.js:72:21
at Timeout.callback [as _onTimeout] (../node_modules/jsdom/lib/jsdom/browser/Window.js:592:19)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 123.919s, estimated 241s
Ran all test suites matching /e2e/i.
child_process.js:644
throw err;
^
Error: Command failed: node_modules/.bin/jest e2e --config=e2e/config.json --runInBand
at checkExecSyncError (child_process.js:601:13)
at Object.execSync (child_process.js:641:13)
at runJest (/Users/xxx/Projects/xxxxxx/node_modules/detox/local-cli/detox-test.js:69:6)
at Object.<anonymous> (/Users/xxx/Projects/xxxxxx/node_modules/detox/local-cli/detox-test.js:42:5)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
describe('Example', () => {
beforeEach(async () => {
console.log('**********before each called');
await device.reloadReactNative();
console.log('**********before each end');
});
it('should have welcome screen', async () => {
console.log('***************first test');
await expect(element(by.id('welcome'))).toBeVisible();
console.log('***************first test end');
});
})
"dependencies": {
"react": "16.0.0",
"react-native": "0.51.0",
....
},
"devDependencies": {
"babel-jest": "22.0.3",
"babel-preset-react-native": "4.0.0",
"detox": "^6.0.4",
"jest": "22.0.3",
"react-test-renderer": "16.0.0"
},
"jest": {
"preset": "react-native",
"setupTestFrameworkScriptFile": "./e2e/init.js"
},
"detox": {
"specs": "e2e",
"test-runner": "jest",
"runner-config": "e2e/config.json",
"configurations": {
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/app-debug.apk",
"build": "pushd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && popd",
"type": "android.emulator",
"name": "Pixel_API_27"
},
"android.emu.release": {
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
"build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..",
"type": "android.emulator",
"name": "Pixel_API_27"
}
}
}
const detox = require('detox');
const config = require('../package.json').detox;
// Set the default timeout
jasmine.DEFAULT_TIMEOUT_INTERVAL = 120000;
beforeAll(async () => {
await detox.init(config);
});
afterAll(async () => {
await detox.cleanup();
});
最佳答案
我可以通过关注 this example 来解决这个问题从排毒。遵循android项目配置并在app/build.gradle
中做了一些更改.基本上与示例代码中的相同。
等待 detox 以明确的设置步骤正式开始支持 Android。使用 gradle 3 时仍然存在问题。
关于react-native - "ReferenceError: device is not defined"在 React Native for android 中使用 detox+Jest 时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48148064/
我使用线程将数据发送到我的 USB 设备(不是数据存储)并从设备获取返回数据。 它在前 5 分钟内运行良好。数据输入,数据输出。 (我几乎在第六分钟开始唱歌。) 然后突然失去了联系。 有logcat消
这个问题在这里已经有了答案: 9年前关闭。 Possible Duplicate: adb cannot find my device for Android debugging. Why? 我是安卓
我有一台安装了win10的电脑, 我已在外部硬盘上安装了 ubuntu 16.04, 现在,当我启动计算机并且外部硬盘已连接到电脑时 grub 菜单打开,我可以在 win10 或 ubuntu 之间进
假设我想使用 Microsoft.Azure.Devices 包/SDK 加载设备信息,这与我所说的有什么区别: RegistryManager regManager = RegistryManage
我在 Windows PC 上使用 VS-2017。我可以使用模拟器测试和运行 iOS 应用程序。 现在我开始为 AppStore 构建应用程序。 构建成功。 现在我在项目解决方案菜单中选择“部署..
任何帮助,将不胜感激。我一般对tensorflow和编程都是陌生的。我正在按照github(https://github.com/experiencor/keras-yolo3)中的说明学习YOLO-
我用 adb 将 4 台设备连接到我的笔记本电脑。 最近我开始看到我的一个 android 设备“离线”,而其他设备运行文件。 我的问题是,离线到底是什么意思,是什么原因造成的? 最佳答案 每次adb
我想在我的物理设备上开始用espresso编写的仪器测试。 想法如下:我的公司有一个应用程序的白标解决方案,因此我们有很多应用程序可以放入 Play 商店。为了支持我们的支持团队,我编写了一个测试,为
当出现这种情况时,我的应用程序当前正在接收与之前的应用程序用户帐户关联的推送通知: 玩家安装应用程序并注册为“bob” bob 的设备 token 在网络服务中注册 玩家重新安装了应用程序并注册为“p
我正在使用命令行编译和安装 Android 应用程序,当我尝试将其安装到设备上时,会发生以下情况: $> adb devices List of devices attached 8c092420
我使用标准 CUDA malloc 在 CUDA 中分配了一个内存数组,并将其传递给函数,如下所示: void MyClass::run(uchar4 * input_data) 我还有一个类成员,它
我的真实设备是 Sony Xperia c6502 Android 版本 4.3我确定我已将它连接到我的计算机并打开了开发人员选项/USB 调试 在 SDK 管理器中,已经安装了 Google USB
某些设备的设备密度返回 0。以下代码用于计算设备密度: WindowManager wm = (WindowManager) context .getSystemService(Con
我正在将一个小文件 (8.5 Mb) 上传到 flask 测试服务器。 当文件上传完成后,服务器报告: File "/home/ubuntu/.virtualenvs/eco_app/lib/
我正在编写一个小应用程序,我需要将一个变量传递给一个函数。问题是该变量是一个绑定(bind),但该函数必须接受一个常规变量。 代码: ForEach($deviceArrays.devices, id
我正在编写一个小应用程序,我需要将一个变量传递给一个函数。问题是该变量是一个绑定(bind),但该函数必须接受一个常规变量。 代码: ForEach($deviceArrays.devices, id
我创建了一个新的 quasar 项目,添加了 cordova 并进行了一些尝试。 一切正常,我可以在手机上部署该应用程序并在模拟器中运行它。 现在,我需要获取一些设备信息,我想为此使用 cordova
根据 W3C The ‘device-width’ media feature describes the width of the rendering surface of the output d
我的数据迭代器当前在 CPU 上运行,因为 device=0 参数已弃用。但我需要它与模型的其余部分一起在 GPU 上运行。 这是我的代码: pad_idx = TGT.vocab.stoi[""]
Cordova 版本:3.5.0 我正在尝试使用 pushPlugin 实现推送通知.但是当我在android平台上运行这个应用程序时(我没有尝试过其他平台),有一个错误“device is not
我是一名优秀的程序员,十分优秀!