testing - 为什么 TestCafe 在使用简单的命令行启动测试 Electron 应用程序时会崩溃?

标签 testing automated-tests electron e2e-testing testcafe

我正在尝试使用 TestCafe 在我们的 Electron 应用程序上运行测试。我收到一条错误,提到“-m”命令,但我的脚本或命令行中未使用该命令。

我已按照此处所述设置了所有内容: https://github.com/DevExpress/testcafe-browser-provider-electron#testing-an-executable-electron-application

C:\packages>testcafe -d "electron:C:\Program Files\OurApp\" "C:\Temp\test.js" -hostname localhost

Using locally installed version of TestCafe. ERROR Tested app failed with an error:

Error: Command failed: -m '-m' is not recognized as an internal or external command, operable program or batch file.

at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:557:12)

Type "testcafe -h" for help.

test.js 的脚本如下:

import { Selector } from 'testcafe';

fixture `Electron test`
.page('./index.html');

test('smoke 1', async t => {
await t
.debug() 
.click(Selector().withText('Create a new configuration'));
});

可能是什么原因?

最佳答案

原因在于不正确的 -hostname 参数。它应该是--主机名。我不确定为什么会出现一些 -m 错误,但在修复不正确的参数语法后测试可以正常工作。

关于testing - 为什么 TestCafe 在使用简单的命令行启动测试 Electron 应用程序时会崩溃?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55717426/

相关文章:

testing - 实验室环境中的编码 UI 测试

node.js - 是否可以使用 Nightmare.js (v2 Electron) 将信息从浏览器传递到 Node 作用域?

c# - 如何对 SoapExtension 派生类进行单元测试?

testing - 用于人工驱动测试的 BDD 风格测试框架

flash - 现有 Flash 组件的自动化测试(非 UI)

testing - Loadrunner 11.5 中的 View_State 关联

node.js - 无法使用 Electron 构建器构建应用程序。错误: gyp failed with exit code: 1

javascript - 如何在Electron主js脚本中调用Webpack捆绑的函数

python - 具有全局范围的 py.test 固定装置

ios - 是否有类似 Android 上的 Monkey 的 iOS UI Exerciser?