Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-el committed Sep 6, 2024
1 parent 0d41e81 commit cdbff4f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/ert/gui/simulation/run_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def __init__(
self.copy_debug_info_button = QPushButton("Debug Info")
self.copy_debug_info_button.setToolTip("Copies useful information to clipboard")
self.copy_debug_info_button.clicked.connect(self.produce_clipboard_debug_info)
self.copy_debug_info_button.setObjectName("copy_debug_info_button")

size = 20
spin_movie = QMovie("img:loading.gif")
Expand Down
19 changes: 14 additions & 5 deletions tests/unit_tests/gui/simulation/test_run_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pytestqt.qtbot import QtBot
from qtpy import QtWidgets
from qtpy.QtCore import Qt, QTimer
from qtpy.QtWidgets import QApplication, QComboBox, QToolButton, QWidget
from qtpy.QtWidgets import QApplication, QComboBox, QPushButton, QToolButton, QWidget

import ert
from ert.config import ErtConfig
Expand Down Expand Up @@ -566,13 +566,22 @@ def test_that_debug_info_button_provides_data_in_clipboard(qtbot: QtBot, storage
project=os.path.abspath(ert_config.ens_path),
):
gui = _setup_main_window(ert_config, args_mock, GUILogHandler(), storage)
qtbot.addWidget(gui)
experiment_panel = gui.findChild(ExperimentPanel)
assert isinstance(experiment_panel, ExperimentPanel)

run_experiment = experiment_panel.findChild(QWidget, name="run_experiment")
assert run_experiment
assert isinstance(run_experiment, QToolButton)

run_experiment = gui.findChild(QToolButton, name="run_experiment")
qtbot.mouseClick(run_experiment, Qt.LeftButton)
qtbot.waitUntil(lambda: gui.findChild(RunDialog) is not None, timeout=5000)
run_dialog = gui.findChild(RunDialog)
qtbot.waitUntil(run_dialog.done_button.isVisible, timeout=100000)

run_dialog = wait_for_child(gui, qtbot, RunDialog)
qtbot.mouseClick(run_dialog.copy_debug_info_button, Qt.LeftButton)
copy_debug_info_button = gui.findChild(QPushButton, "copy_debug_info_button")
assert copy_debug_info_button
assert isinstance(copy_debug_info_button, QPushButton)
qtbot.mouseClick(copy_debug_info_button, Qt.LeftButton)

clipboard_text = QApplication.clipboard().text()

Expand Down

0 comments on commit cdbff4f

Please sign in to comment.