I recently started using Dash for developing web applications. In order to improve the quality of my code, I began writing unit tests for these applications.
I followed the tutorials in the Dash documentation (https://dash.plotly.com/testing) and installed ChromeDriver and all other needed dependencies. When running the example unit tests from the Dash Documentation, every test that used dash_duo failed with a TestingTimeoutError. The unit tests that don't use dash_duo run just fine, but every single test that uses dash_duo fails with a TestingTimeoutError.
Eventually, I wrote a super simple test:
import dash
from dash import html
def test_001_test_dash_duo(dash_duo):
x = 2
assert x == 2
Even this test fails with a timeout error:
msg = 'expected condition not met within timeout'
def until(
wait_cond, timeout, poll=0.1, msg="expected condition not met within timeout"
): # noqa: C0330
res = wait_cond()
logger.debug(
"start wait.until with method, timeout, poll => %s %s %s",
wait_cond,
timeout,
poll,
)
end_time = time.time() + timeout
while not res:
if time.time() > end_time:
> raise TestingTimeoutError(msg)
E dash.testing.errors.TestingTimeoutError: expected condition not met within timeout
Any ideas of what is needed to get Dash unit tests using dash_duo to not fail by timeout?