provide `typing.Protocol` for `dash_duo`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Is your feature request related to a problem? Please describe.
The DX for using the pytest fixture dash.testing.plugin.dash_duo() could be improved by providing a typing.Protocol to type hint available methods and their signatures.
Describe the solution you'd like
from typing import Protocol
import dash
from dash.testing.application_runners import import_app
from dash.testing.wait import wait_for_element_by_css_selector, wait_for_text_to_equal
class DashDuo(Protocol):
"The dash_duo pytest fixture lives in dash.testing.plugin.dash_duo."
def start_server(self, start_server) -> None:
...
def find_element(self, selector: str) -> dash.development.base_component.Component:
...
def test_example_app(dash_duo: DashDuo): # type hint for dash_duo enables auto-complete
app = import_app("example")
dash_duo.start_server(app)
my_component = dash_duo.find_element("#hello-world")
assert "my-value" == my_component.get_attribute("value")
....
Screenshot from VS Code showing auto-complete in action

Describe alternatives you've considered
None
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the dash.testing.plugin.dash_duo fixture and inspect the methods and signatures it exposes, including start_server and find_element. Define a typing.Protocol that represents those fixture methods and verify that annotating a pytest test with it provides the requested method signatures and autocomplete support.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- developer-experience, testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100