From c5c47d57e3f3c51e90b94de2ded493ce1f2721a0 Mon Sep 17 00:00:00 2001 From: larsevj Date: Fri, 6 Dec 2024 10:43:21 +0100 Subject: [PATCH] Add test --- .../multiple_data_assimilation_panel.py | 1 + tests/ert/ui_tests/gui/test_restart_esmda.py | 40 ++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/ert/gui/simulation/multiple_data_assimilation_panel.py b/src/ert/gui/simulation/multiple_data_assimilation_panel.py index 27414113553..5e550b41951 100644 --- a/src/ert/gui/simulation/multiple_data_assimilation_panel.py +++ b/src/ert/gui/simulation/multiple_data_assimilation_panel.py @@ -103,6 +103,7 @@ def __init__( self._active_realizations_model, # type: ignore "config/simulation/active_realizations", ) + self._active_realizations_field.setObjectName("active_realizations_box") self._active_realizations_field.setValidator(RangeStringArgument(ensemble_size)) self._ensemble_selector = EnsembleSelector(notifier) layout.addRow("Active realizations:", self._active_realizations_field) diff --git a/tests/ert/ui_tests/gui/test_restart_esmda.py b/tests/ert/ui_tests/gui/test_restart_esmda.py index 05723301520..d21524dc2a4 100644 --- a/tests/ert/ui_tests/gui/test_restart_esmda.py +++ b/tests/ert/ui_tests/gui/test_restart_esmda.py @@ -4,7 +4,7 @@ from ert.gui.ertwidgets import StringBox from ert.gui.simulation.experiment_panel import ExperimentPanel from ert.gui.simulation.run_dialog import RunDialog -from ert.run_models import MultipleDataAssimilation +from ert.run_models import MultipleDataAssimilation, SingleTestRun from .conftest import get_child @@ -40,6 +40,44 @@ def test_restart_esmda(ensemble_experiment_has_run_no_failure, qtbot): ) +def test_active_realizations_esmda(opened_main_window_poly, qtbot): + """This runs an es-mda run from an ensemble created from an ensemble_experiment + run, via the restart feature for es-mda. + Regression test for several issues where this failed only in the gui. + """ + gui = opened_main_window_poly + + experiment_panel = get_child(gui, ExperimentPanel) + simulation_mode_combo = get_child(experiment_panel, QComboBox) + simulation_mode_combo.setCurrentText(SingleTestRun.name()) + + single_test_run_panel = gui.findChild(QWidget, name="Single_test_run_panel") + assert single_test_run_panel + run_experiment = experiment_panel.findChild(QWidget, name="run_experiment") + qtbot.mouseClick(run_experiment, Qt.MouseButton.LeftButton) + qtbot.waitUntil(lambda: gui.findChild(RunDialog) is not None) + run_dialog = gui.findChild(RunDialog) + qtbot.waitUntil(lambda: run_dialog.is_simulation_done() == True, timeout=60000) + assert ( + run_dialog._total_progress_label.text() + == "Total progress 100% — Experiment completed." + ) + + simulation_mode_combo.setCurrentText(MultipleDataAssimilation.name()) + es_mda_panel = gui.findChild(QWidget, name="ES_MDA_panel") + assert es_mda_panel + active_reals = gui.findChild(StringBox, "active_realizations_box") + assert active_reals.text() == "0-19" + + restart_checkbox = es_mda_panel.findChild(QCheckBox, name="restart_checkbox_esmda") + assert restart_checkbox + assert not restart_checkbox.isChecked() + restart_checkbox.click() + assert active_reals.text() == "0" + restart_checkbox.click() + assert active_reals.text() == "0-19" + + def test_custom_weights_stored_and_retrieved_from_metadata_esmda( opened_main_window_minimal_realizations, qtbot ):