BrowserStackLocal因消息Disconnected而异常

问题描述 投票:0回答:2

我尝试使用codeception和browserstack进行测试。

  1. 克隆这个回购https://github.com/browserstack/codeception-browserstack
  2. 在本地测试下载插件browserstacklocal.exe
  3. 使用我的密钥运行browserstacklocal.exe
  4. 运行本地测试

有这个错误http://petrvolny.eu/error.png

php codeception acceptance-testing browserstack
2个回答
0
投票

我没有使用BrowserStack,但我做了一个快速搜索 - BrowserStack\LocalException与消息D看起来错了。

D可能是真正异常消息的第一个字母。

此问题可能是由以下代码引起的:https://github.com/browserstack/browserstack-local-php/blob/491c6e31960ce8111d2cb70cb84d03e73f270dbb/lib/Local.php#L125

throw new LocalException($data['message']['message']);

它曾经是$data['message']但它在一年前改变了:https://github.com/browserstack/browserstack-local-php/pull/11/files

我的建议是编辑vendor/browserstack/browserstack-local/lib/Local.php并将该行更改为throw new LocalException($data['message']);以查看其根本原因。


0
投票

事实证明,日志记录是问题,在库源中删除--log-file后它运行正常。还要确保您提供钥匙。

我知道你使用的是PHP,但是对于任何使用Javascript和节点的人来说,这里有一个小补丁:

let fs = require('fs');
const file = 'node_modules/browserstack-local/lib/Local.js';

fs.readFile(file, 'utf8', function(err, contents) {
  var result = contents.replace("['--daemon', this.opcode, '--log-file', this.logfile]", "['--daemon', this.opcode]");
  fs.writeFile(file, result);
});

希望这在某种程度上有所帮助!我知道编辑库源不好,但我发现它已经解决了。

© www.soinside.com 2019 - 2024. All rights reserved.