@@ -18,7 +18,7 @@ def css_escape(s):
1818@pytest .mark .parametrize ("content_callback" , (False , True ))
1919def test_jlcbwc001_todo_app (content_callback , dashjl ):
2020 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 )
2222 dashjl .start_server (fp )
2323 dashjl .wait_for_text_to_equal ("#totals" , "0 of 0 items completed" , timeout = 10 )
2424
@@ -34,7 +34,7 @@ def get_done_item(item):
3434 return dashjl .find_element (selector )
3535
3636 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 )
3838
3939 expected_note = "" if done else (prefix + " preceding items are done" + suffix )
4040 dashjl .wait_for_text_to_equal (
@@ -45,143 +45,149 @@ def assert_item(item, text, done, prefix="", suffix=""):
4545
4646 new_item .send_keys ("apples" )
4747 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 )
4949 assert_count (1 )
5050
5151 new_item .send_keys ("bananas" )
5252 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 )
5454 assert_count (2 )
5555
5656 new_item .send_keys ("carrots" )
5757 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 )
5959 assert_count (3 )
6060
6161 new_item .send_keys ("dates" )
6262 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 )
6464 assert_count (4 )
6565 assert_item (1 , "apples" , False , "0 of 0" , " DO THIS NEXT!" )
6666 assert_item (2 , "bananas" , False , "0 of 1" )
6767 assert_item (3 , "carrots" , False , "0 of 2" )
6868 assert_item (4 , "dates" , False , "0 of 3" )
6969
7070 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 )
7272 assert_item (1 , "apples" , False , "0 of 0" , " DO THIS NEXT!" )
7373 assert_item (2 , "bananas" , False , "0 of 1" )
7474 assert_item (3 , "carrots" , True )
7575 assert_item (4 , "dates" , False , "1 of 3" )
7676
7777 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 )
7979 assert_item (1 , "apples" , True )
8080 assert_item (2 , "bananas" , False , "1 of 1" , " DO THIS NEXT!" )
8181 assert_item (3 , "carrots" , True )
8282 assert_item (4 , "dates" , False , "2 of 3" )
8383
8484 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 )
8686 assert_count (2 )
8787 assert_item (1 , "bananas" , False , "0 of 0" , " DO THIS NEXT!" )
8888 assert_item (2 , "dates" , False , "0 of 1" )
8989
9090 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 )
9292 assert_item (1 , "bananas" , True )
9393 assert_item (2 , "dates" , False , "1 of 1" , " DO THIS NEXT!" )
9494
9595 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 )
9797 assert_item (1 , "bananas" , True )
9898 assert_item (2 , "dates" , True )
9999
100100 clear_done .click ()
101101 # This was a tricky one - trigger based on deleted components
102102 dashjl .wait_for_text_to_equal ("#totals" , "0 of 0 items completed" )
103103 assert_count (0 )
104-
104+
105105@pytest .mark .parametrize ("clientside" , (False , True ))
106106def test_jlcbwc002_fibonacci_app (clientside , dashjl ):
107107 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 )
109109 dashjl .start_server (fp )
110110
111111 # 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 )
113113
114114 # add 5th item, "3"
115115 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 )
117117
118118 # add 6th item, "5"
119119 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 )
121121
122122 # add 7th item, "8"
123123 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 )
125125
126126 # back down all the way to no elements
127127 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 )
129129 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 )
131131 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 )
133133 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 )
135135 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 )
137137 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 )
139139 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 )
141141
142142def 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" )
144144 dashjl .start_server (fp )
145145
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+ )
147150 dashjl .select_dcc_dropdown (
148151 '#\\ {\\ "index\\ "\\ :0\\ ,\\ "type\\ "\\ :\\ "dropdown\\ "\\ }' , "LA"
149152 )
150153 dashjl .wait_for_text_to_equal (
151- '#\\ {\\ "index\\ "\\ :0\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 0 = LA"
154+ '#\\ {\\ "index\\ "\\ :0\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 0 = LA" , timeout = 10
152155 )
153156 dashjl .find_element ("#add-filter" ).click ()
157+ dashjl .wait_for_text_to_equal (
158+ '#\\ {\\ "index\\ "\\ :1\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 1 = nothing" , timeout = 10
159+ )
154160 dashjl .select_dcc_dropdown (
155161 '#\\ {\\ "index\\ "\\ :1\\ ,\\ "type\\ "\\ :\\ "dropdown\\ "\\ }' , "MTL"
156162 )
157163 dashjl .wait_for_text_to_equal (
158- '#\\ {\\ "index\\ "\\ :1\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 1 = MTL"
164+ '#\\ {\\ "index\\ "\\ :1\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 1 = MTL" , timeout = 10
159165 )
160166 dashjl .wait_for_text_to_equal (
161- '#\\ {\\ "index\\ "\\ :0\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 0 = LA"
167+ '#\\ {\\ "index\\ "\\ :0\\ ,\\ "type\\ "\\ :\\ "output\\ "\\ }' , "Dropdown 0 = LA" , timeout = 10
162168 )
163169 dashjl .wait_for_no_elements (dashjl .devtools_error_count_locator )
164170
165171def 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" )
167173 dashjl .start_server (fp )
168174
169- dashjl .wait_for_text_to_equal ("#container" , "No content initially" )
175+ dashjl .wait_for_text_to_equal ("#container" , "No content initially" , timeout = 10 )
170176 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
172178 )
173179
174180 dashjl .find_element ("#btn" ).click ()
175181 dashjl .wait_for_text_to_equal (
176182 "#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
178184 )
179185 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
181187 )
182188
183189 dashjl .find_elements ("input" )[0 ].send_keys ("X" )
184190 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 )
187193
0 commit comments