I need to check the data returned is sorted by date. This is how I'm writing it:
it('should be sorted by date', function() {
element.all(by.repeater('users in group.users')).then(
function(users) {
var lastUser = users[0].element(by.id('birth-date')).getText();
for (var i = 1; i < users.length; ++i) {
var currentUser = users[i].element(by.id('birth-date')).getText();
expect(moment(currentApplication).format('MMM d, YYYY HH:mm')).toBeGreaterThan(moment(lastApplication).format('MMM d, YYYY HH:mm'));
lastUser = currentUser;
}
}
)
})
This returns:
Expected 'Jan 1, 2015 00:00' to be greater than 'Jan 1, 2015 00:00'.
What am I doing wrong? currentUser and lastUser seem to be objects instead of text...but I'm not sure why.
Aucun commentaire:
Enregistrer un commentaire