Code Snippet:
it('print a custom error message when an expect failed', function() {
var elemenToBeDisplayed=element(by.css("userName"));
/*custom error message will be displayed if expected condition
failed*/
expect(elemenToBeDisplayed.isPresent).toBe(true,'Write your custom
error message here');
});
expect(x).toBe(y, "Some Message"); // stock message works with .toBe
expect(x).toEqual(y, "This is ignored"); // stock message ignored with .toEqual
expect(x).toBeEqualTo(y, "My message is displayed"); // new matcher added below