Protractor if else with expect(condition)

Protractor if else with expect(condition)

In my script, I need to include if-else condition to verify whether the expected=actual.If they are not matching it should go to the else block and print "StepFailed".But, always its executing the if block and the o/p is "step passed" although expected≠Actual.Below is my code:

In my script, I need to include if-else condition to verify whether the expected=actual.If they are not matching it should go to the else block and print "StepFailed".But, always its executing the if block and the o/p is "step passed" although expected≠Actual.Below is my code:

   var expected = ['Select training program using Index', 'Selenium', 
                   'A','UFT/QTP','Loadrunner'];
   var els = element.all(by.xpath("//select[@id='dropdown1']/option"));

for (var i = 0; i < expected.length; ++i) { if(expect(els.get(i).getText()).to.eventually.equals(expected[i])){ console.log('' +'Steppassed'+ ''); } else { console.log('' +'Stepfailed'+ ''); } }

Drop down values are:'Select training program using Index', 'Selenium', 'Appium','UFT/QTP','Loadrunner'.If you would have observed I have given 'A' instead of "Appium' and hence the step should fail but that's not happening.

kindly suggest me how this can be resolved.Thank you.

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Publishing TypeScript Modules to NPM

Publishing TypeScript Modules to NPM - TypeScript is becoming increasingly popular as more developers find it useful. Not only can you get strong typing support, but you can also use newer spec syntax.

Learn TypeScript | TypeScript Crash Course | TypeScript Tutorial for Beginners

Learn TypeScript | TypeScript Crash Course | TypeScript Tutorial for Beginners: My goal with this courses is just give your the fundamentals of the language, show you what TypeScript is and how to use it. We as developers don't have time neither can we afford to spend too much time on any tehcnology.