|
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 | + name = f"{percy_snapshot_prefix} figure callback" |
10 | 14 |
|
11 |
| - |
12 |
| - |
13 |
| -def test_jlpg001_plotly_graph(dashjl): |
14 |
| - fp = jl_test_file_path("jlpg001_plotly_graph.jl") |
15 | 15 | dashjl.start_server(fp)
|
16 |
| - dashjl.wait_for_element_by_css_selector( |
17 |
| - "#graph", timeout=20 |
18 |
| - ) |
| 16 | + dashjl.wait_for_element_by_css_selector("#graph", timeout=20) |
19 | 17 |
|
20 | 18 | dashjl.wait_for_text_to_equal("#status", "first", timeout=10)
|
21 |
| - |
22 |
| - dashjl.percy_snapshot(name="PlotlyBase figure layout") |
| 19 | + dashjl.percy_snapshot(name=f"{percy_snapshot_prefix} figure layout") |
23 | 20 |
|
24 | 21 | dashjl.find_element("#draw").click()
|
25 | 22 | dashjl.wait_for_text_to_equal("#status", "second", timeout=10)
|
| 23 | + dashjl.percy_snapshot(name=name) |
| 24 | + |
| 25 | + |
| 26 | +def test_jlpg001_plotly_graph(dashjl): |
| 27 | + _run_test(dashjl, "jlpg001_plotly_graph.jl", "PlotlyBase") |
| 28 | + |
| 29 | +def test_jlpg002_plotlyjs_graph(dashjl): |
| 30 | + _run_test(dashjl, "jlpg002_plotlyjs_graph.jl", "PlotlyJS") |
| 31 | + |
| 32 | +def test_jlpg003_plots_plotly_graph(dashjl): |
| 33 | + _run_test(dashjl, "jlpg003_plots_plotly_graph.jl", "Plots plotly") |
26 | 34 |
|
27 |
| - dashjl.percy_snapshot(name="PlotlyBase figure callback") |
| 35 | +def test_jlpg004_plots_plotlyjs_graph(dashjl): |
| 36 | + _run_test(dashjl, "jlpg004_plots_plotlyjs_graph.jl", "Plots plotlyjs") |
0 commit comments