我正在尝试使用 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/