First let me say that I am fairly new to intern and Leadfoot API. What I am trying to do is iterate through an array of elements and perform an assertion on each of them. Here is my code:
'Alerts': function () {
return this.remote
.get(require.toUrl(url))
.setFindTimeout(timeout)
.findById('alertsHeader')
.click()
.end()
.findByClassName('_3WMFy')
.findAllByCssSelector('div')
.getVisibleText()
.then(function(texts){
assert.equal(texts, [ 'ALL', 'P1', 'P2', 'P3' ]);
});
}
However, the test fails with the following output:
AssertionError: expected [ 'ALL', 'P1', 'P2', 'P3' ] to equal [ 'ALL', 'P1', 'P2', 'P3' ]
Can someone explain this error? Maybe I am missing something (as is often the case) but I stared at this for while, and I'm pretty sure those two are equal. So I purposely changed one line to make one of the elements not match and got the following error:
AssertionError: expected [ 'ALL', 'P1', 'P2', 'P3' ] to equal [ 'ALL', 'P1', 'P2', 'P377' ]
[
0: "ALL",
1: "P1",
2: "P2",
E 3: "P377",
A 3: "P3",
length: 4
]
My questions are, I am doing something wrong here, or this a bug? Is this the correct way to iterate these elements, or should I be doing something else? Is it possible to use a for loop here? What would be the best way to do this? Any help provided would be much appreciated!