sonia sharma sonia sharma - 1 year ago 151
Javascript Question

match multiple values with one expected values, always try to match only first value and fails

I am using bellow mentioned code to compare multiple values with one expected values and if the text matches with anyone of them my test should pass :

console.log("values = " +values);

But with this code it always try to match first (values[0]), if this does not match then my test will fail.

How can I change it so that protractor looks for all 3 values and then if anyone of them matches my test should pass.

Answer Source

if anyone of them matches my test should pass

In this case, you don't need anything special, just concatenate the values:

expect(values[0] + values[1] + values[2]).toMatch('searchtxt');

Please also see the follow-up to your problem here:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download