I need to fail test if element is not present using protractor. Here, I have implemented code. When expect condition out of if condition I expected it will fail. Unfortunately, test case is passing. Can anyone suggest if anything that i missed.
crossAttribute.isPresent().then(function (deleteAttribute) {
if(deleteAttribute){
crossAttribute.click();
}else{
console.log('Cross is not present to delete attribute')
}
expect(crossAttribute).toBeTruthy;
});