我使用 Protractor 1.3.1/Mocha 1.21.4 和 Chai 1.9.1 进行了大量 E2E 测试。
自从我迁移到 Protractor 1.8.0、Mocha 2.2.1 后,测试失败时我没有得到任何错误描述。这使得很难找到问题所在。
示例:
We are connected to mongo !
Show/hide login bar :
√ Should see the login bar
√ Should see the loggin button
√ Should not see the loggout button
Account creation popup :
√ Should see the create account form (944ms)
√ Should not be able to submit the form
√ Should be possible to submit the form after checking the CG (1102ms)
√ Should not be possible to submit the form without typing email, pseudo and accountType (530ms)
√ Should be possible to submit the form with email, pseudo and accountType (2325ms)
√ Should be possible to create an account by submitting the form (1423ms)
√ Should not be possible to create an account already existing and activated
Show direct account creation popup :
√ Should display accountCreationPopup when calling /create-account.html (1980ms)
Exception thrown: Keeping the Selenium server alive
d:\Projets\Clouderial\nodeProjects\cld-apps\node_modules\grunt-protractor-runner\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:113
var template = new Error(this.message);
^
>>
>> Test failed but keep the grunt process alive.
我尝试过使用不同的 Mocha 记者,但没有成功。
任何线索将不胜感激。
让-马克
编辑: 我注意到只有当 Protractor 与 grunt 和 grunt-protractor-runner 一起运行时才会出现问题 在 Grunt 工作之外使用 grunt-protractor-runner 运行 Protractor 。该命令的运行方式如下:
node_modules/grunt-protractor-runner/node_modules/protractor/bin/protractor test/protractor/e2e.conf.js
由 grunt 运行的具有相同配置的相同命令会掩盖错误。
编辑2: Mocha 报告器中的颜色在 Grunt 内部运行时不会显示,并且通常在 Grunt 外部显示。也许它会给发生的事情提供一些线索。
最佳答案
我在 jasmine-spec-reporter 中遇到了类似的问题,在 @bcaudan 的帮助下,我认为问题已经找到了。我要做的就是将 colors
的 enabled
属性设置为 true
:
var colors = require('colors');
colors.enabled = true;
这是initial thread讨论该问题的地方。
这是thread显示该问题的当前修复。
关于gruntjs - 自 1.8.0 迁移以来,带有 Mocha/Chai 的 Protractor 不再显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29320180/