得到“不是一个可以的";使用“最终"时的消息在量角器柴 [英] Getting "is not a thenable" message while using "eventually" in protractor chai
问题描述
When I tried to verify the condition as below.
var val1 = "ONE";
var val2 = "TWO";
expect(val1==val2).to.eventually.equal(false)
I'm getting false is not a thenable message, If I removed eventually condition as below then it working fine.
var val1 = "ONE";
var val2 = "TWO";
expect(val1==val2).to.equal(false)
Can anyone help me to understand the difference. Also If the condition fails, It displays the error message and not executing the hooks.js.
In simple words:
eventually
- is a method from chai-as-promised.
If you use eventually
protractor expects that you are asserting result of a promise to value (in this case false
).
val1
and val2
are bools. Comparison of val1
and val2
is also a bool.
Bool is not a promise.
You've got two possibilities: 1. Don't use eventually (just a chai). 2. Return a promise from comparison of those values.
这篇关于得到“不是一个可以的";使用“最终"时的消息在量角器柴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!