-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathtest_basic_long_callback004.py
More file actions
43 lines (34 loc) · 1.81 KB
/
test_basic_long_callback004.py
File metadata and controls
43 lines (34 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import sys
import pytest
from flaky import flaky
from tests.background_callback.utils import setup_background_callback_app
@pytest.mark.skipif(
sys.version_info < (3, 7), reason="Python 3.6 long callbacks tests hangs up"
)
@flaky(max_runs=3)
def test_lcbc004_long_callback_progress(dash_duo, manager):
with setup_background_callback_app(manager, "app4") as app:
dash_duo.start_server(app)
dash_duo.wait_for_text_to_equal("#status", "Finished", 8)
dash_duo.wait_for_text_to_equal("#result", "No results", 8)
# click run and check that status eventually cycles to 2/4
dash_duo.find_element("#run-button").click()
dash_duo.wait_for_text_to_equal("#status", "Progress 2/4", 15)
# Then click Cancel button and make sure that the status changes to finish
# without updating result
dash_duo.find_element("#cancel-button").click()
dash_duo.wait_for_text_to_equal("#status", "Finished", 8)
dash_duo.wait_for_text_to_equal("#result", "No results", 8)
# Click run button and allow callback to finish
dash_duo.find_element("#run-button").click()
dash_duo.wait_for_text_to_equal("#status", "Progress 2/4", 15)
dash_duo.wait_for_text_to_equal("#status", "Finished", 15)
dash_duo.wait_for_text_to_equal("#result", "Processed 'hello, world'", 8)
# Click run button again with same input.
# without caching, this should rerun callback and display progress
dash_duo.find_element("#run-button").click()
dash_duo.wait_for_text_to_equal("#status", "Progress 2/4", 15)
dash_duo.wait_for_text_to_equal("#status", "Finished", 15)
dash_duo.wait_for_text_to_equal("#result", "Processed 'hello, world'", 8)
assert not dash_duo.redux_state_is_loading
assert dash_duo.get_logs() == []