无法使用 webdriverio 在 Android 设备上 运行 完整测试套件(单独测试没问题)

Unable to run full test suite on Android devices using webdriverio (individual tests are fine)

我正在尝试 运行 我的 WebdriverIO 测试针对本地连接的 Android phone。 运行 使用 --spec /folder_with_tests/test.js 命令单独测试每次都工作正常。但是,如果我不使用 --spec 并尝试 运行 整个套件,我将无法正确连接到我的 phone。

也许 15 次测试中有 1 次会随机通过。其余的会产生如下错误:

ERROR: ESOCKETTIMEDOUT

ERROR: A session is either terminated or not started

ERROR: An unknown server-side error occurred while processing the command. Original error: Cannot read property 'shutdown' of null

此外,奇怪的事情发生了,比如相机打开和关闭。我尝试了不同的 phone,但每次都发生同样的事情。

还有其他人遇到过这个问题吗?或者知道解决方案?

查看关于organising suite in wdio的官方文章:

组测需要:

// wdio.conf.js
exports.config = {
    // define all tests
    specs: ['./test/specs/**/*.spec.js'],
    // ...
    // define specific suites
    suites: {
        login: [
            './test/specs/login.success.spec.js',
            './test/specs/login.failure.spec.js'
        ],
        otherFeature: [
        // ...
        ]
    },
    // ...
}

然后你可以 运行 套房:

$ wdio wdio.conf.js --suite login

事实证明,我团队中的一位开发人员(后来离开了)在项目的根目录中推送了一些奇怪的文件:

failed fibers@2.0.0 mocha_webdriverio_poc@0.0.1 node wdio

所有内容都是空白的,除了 Android 测试之外没有任何影响,即使那样,也只有当 运行 全部在一起时。不确定这些是否已自动生成,但他可能只是使用了 git add -A,然后提交并推送了所有内容。

我删除了所有文件,一切正常。