In my program I'm calculating two numbers, and I want to make sure that subtraction of them equals 1.
this is the code:
var firstCount=element.all(by.repeater('app in userApps')).count();
var secondCount=element.all(by.repeater('app in userApps')).count();
so far it's good- I'm getting the numbers. the problem comes next:
var sub=secondCount-firstCount;
expect(sub).toEqual(1);
I'm getting this error:
Expected NaN to equal 1.
any idea?
You are doing absolutely right. But Before comparison, Check whether your result value is number type or not.
Example-
Then perform an operation for expected conditions.
It's possible to resolve only the first promise. Protractor adapts
expect
to "understand" promises. Refer https://github.com/angular/protractor/blob/master/docs/control-flow.md#protractor-adaptations and https://github.com/angular/protractor/issues/128.});
Both
firstCount
andsecondCount
are promises that are needed to be resolved: