I want to check if the text content is either one
or two
:
await expect(this.header).toHaveText('one').or('two')
Is there a way to make it work using Playwright?
Also can this be implemented inside a sentence like
await expect(this.header).toHaveText("this is "+('first').or('second')+ "sentence");
Playwright v1.33 introduced a Locator.or that you can use like this:
const headerOne = page.getByRole('heading', { name: 'One' });
const headerTwo = page.getByRole('heading', { name: 'Two' });
await expect(headerOne.or(headerTwo)).toBeVisible();