protractor- difference between toBe(truth) and toBeTruthy()

angularjs-e2e, assertions, protractor

Solution

Many things are `Truthy` (i.e. anything that is not one of: false, 0, "", undefined, null, NaN). So

expect('apple').toBeTruthy();

passes. But:

expect('apple').toBe(true);

fails.

That being said, if you know you are testing a boolean, to me using `toBeTruthy` looks nicer.

Problem

as the title says- is there a difference between (for example) ``` expect(element).isDisplayed().toBeTruthy(); ``` and ``` expect(element).isDisplayed().toBe(truth); ``` and if so what is the difference? thanks

Original source