diff --git a/tests/unit_tests/test_scan_history_browser.py b/tests/unit_tests/test_scan_history_browser.py index b6f11546..caa5e24d 100644 --- a/tests/unit_tests/test_scan_history_browser.py +++ b/tests/unit_tests/test_scan_history_browser.py @@ -165,14 +165,21 @@ def test_scan_history_device_viewer_on_request_plotting_clicked( """Test the request plotting button click.""" scan_history_device_viewer.update_devices_from_scan_history(scan_history_msg) + plotting_callback_args = [] + def plotting_callback(device_name, signal_name, msg): """Callback to check if the request plotting signal is emitted.""" - assert device_name == "device2" - - assert msg == scan_history_msg + plotting_callback_args.append((device_name, signal_name, msg)) scan_history_device_viewer.request_history_plot.connect(plotting_callback) qtbot.mouseClick(scan_history_device_viewer.request_plotting_button, QtCore.Qt.LeftButton) + qtbot.waitUntil(lambda: len(plotting_callback_args) > 0, timeout=5000) + assert plotting_callback_args[0][2] == scan_history_msg + assert plotting_callback_args[0][0] in scan_history_msg.stored_data_info.keys() + assert ( + plotting_callback_args[0][1] + in scan_history_msg.stored_data_info[plotting_callback_args[0][0]].keys() + ) def test_scan_history_metadata_viewer_receive_msg(