Well, I have a table with many rows and columns, I would like to check if the table is sorted for a particular column.
I have tried using different expects and asserts but its always returning true
. Am I doing anything wrong here?
cy.get('table tbody tr').should(function($trs) {
var arrayOftd = $trs.map(function (i, tr) {
return Cypress.$(tr).find('td').eq(3).text()
})
var test = arrayOftd.sort()
expect(arrayOftd).to.deep.equal.(test)
})
It has to return true
when sorted ascending and false
when descending or any other order.
This is the console log of the assert statement
Command: assert cypress_runner.js:172385 Actual: (13) ["946", "947", "948", "951", "952", "955", "956", "959", "960", "963", "964", "967", "968"] cypress_runner.js:172385 Expected: (13) ["946", "947", "948", "951", "952", "955", "956", "959", "960", "963", "964", "967", "968"] cypress_runner.js:172385 Message: expected [ Array(13) ] to equal [ Array(13) ] cypress_runner.js:172385 Error: AssertionError: expected [ Array(13) ] to equal [ Array(13) ]