Angularjs e2e testing past/future comparisons


I’m currently trying to figure out if there is a way to do a simple future/past comparison ex.

1) Check state of list by getting list length
2) Perform action which if success increments the list
3) Compare the current list length to the past.

But the concepts of Futures seems to get in my way. One would think this is a pretty normal use case.

Q: How would you go about handling past/future comparisons in Angularjs Scenario?


It’s kind of longwinded, but you can define custom matchers which understand futures. For example:

angular.scenario.matcher('toBeGreaterThanFuture', function(future) {
  return +this.actual > +future.value;

Use like:

listLengthBefore = repeater('.td').count();
// Do some stuff.
listLengthAfter = repeater('.td').count();

Answered By – Jmr

Answer Checked By – Cary Denson (AngularFixing Admin)

Leave a Reply

Your email address will not be published.