I have a flaky playwright test that only fails on ci. Hence I enabled trace outputs and inspected the failing click action. Surprisingly nothing seems to be extra-ordinary or wrong and the click action seems to have done its job, also the call log of the click action is exactly the same as on a succeeding test:
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
- waiting for getByTestId('outlinerNode.17126087311408424225')
- locator resolved to <div data-testid="outlinerNode.17126087311408424225" class="sc-bczRLJ sc-gsnTZi sc-eCqeQn inzphK egGwwM ixijrF">…</div>
- attempting click action
- waiting for element to be visible, enabled and stable
- element is visible, enabled and stable
- scrolling into view if needed
- done scrolling
- performing click action
Snapshot of the Trace Viewer
So why is this click action still timing out if everything worked correctly?
Jelle Roets is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Is it possible that the button is hidden under some kind of popup display? Also you should assert on the actionability of the button before clicking it, this will tell you if the button never reaches the correct state or if the clicking action fails itself for some reason:
await expect(page.getByTestId('outlinerNode.17126087311408424225')).toBeEnabled()
If you’re sure that locators are correct (even with this huge number in it), you may try to use force. https://playwright.dev/docs/input#forcing-the-click
await page.getByTestId('outlinerNode.17126087311408424225').click({ force: true });