Skip to content

Commit bb26279

Browse files
committed
Fix test_full_manual_update_workflow
1 parent dadd643 commit bb26279

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

src/ert/gui/main_window.py

+16-10
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,20 @@ def select_central_widget(self) -> None:
122122
if actor:
123123
index_name = actor.property("index")
124124

125+
if index_name == "Manage experiments":
126+
if self._manage_experiments_panel:
127+
self._manage_experiments_panel.close()
128+
self._manage_experiments_panel = ManageExperimentsPanel(
129+
self.ert_config,
130+
self.notifier,
131+
self.ert_config.model_config.num_realizations,
132+
)
133+
134+
self.central_panels_map["Manage experiments"] = (
135+
self._manage_experiments_panel
136+
)
137+
self.central_layout.addWidget(self._manage_experiments_panel)
138+
125139
if index_name == "Create plot" and not self._plot_window:
126140
self._plot_window = PlotWindow(self.config_file, self)
127141
self.central_layout.addWidget(self._plot_window)
@@ -193,16 +207,6 @@ def post_init(self) -> None:
193207
if menubar:
194208
menubar.addMenu(self.plugins_tool.get_menu())
195209

196-
self._manage_experiments_panel = ManageExperimentsPanel(
197-
self.ert_config,
198-
self.notifier,
199-
self.ert_config.model_config.num_realizations,
200-
)
201-
202-
self.central_panels_map["Manage experiments"] = self._manage_experiments_panel
203-
self._manage_experiments_panel.hide()
204-
self.central_layout.addWidget(self._manage_experiments_panel)
205-
206210
def _add_sidebar_button(self, name: str, icon: QIcon) -> QPushButton:
207211
button = QPushButton(self.side_frame)
208212
button.setFixedSize(60, 60)
@@ -213,6 +217,8 @@ def _add_sidebar_button(self, name: str, icon: QIcon) -> QPushButton:
213217
button.setIconSize(icon_size)
214218
button.setIcon(icon)
215219
button.setToolTip(name)
220+
objname = name.replace(" ", "_")
221+
button.setObjectName(f"button_{objname}")
216222
self.vbox_layout.addWidget(button)
217223

218224
button.clicked.connect(self.select_central_widget)

tests/ert/ui_tests/gui/test_full_manual_update_workflow.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from qtpy.QtCore import Qt
66
from qtpy.QtWidgets import (
77
QComboBox,
8+
QPushButton,
89
QTreeView,
910
QWidget,
1011
)
@@ -14,7 +15,7 @@
1415
from ert.gui.simulation.experiment_panel import ExperimentPanel
1516
from ert.gui.simulation.manual_update_panel import ManualUpdatePanel
1617
from ert.gui.simulation.run_dialog import RunDialog
17-
from ert.gui.tools.manage_experiments import ManageExperimentsTool
18+
from ert.gui.tools.manage_experiments import ManageExperimentsPanel
1819
from ert.gui.tools.manage_experiments.storage_widget import StorageWidget
1920
from ert.run_models.evaluate_ensemble import EvaluateEnsemble
2021
from ert.run_models.manual_update import ManualUpdate
@@ -44,16 +45,14 @@ def test_manual_analysis_workflow(ensemble_experiment_has_run, qtbot):
4445
qtbot.mouseClick(run_experiment, Qt.LeftButton)
4546
# The Run dialog opens, wait until done appears, then click done
4647
run_dialog = wait_for_child(gui, qtbot, RunDialog)
47-
qtbot.waitUntil(run_dialog.done_button.isVisible, timeout=100000)
48+
qtbot.waitUntil(lambda: not run_dialog.done_button.isHidden(), timeout=10000)
4849
qtbot.waitUntil(lambda: run_dialog._tab_widget.currentWidget() is not None)
4950
qtbot.mouseClick(run_dialog.done_button, Qt.LeftButton)
5051

51-
# Open the manage experiments dialog
52-
manage_tool = gui.tools["Manage experiments"]
53-
manage_tool.trigger()
54-
55-
assert isinstance(manage_tool, ManageExperimentsTool)
56-
experiments_panel = manage_tool._manage_experiments_panel
52+
button_manage_experiments = gui.findChild(QPushButton, "button_Manage_experiments")
53+
assert button_manage_experiments
54+
qtbot.mouseClick(button_manage_experiments, Qt.LeftButton)
55+
experiments_panel = gui.findChild(ManageExperimentsPanel)
5756
assert experiments_panel
5857

5958
# In the "create new case" tab, it should now contain "iter-1"

0 commit comments

Comments
 (0)