I have a string that I get from an element while testing and I need to check if it matches one of two other strings. For example:
expect.soft(s).toMatch('Test String 1');
But what I need is to check if 's' matches either "Test String 1" or "Test String 2". If it matches either the test should pass and if neither then it should fail. I'm new to playwright so any help will be appreciated!
Tried passing in an array or trying to make a regex that matches only those two strings but with no luck.
This will precisely match (in non regex strings) either the string 1 or 2.
// Use toMatch to match either of two strings
expect(value).toMatch(/^string1$|^string2$/)