While running a test in debug mode, I've observed that toBeVisible()
fails when it detects multiple elements. Interestingly, toBeVisible
without the parenthesis passes the assertion in such cases.
I'm facing a specific scenario where I need to pass a timeout argument with toBeVisible()
, as the element being waited for is a rendering of pages from an uploaded document, which can vary in display time from 2 seconds to 2 minutes.
The issue arises when the locator is attached to multiple pages, causing the following line to fail:
await expect(locator).toBeVisible({ timeout: 10000 })
To overcome this, I temporarily adjusted the global expect timeout value in the config file so that the following code works:
await expect(locator).toBeVisible;
However, I am looking for a way to avoid setting a high timeout globally and instead follow the documentation's guidelines specifically designed for handling scenarios involving multiple elements. Is there a solution available for this?