Skip to content

Commit 2083551

Browse files
committed
make test_plotly_graph.py more general
1 parent c68c8dc commit 2083551

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

test/integration/base/test_plotly_graph.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
import pathlib
22
import os.path
33
import logging
4+
45
logger = logging.getLogger(__name__)
56

67
curr_path = pathlib.Path(__file__).parent.absolute()
78
def jl_test_file_path(filename):
89
return os.path.join(curr_path, "jl_plotly_graph", filename)
910

11+
def _run_test(dashjl, filename, percy_snapshot_prefix):
12+
fp = jl_test_file_path(filename)
13+
dashjl.start_server(fp)
14+
dashjl.wait_for_element_by_css_selector("#graph", timeout=20)
1015

16+
dashjl.wait_for_text_to_equal("#status", "first", timeout=10)
17+
dashjl.percy_snapshot(name=f"{percy_snapshot_prefix} figure layout")
18+
19+
dashjl.find_element("#draw").click()
20+
dashjl.wait_for_text_to_equal("#status", "second", timeout=10)
21+
dashjl.percy_snapshot(name="f{percy_snapshot_prefix} figure callback")
1122

1223

1324
def test_jlpg001_plotly_graph(dashjl):
14-
fp = jl_test_file_path("jlpg001_plotly_graph.jl")
15-
dashjl.start_server(fp)
16-
dashjl.wait_for_element_by_css_selector(
17-
"#graph", timeout=20
18-
)
25+
_run_test(dashjl, "jlpg001_plotly_graph.jl", "PlotlyBase")
1926

20-
dashjl.wait_for_text_to_equal("#status", "first", timeout=10)
2127

22-
dashjl.percy_snapshot(name="PlotlyBase figure layout")
2328

24-
dashjl.find_element("#draw").click()
25-
dashjl.wait_for_text_to_equal("#status", "second", timeout=10)
2629

27-
dashjl.percy_snapshot(name="PlotlyBase figure callback")

0 commit comments

Comments
 (0)