Skip to content

Commit 358acc0

Browse files
committed
add find_elements and select_dcc_dropdown methods to DashDuo(Protocol)
1 parent 1a595bf commit 358acc0

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

crystal_toolkit/apps/examples/tests/typing.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
from __future__ import annotations
22

3-
from typing import Protocol
3+
from typing import Protocol, Union
44

55
import dash
66

7+
ElemOrSelector = Union[str, dash.development.base_component.Component]
8+
79

810
class DashDuo(Protocol):
9-
"The dash_duo pytest fixture lives in dash.testing.plugin.dash_duo."
11+
"""The dash_duo pytest fixture lives in dash.testing.plugin.dash_duo.
12+
13+
See https://dash.plotly.com/testing#browser-apis
14+
"""
1015

1116
def start_server(self, start_server) -> None:
1217
...
@@ -39,3 +44,14 @@ def take_snapshot(self, name: str) -> None:
3944

4045
def wait_for_page(self, url: str = None, timeout: int = 10) -> None:
4146
...
47+
48+
def find_elements(
49+
self, selector: str
50+
) -> list[dash.development.base_component.Component]:
51+
...
52+
53+
def select_dcc_dropdown(
54+
self, elem_or_selector: ElemOrSelector, value: str = None, index: int = None
55+
) -> None:
56+
# https://github.com/plotly/dash/blob/04217e8/dash/testing/browser.py#L409
57+
...

0 commit comments

Comments
 (0)