|
1 | 1 | import pathlib
|
2 | 2 | import os.path
|
3 | 3 | import logging
|
| 4 | + |
4 | 5 | logger = logging.getLogger(__name__)
|
5 | 6 |
|
6 | 7 | curr_path = pathlib.Path(__file__).parent.absolute()
|
7 | 8 | def jl_test_file_path(filename):
|
8 | 9 | return os.path.join(curr_path, "jl_plotly_graph", filename)
|
9 | 10 |
|
| 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) |
10 | 15 |
|
| 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") |
11 | 22 |
|
12 | 23 |
|
13 | 24 | 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") |
19 | 26 |
|
20 |
| - dashjl.wait_for_text_to_equal("#status", "first", timeout=10) |
21 | 27 |
|
22 |
| - dashjl.percy_snapshot(name="PlotlyBase figure layout") |
23 | 28 |
|
24 |
| - dashjl.find_element("#draw").click() |
25 |
| - dashjl.wait_for_text_to_equal("#status", "second", timeout=10) |
26 | 29 |
|
27 |
| - dashjl.percy_snapshot(name="PlotlyBase figure callback") |
|
0 commit comments