@@ -18,7 +18,7 @@ def css_escape(s):
18
18
@pytest .mark .parametrize ("content_callback" , (False , True ))
19
19
def test_jlcbwc001_todo_app (content_callback , dashjl ):
20
20
jl_file = "jlcbwc001_todo_app_true.jl" if content_callback else "jlcbwc001_todo_app_false.jl"
21
- fp = jl_test_file_path (jl_file )
21
+ fp = jl_test_file_path (jl_file )
22
22
dashjl .start_server (fp )
23
23
dashjl .wait_for_text_to_equal ("#totals" , "0 of 0 items completed" , timeout = 10 )
24
24
@@ -34,7 +34,7 @@ def get_done_item(item):
34
34
return dashjl .find_element (selector )
35
35
36
36
def assert_item (item , text , done , prefix = "" , suffix = "" ):
37
- dashjl .wait_for_text_to_equal (css_escape ('#{"item":%d}' % item ), text , timeout = 4 )
37
+ dashjl .wait_for_text_to_equal (css_escape ('#{"item":%d}' % item ), text , timeout = 10 )
38
38
39
39
expected_note = "" if done else (prefix + " preceding items are done" + suffix )
40
40
dashjl .wait_for_text_to_equal (
@@ -45,143 +45,149 @@ def assert_item(item, text, done, prefix="", suffix=""):
45
45
46
46
new_item .send_keys ("apples" )
47
47
add_item .click ()
48
- dashjl .wait_for_text_to_equal ("#totals" , "0 of 1 items completed - 0%" )
48
+ dashjl .wait_for_text_to_equal ("#totals" , "0 of 1 items completed - 0%" , timeout = 10 )
49
49
assert_count (1 )
50
50
51
51
new_item .send_keys ("bananas" )
52
52
add_item .click ()
53
- dashjl .wait_for_text_to_equal ("#totals" , "0 of 2 items completed - 0%" )
53
+ dashjl .wait_for_text_to_equal ("#totals" , "0 of 2 items completed - 0%" , timeout = 10 )
54
54
assert_count (2 )
55
55
56
56
new_item .send_keys ("carrots" )
57
57
add_item .click ()
58
- dashjl .wait_for_text_to_equal ("#totals" , "0 of 3 items completed - 0%" )
58
+ dashjl .wait_for_text_to_equal ("#totals" , "0 of 3 items completed - 0%" , timeout = 10 )
59
59
assert_count (3 )
60
60
61
61
new_item .send_keys ("dates" )
62
62
add_item .click ()
63
- dashjl .wait_for_text_to_equal ("#totals" , "0 of 4 items completed - 0%" )
63
+ dashjl .wait_for_text_to_equal ("#totals" , "0 of 4 items completed - 0%" , timeout = 10 )
64
64
assert_count (4 )
65
65
assert_item (1 , "apples" , False , "0 of 0" , " DO THIS NEXT!" )
66
66
assert_item (2 , "bananas" , False , "0 of 1" )
67
67
assert_item (3 , "carrots" , False , "0 of 2" )
68
68
assert_item (4 , "dates" , False , "0 of 3" )
69
69
70
70
get_done_item (3 ).click ()
71
- dashjl .wait_for_text_to_equal ("#totals" , "1 of 4 items completed - 25%" )
71
+ dashjl .wait_for_text_to_equal ("#totals" , "1 of 4 items completed - 25%" , timeout = 10 )
72
72
assert_item (1 , "apples" , False , "0 of 0" , " DO THIS NEXT!" )
73
73
assert_item (2 , "bananas" , False , "0 of 1" )
74
74
assert_item (3 , "carrots" , True )
75
75
assert_item (4 , "dates" , False , "1 of 3" )
76
76
77
77
get_done_item (1 ).click ()
78
- dashjl .wait_for_text_to_equal ("#totals" , "2 of 4 items completed - 50%" )
78
+ dashjl .wait_for_text_to_equal ("#totals" , "2 of 4 items completed - 50%" , timeout = 10 )
79
79
assert_item (1 , "apples" , True )
80
80
assert_item (2 , "bananas" , False , "1 of 1" , " DO THIS NEXT!" )
81
81
assert_item (3 , "carrots" , True )
82
82
assert_item (4 , "dates" , False , "2 of 3" )
83
83
84
84
clear_done .click ()
85
- dashjl .wait_for_text_to_equal ("#totals" , "0 of 2 items completed - 0%" )
85
+ dashjl .wait_for_text_to_equal ("#totals" , "0 of 2 items completed - 0%" , timeout = 10 )
86
86
assert_count (2 )
87
87
assert_item (1 , "bananas" , False , "0 of 0" , " DO THIS NEXT!" )
88
88
assert_item (2 , "dates" , False , "0 of 1" )
89
89
90
90
get_done_item (1 ).click ()
91
- dashjl .wait_for_text_to_equal ("#totals" , "1 of 2 items completed - 50%" )
91
+ dashjl .wait_for_text_to_equal ("#totals" , "1 of 2 items completed - 50%" , timeout = 10 )
92
92
assert_item (1 , "bananas" , True )
93
93
assert_item (2 , "dates" , False , "1 of 1" , " DO THIS NEXT!" )
94
94
95
95
get_done_item (2 ).click ()
96
- dashjl .wait_for_text_to_equal ("#totals" , "2 of 2 items completed - 100%" )
96
+ dashjl .wait_for_text_to_equal ("#totals" , "2 of 2 items completed - 100%" , timeout = 10 )
97
97
assert_item (1 , "bananas" , True )
98
98
assert_item (2 , "dates" , True )
99
99
100
100
clear_done .click ()
101
101
# This was a tricky one - trigger based on deleted components
102
102
dashjl .wait_for_text_to_equal ("#totals" , "0 of 0 items completed" )
103
103
assert_count (0 )
104
-
104
+
105
105
@pytest .mark .parametrize ("clientside" , (False , True ))
106
106
def test_jlcbwc002_fibonacci_app (clientside , dashjl ):
107
107
jl_file = "jlcbwc002_fibonacci_app_true.jl" if clientside else "jlcbwc002_fibonacci_app_false.jl"
108
- fp = jl_test_file_path (jl_file )
108
+ fp = jl_test_file_path (jl_file )
109
109
dashjl .start_server (fp )
110
110
111
111
# app starts with 4 elements: 0, 1, 1, 2
112
- dashjl .wait_for_text_to_equal ("#sum" , "4 elements, sum: 4" , timeout = 4 )
112
+ dashjl .wait_for_text_to_equal ("#sum" , "4 elements, sum: 4" , timeout = 20 )
113
113
114
114
# add 5th item, "3"
115
115
dashjl .find_element ("#n" ).send_keys (Keys .UP )
116
- dashjl .wait_for_text_to_equal ("#sum" , "5 elements, sum: 7" )
116
+ dashjl .wait_for_text_to_equal ("#sum" , "5 elements, sum: 7" , timeout = 10 )
117
117
118
118
# add 6th item, "5"
119
119
dashjl .find_element ("#n" ).send_keys (Keys .UP )
120
- dashjl .wait_for_text_to_equal ("#sum" , "6 elements, sum: 12" )
120
+ dashjl .wait_for_text_to_equal ("#sum" , "6 elements, sum: 12" , timeout = 10 )
121
121
122
122
# add 7th item, "8"
123
123
dashjl .find_element ("#n" ).send_keys (Keys .UP )
124
- dashjl .wait_for_text_to_equal ("#sum" , "7 elements, sum: 20" )
124
+ dashjl .wait_for_text_to_equal ("#sum" , "7 elements, sum: 20" , timeout = 10 )
125
125
126
126
# back down all the way to no elements
127
127
dashjl .find_element ("#n" ).send_keys (Keys .DOWN )
128
- dashjl .wait_for_text_to_equal ("#sum" , "6 elements, sum: 12" )
128
+ dashjl .wait_for_text_to_equal ("#sum" , "6 elements, sum: 12" , timeout = 10 )
129
129
dashjl .find_element ("#n" ).send_keys (Keys .DOWN )
130
- dashjl .wait_for_text_to_equal ("#sum" , "5 elements, sum: 7" )
130
+ dashjl .wait_for_text_to_equal ("#sum" , "5 elements, sum: 7" , timeout = 10 )
131
131
dashjl .find_element ("#n" ).send_keys (Keys .DOWN )
132
- dashjl .wait_for_text_to_equal ("#sum" , "4 elements, sum: 4" )
132
+ dashjl .wait_for_text_to_equal ("#sum" , "4 elements, sum: 4" , timeout = 10 )
133
133
dashjl .find_element ("#n" ).send_keys (Keys .DOWN )
134
- dashjl .wait_for_text_to_equal ("#sum" , "3 elements, sum: 2" )
134
+ dashjl .wait_for_text_to_equal ("#sum" , "3 elements, sum: 2" , timeout = 10 )
135
135
dashjl .find_element ("#n" ).send_keys (Keys .DOWN )
136
- dashjl .wait_for_text_to_equal ("#sum" , "2 elements, sum: 1" )
136
+ dashjl .wait_for_text_to_equal ("#sum" , "2 elements, sum: 1" , timeout = 10 )
137
137
dashjl .find_element ("#n" ).send_keys (Keys .DOWN )
138
- dashjl .wait_for_text_to_equal ("#sum" , "1 elements, sum: 0" )
138
+ dashjl .wait_for_text_to_equal ("#sum" , "1 elements, sum: 0" , timeout = 10 )
139
139
dashjl .find_element ("#n" ).send_keys (Keys .DOWN )
140
- dashjl .wait_for_text_to_equal ("#sum" , "0 elements, sum: 0" )
140
+ dashjl .wait_for_text_to_equal ("#sum" , "0 elements, sum: 0" , timeout = 10 )
141
141
142
142
def test_jlcbwc003_same_keys (dashjl ):
143
- fp = jl_test_file_path ("jlcbwc003_same_keys.jl" )
143
+ fp = jl_test_file_path ("jlcbwc003_same_keys.jl" )
144
144
dashjl .start_server (fp )
145
145
146
- dashjl .wait_for_text_to_equal ("#add-filter" , "Add Filter" , timeout = 3 )
146
+ dashjl .wait_for_text_to_equal ("#add-filter" , "Add Filter" , timeout = 10 )
147
+ dashjl .wait_for_text_to_equal (
148
+ '#\\ {\\ "index\\ "\\ :0\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 0 = nothing" , timeout = 20
149
+ )
147
150
dashjl .select_dcc_dropdown (
148
151
'#\\ {\\ "index\\ "\\ :0\\ ,\\ "type\\ "\\ :\\ "dropdown\\ "\\ }' , "LA"
149
152
)
150
153
dashjl .wait_for_text_to_equal (
151
- '#\\ {\\ "index\\ "\\ :0\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 0 = LA"
154
+ '#\\ {\\ "index\\ "\\ :0\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 0 = LA" , timeout = 10
152
155
)
153
156
dashjl .find_element ("#add-filter" ).click ()
157
+ dashjl .wait_for_text_to_equal (
158
+ '#\\ {\\ "index\\ "\\ :1\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 1 = nothing" , timeout = 10
159
+ )
154
160
dashjl .select_dcc_dropdown (
155
161
'#\\ {\\ "index\\ "\\ :1\\ ,\\ "type\\ "\\ :\\ "dropdown\\ "\\ }' , "MTL"
156
162
)
157
163
dashjl .wait_for_text_to_equal (
158
- '#\\ {\\ "index\\ "\\ :1\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 1 = MTL"
164
+ '#\\ {\\ "index\\ "\\ :1\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 1 = MTL" , timeout = 10
159
165
)
160
166
dashjl .wait_for_text_to_equal (
161
- '#\\ {\\ "index\\ "\\ :0\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 0 = LA"
167
+ '#\\ {\\ "index\\ "\\ :0\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 0 = LA" , timeout = 10
162
168
)
163
169
dashjl .wait_for_no_elements (dashjl .devtools_error_count_locator )
164
170
165
171
def test_jlcbwc004_layout_chunk_changed_props (dashjl ):
166
- fp = jl_test_file_path ("jlcbwc004_layout_chunk_changed_props.jl" )
172
+ fp = jl_test_file_path ("jlcbwc004_layout_chunk_changed_props.jl" )
167
173
dashjl .start_server (fp )
168
174
169
- dashjl .wait_for_text_to_equal ("#container" , "No content initially" )
175
+ dashjl .wait_for_text_to_equal ("#container" , "No content initially" , timeout = 10 )
170
176
dashjl .wait_for_text_to_equal (
171
- "#output-outer" , "triggered is Falsy with prop_ids"
177
+ "#output-outer" , "triggered is Falsy with prop_ids" , timeout = 10
172
178
)
173
179
174
180
dashjl .find_element ("#btn" ).click ()
175
181
dashjl .wait_for_text_to_equal (
176
182
"#output-outer" ,
177
- 'triggered is Truthy with prop_ids {"index":2,"type":"input"}.value' ,
183
+ 'triggered is Truthy with prop_ids {"index":2,"type":"input"}.value' , timeout = 10
178
184
)
179
185
dashjl .wait_for_text_to_equal (
180
- "#output-inner" , "triggered is Falsy with prop_ids"
186
+ "#output-inner" , "triggered is Falsy with prop_ids" , timeout = 10
181
187
)
182
188
183
189
dashjl .find_elements ("input" )[0 ].send_keys ("X" )
184
190
trigger_text = 'triggered is Truthy with prop_ids {"index":1,"type":"input"}.value'
185
- dashjl .wait_for_text_to_equal ("#output-outer" , trigger_text )
186
- dashjl .wait_for_text_to_equal ("#output-inner" , trigger_text )
191
+ dashjl .wait_for_text_to_equal ("#output-outer" , trigger_text , timeout = 10 )
192
+ dashjl .wait_for_text_to_equal ("#output-inner" , trigger_text , timeout = 10 )
187
193
0 commit comments