I am trying to traverse through a list of elements and want to assert that the body includes either of the 2 values.
I am trying to use the following but it only lets me assert one value.
expect(cellText).includes(toDateFormat);
How can I make an assertion that allows me to assert multiple values having OR condition?
2
Answers
You could use Chai’s satisfy to accomplish this.
If you have a long list of potential expected values, you could simplify this by having those values in an array, and using
array.filter()
to find instances of the actual text value in the expected text value, and returning the length of the filtered array.A simple way is to use oneOf assertion
or for partial formats