1
1
from multiprocessing import Value
2
2
import time
3
3
4
- import dash
5
- from dash .dependencies import Input , Output
6
- import dash_html_components as html
4
+ from dash import Dash , Input , Output , html
7
5
8
6
9
7
def test_click_simple (dash_duo ):
10
8
call_count = Value ("i" , 0 )
11
9
12
- app = dash . Dash (__name__ )
10
+ app = Dash (__name__ )
13
11
app .layout = html .Div (
14
12
[
15
13
html .Div (id = "container" ),
@@ -29,13 +27,13 @@ def update_output(n_clicks):
29
27
30
28
dash_duo .wait_for_text_to_equal ("#container" , "clicked 0 times" )
31
29
assert call_count .value == 1
32
- dash_duo .percy_snapshot ("button initialization" )
30
+ dash_duo .percy_snapshot ("html button initialization" )
33
31
34
32
dash_duo .find_element ("#button" ).click ()
35
33
36
34
dash_duo .wait_for_text_to_equal ("#container" , "clicked 1 times" )
37
35
assert call_count .value == 2
38
- dash_duo .percy_snapshot ("button click" )
36
+ dash_duo .percy_snapshot ("html button click" )
39
37
40
38
assert not dash_duo .get_logs ()
41
39
@@ -48,7 +46,7 @@ def test_click_prev(dash_duo):
48
46
timestamp_1 = Value ("d" , - 5 )
49
47
timestamp_2 = Value ("d" , - 5 )
50
48
51
- app = dash . Dash (__name__ )
49
+ app = Dash (__name__ )
52
50
app .layout = html .Div (
53
51
[
54
52
html .Div (id = "container" ),
@@ -79,22 +77,22 @@ def update_output(*args):
79
77
assert timestamp_1 .value == - 1
80
78
assert timestamp_2 .value == - 1
81
79
assert call_count .value == 1
82
- dash_duo .percy_snapshot ("button initialization 1" )
80
+ dash_duo .percy_snapshot ("html button initialization 1" )
83
81
84
82
dash_duo .find_element ("#button-1" ).click ()
85
83
dash_duo .wait_for_text_to_equal ("#container" , "1, 0" )
86
84
assert timestamp_1 .value > ((time .time () - (24 * 60 * 60 )) * 1000 )
87
85
assert timestamp_2 .value == - 1
88
86
assert call_count .value == 2
89
- dash_duo .percy_snapshot ("button-1 click" )
87
+ dash_duo .percy_snapshot ("html button-1 click" )
90
88
prev_timestamp_1 = timestamp_1 .value
91
89
92
90
dash_duo .find_element ("#button-2" ).click ()
93
91
dash_duo .wait_for_text_to_equal ("#container" , "1, 1" )
94
92
assert timestamp_1 .value == prev_timestamp_1
95
93
assert timestamp_2 .value > ((time .time () - 24 * 60 * 60 ) * 1000 )
96
94
assert call_count .value == 3
97
- dash_duo .percy_snapshot ("button-2 click" )
95
+ dash_duo .percy_snapshot ("html button-2 click" )
98
96
prev_timestamp_2 = timestamp_2 .value
99
97
100
98
dash_duo .find_element ("#button-2" ).click ()
@@ -103,6 +101,6 @@ def update_output(*args):
103
101
assert timestamp_2 .value > prev_timestamp_2
104
102
assert timestamp_2 .value > timestamp_1 .value
105
103
assert call_count .value == 4
106
- dash_duo .percy_snapshot ("button-2 click again" )
104
+ dash_duo .percy_snapshot ("html button-2 click again" )
107
105
108
106
assert not dash_duo .get_logs ()
0 commit comments