我尝试将 Nightwatch.js 测试集成到 Jenkins 作业中。如果测试失败,我希望 Jenkins 构建失败;如果所有测试都通过,我希望构建通过。但我认识到夜巡总是返回exit code 1
,测试通过或失败并不重要。但我期望exit code 0
如果所有测试都通过,将返回。
有人有解决这个问题的方法吗?我用[email protected] /cdn-cgi/l/email-protection
结合[email protected] /cdn-cgi/l/email-protection
.
这是我的守夜人电话:
./node_modules/.bin/nightwatch --env chrome
如果所有测试都通过了:
./node_modules/.bin/nightwatch --env chrome
echo $?
#Output: 1, but I expect 0
如果我在最后一行使用 Nightwatch 开始测试并且测试将通过,那么 NPM 命令将因错误而失败exit code 1
在这种情况下:
> #!/usr/bin/env sh
> ./node_modules/.bin/nightwatch --env $1 $2
>
Starting selenium server... started - PID: 86384
...
✔ Element <input#login-form-username> was visible after 41 milliseconds.
✔ Element <input#login-form-password> was visible after 36 milliseconds.
✔ Element <input#login> was visible after 34 milliseconds.
.
✔ Element <a#header-details-user-fullname> was visible after 6438 milliseconds.
✔ Element <a#log_out> was present after 22 milliseconds.
..
1 scenario (1 passed)
4 steps (4 passed)
0m16.298s
true
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] /cdn-cgi/l/email-protection test: `scripty "chrome" "--tag=lcm-128"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] /cdn-cgi/l/email-protection test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/GRme/.npm/_logs/2018-03-22T11_08_36_903Z-debug.log
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)