Dash Testing on Multi-page App beyond the first page

Our team recently started to use Dash to build ML apps and testing is part of the project. After reading the docu I couldn’t find any useful tips or examples of how to route the dash_duo into different pages of the app beyond the landing first page. For example, i have index.py with login, and the testing i can read seems to help with testing this ONE index.py. But how can i route to ‘’, for example. I notice all test examples are having the html layout code right inside the test function. What is the purpose of putting mock-up html component code in test function, instead of importing the separate component, (which I can not import from a test file ), or instantiating the page running on selenium web driver directly? It’s not feasible to duplicate any html component in the test file as the pages get more complicated…

Can someone shed some light on this? Thank you in advance.


Hey @shu1213,

Did you get anywhere further with testing multi-page applications? I tried to google good examples on how to do it, but I can’t find anything interesting…

One thing I learned so far in this process is that you can use in your test:

dash_duo.wait_for_page(dash_duo.server_url + '/data1', timeout=5)

This will load the route as you asked.

If you (or anyone else) have anything that can help me further, please share!


You can find great information on dash testing here: Dash Testing | Dash for Python Documentation | Plotly

Then specifically for testing multi-page apps, see the tests for the dcc.Link component here: dash-core-components/tests/integration/link at dev · plotly/dash-core-components · GitHub

1 Like

Thank you, @AnnMarieW!

@AnnMarieW Is there any chance for an updated link (the second link is broken)? I’m trying to write tests for a multi-page application but can’t find many good resources.

Hi @trlemon

You can find tests for the dcc.Link component here: dash/components/dash-core-components/tests/integration/link at dev · plotly/dash · GitHub

You can also find test for Pages here: dash/tests/integration/multi_page at dev · plotly/dash · GitHub

1 Like

@AnnMarieW Thank you!

1 Like