23
23
callback_context ,
24
24
)
25
25
from dash .exceptions import PreventUpdate
26
- from dash .testing import wait
27
26
from tests .integration .utils import json_engine
28
27
29
28
@@ -47,7 +46,7 @@ def update_output(value):
47
46
48
47
dash_duo .start_server (app )
49
48
50
- assert dash_duo .find_element ("#output-1" ). text == "initial value"
49
+ dash_duo .wait_for_text_to_equal ("#output-1" , "initial value" )
51
50
dash_duo .percy_snapshot (name = "simple-callback-initial" )
52
51
53
52
input_ = dash_duo .find_element ("#input" )
@@ -57,7 +56,7 @@ def update_output(value):
57
56
with lock :
58
57
input_ .send_keys (key )
59
58
60
- wait . until ( lambda : dash_duo .find_element ("#output-1" ). text == "hello world" , 2 )
59
+ dash_duo .wait_for_text_to_equal ("#output-1" , "hello world" )
61
60
dash_duo .percy_snapshot (name = "simple-callback-hello-world" )
62
61
63
62
assert call_count .value == 2 + len ("hello world" ), "initial count + each key stroke"
@@ -144,11 +143,6 @@ def update_input(value):
144
143
# editing the input should modify the sub output
145
144
dash_duo .find_element ("#sub-input-1" ).send_keys ("deadbeef" )
146
145
147
- assert (
148
- dash_duo .find_element ("#sub-output-1" ).text
149
- == pad_input .attrs ["value" ] + "deadbeef"
150
- ), "deadbeef is added"
151
-
152
146
# the total updates is initial one + the text input changes
153
147
dash_duo .wait_for_text_to_equal (
154
148
"#sub-output-1" , pad_input .attrs ["value" ] + "deadbeef"
@@ -452,25 +446,16 @@ def content(n, d, v):
452
446
453
447
dash_duo .start_server (app )
454
448
455
- wait . until ( lambda : dash_duo .find_element ("#output" ). text == '[null, null, "A"]' , 3 )
449
+ dash_duo .wait_for_text_to_equal ("#output" , '[null, null, "A"]' )
456
450
dash_duo .wait_for_element ("#d" ).click ()
457
451
458
- wait .until (
459
- lambda : dash_duo .find_element ("#output" ).text == '[null, 1, "A"]' ,
460
- 3 ,
461
- )
452
+ dash_duo .wait_for_text_to_equal ("#output" , '[null, 1, "A"]' )
462
453
463
454
dash_duo .wait_for_element ("#n" ).click ()
464
- wait .until (
465
- lambda : dash_duo .find_element ("#output" ).text == '[1, 1, "A"]' ,
466
- 3 ,
467
- )
455
+ dash_duo .wait_for_text_to_equal ("#output" , '[1, 1, "A"]' )
468
456
469
457
dash_duo .wait_for_element ("#d" ).click ()
470
- wait .until (
471
- lambda : dash_duo .find_element ("#output" ).text == '[1, 2, "A"]' ,
472
- 3 ,
473
- )
458
+ dash_duo .wait_for_text_to_equal ("#output" , '[1, 2, "A"]' )
474
459
475
460
476
461
def test_cbsc010_event_properties (dash_duo ):
@@ -712,7 +697,7 @@ def follower_output(v):
712
697
with lock :
713
698
input_ .send_keys (key )
714
699
715
- wait . until ( lambda : dash_duo .find_element ("#input-text" ). text == "3" , 2 )
700
+ dash_duo .wait_for_text_to_equal ("#input-text" , "3" )
716
701
717
702
assert call_count .value == 2 , "initial + changed once"
718
703
@@ -746,13 +731,13 @@ def update_output(value, data):
746
731
747
732
dash_duo .start_server (app )
748
733
749
- assert dash_duo .find_element ("#output-1" ). text == "initial value"
734
+ dash_duo .wait_for_text_to_equal ("#output-1" , "initial value" )
750
735
751
736
input_ = dash_duo .find_element ("#input" )
752
737
dash_duo .clear_input (input_ )
753
738
input_ .send_keys ("A" )
754
739
755
- wait . until ( lambda : dash_duo .find_element ("#output-1" ). text == "A" , 2 )
740
+ dash_duo .wait_for_text_to_equal ("#output-1" , "A" )
756
741
757
742
assert store_data .value == 123
758
743
assert dash_duo .get_logs () == []
0 commit comments