0

尝试使用 taiko 运行 Gauge 以自动化一些 Web 测试。sudo gauge run specs抛出两个类型错误和“无法要求 Taiko”

Taiko、nodejs、npm 已安装并且工作正常。仪表似乎大部分都很好。gauge init js工作。我尝试将 .spec 文件移动到不同的目录中,并移动 taiko 和 nodejs,没有区别。

要复制,安装所有必要的东西:

gauge init js

gauge run specs

应该运行由“init”创建的 .spec 文件

实际上输出太长而无法包含,但会根据要求显示。错误:

1)

Unable to require module 'taiko' in /home/harry/tests/step_implementation.js
Trace: Error: Cannot find module 'taiko'
Require stack:
- /home/harry/tests/step_implementation.js

2)

const { openBrowser,write, closeBrowser, goto, press, text, focus, inputField, toRightOf } = require('taiko');

^
TypeError: Cannot destructure property `openBrowser` of 'undefined' or 'null'.

3)

new Test(step.fn, parameters, timeout).run().then(

^
TypeError: Cannot read property 'fn' of undefined

4)

[Gauge]
Connection to runner with Pid 15653 lost. The runner probably quit unexpectedly.
4

3 回答 3

0

你应该检查你的 node_modules 一次。当您的 node_modules 中没有 taiko 时,就会发生这种错误。当你这样做时gauge init js,它会被添加到你的本地 node_modules 中。可能有些事情搞砸了,所以我猜 Taiko 不在你的 node_modules 中尝试运行 npm install --save taiko。这可能会解决您的问题。谢谢。

于 2019-08-19T05:31:22.457 回答
0

Trace: Error: Cannot find module 'taiko' 完全告诉你 taiko 没有安装,运行npm i taiko再试一次。

于 2019-08-22T06:42:38.393 回答
0

什么是文件,上下文,操作系统> .. 原因是因为名字被破坏了......

未定义是某些符号恕我直言的字符集不匹配的结果...

于 2019-08-21T03:18:50.627 回答