Search code examples
arraysselenium-webdriverassert

WebdriverJS Expect Arrays to be equal ignoring order


As we have method in jasmine to match array without the order (arrayContaining), similar thing i'm looking in webdriver.

var array1 = [a,b];
var array2 = [b,a];

expect(array1).to.containArray(array2);  // something like this ignoring order

Solution

  • Could be useful for someone, here is the solution for it.

       expect(array1).to.have.members(array2);