diff --git a/tests/functional/test_certification_dialog.py b/tests/functional/test_certification_dialog.py index 645ded5acacece2d70ecb17c28f849226f7e55a9..e6cc8421066afc0339f773c8c1dbb6f76347fedc 100644 --- a/tests/functional/test_certification_dialog.py +++ b/tests/functional/test_certification_dialog.py @@ -5,7 +5,7 @@ from PyQt5.QtCore import QLocale, Qt, QEvent from PyQt5.QtTest import QTest from PyQt5.QtWidgets import QDialogButtonBox from sakia.gui.sub.certification.controller import CertificationController -from ..helpers import click_on_top_message_box +from ..helpers import yes_on_top_message_box @pytest.mark.asyncio @@ -43,7 +43,7 @@ async def test_certification_init_community(application_with_one_connection, fak assert certification_dialog.view.button_box.button(QDialogButtonBox.Ok).isEnabled() QTest.mouseClick(certification_dialog.view.button_box.button(QDialogButtonBox.Ok), Qt.LeftButton) await asyncio.sleep(0.1) - click_on_top_message_box() + yes_on_top_message_box() await asyncio.sleep(0.2) assert isinstance(fake_server_with_blockchain.forge.pool[0], Certification) diff --git a/tests/helpers.py b/tests/helpers.py index 709a071fbc38e783b849152b7927cda3e91438d2..a07b3e42e1b8b5cc528440ff6044ab4f1248406b 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -7,10 +7,17 @@ def click_on_top_message_box(): topWidgets = QApplication.topLevelWidgets() for w in topWidgets: if isinstance(w, QMessageBox): - QTest.mouseClick(w.button(QMessageBox.Yes), Qt.LeftButton) + QTest.keyClick(w, Qt.Key_Enter) elif isinstance(w, QDialog) and w.windowTitle() == "Registration": QTest.keyClick(w, Qt.Key_Enter) +def yes_on_top_message_box(): + topWidgets = QApplication.topLevelWidgets() + for w in topWidgets: + if isinstance(w, QMessageBox): + QTest.mouseClick(w.button(QMessageBox.Yes), Qt.LeftButton) + + def select_file_dialog(filename): topWidgets = QApplication.topLevelWidgets() for w in topWidgets: