|
2 | 2 | import re
|
3 | 3 | from selenium.webdriver.common.keys import Keys
|
4 | 4 | import json
|
5 |
| -import time |
| 5 | +from multiprocessing import Lock |
6 | 6 |
|
7 | 7 | from dash.testing import wait
|
8 | 8 | import dash
|
@@ -556,6 +556,7 @@ def update_selected_values(values):
|
556 | 556 |
|
557 | 557 |
|
558 | 558 | def test_cbwc008_running_match(dash_duo):
|
| 559 | + lock = Lock() |
559 | 560 | app = dash.Dash()
|
560 | 561 |
|
561 | 562 | app.layout = [
|
@@ -590,21 +591,24 @@ def test_cbwc008_running_match(dash_duo):
|
590 | 591 | prevent_initial_call=True,
|
591 | 592 | )
|
592 | 593 | def on_click(_) -> str:
|
593 |
| - time.sleep(1) |
594 |
| - return "done" |
| 594 | + with lock: |
| 595 | + return "done" |
595 | 596 |
|
596 | 597 | dash_duo.start_server(app)
|
597 | 598 |
|
598 | 599 | for i in range(1, 3):
|
599 |
| - dash_duo.find_element(f"#buttons button:nth-child({i})").click() |
600 |
| - dash_duo.wait_for_text_to_equal(f"#buttons button:nth-child({i})", "running") |
601 |
| - # verify all the buttons were disabled. |
602 |
| - assert dash_duo.find_element("#buttons button:nth-child(1)").get_attribute( |
603 |
| - "disabled" |
604 |
| - ) |
605 |
| - assert dash_duo.find_element("#buttons button:nth-child(2)").get_attribute( |
606 |
| - "disabled" |
607 |
| - ) |
| 600 | + with lock: |
| 601 | + dash_duo.find_element(f"#buttons button:nth-child({i})").click() |
| 602 | + dash_duo.wait_for_text_to_equal( |
| 603 | + f"#buttons button:nth-child({i})", "running" |
| 604 | + ) |
| 605 | + # verify all the buttons were disabled. |
| 606 | + assert dash_duo.find_element("#buttons button:nth-child(1)").get_attribute( |
| 607 | + "disabled" |
| 608 | + ) |
| 609 | + assert dash_duo.find_element("#buttons button:nth-child(2)").get_attribute( |
| 610 | + "disabled" |
| 611 | + ) |
608 | 612 |
|
609 | 613 | dash_duo.wait_for_text_to_equal(f"#output{i}", "done")
|
610 | 614 | dash_duo.wait_for_text_to_equal(f"#buttons button:nth-child({i})", "finished")
|
|
0 commit comments