diff --git a/tests/functional/test_certification_dialog.py b/tests/functional/test_certification_dialog.py index e6cc8421066afc0339f773c8c1dbb6f76347fedc..a10c086baf097548e8d0c019265d098907da866e 100644 --- a/tests/functional/test_certification_dialog.py +++ b/tests/functional/test_certification_dialog.py @@ -3,9 +3,9 @@ import pytest from duniterpy.documents import Certification from PyQt5.QtCore import QLocale, Qt, QEvent from PyQt5.QtTest import QTest -from PyQt5.QtWidgets import QDialogButtonBox +from PyQt5.QtWidgets import QDialogButtonBox, QMessageBox from sakia.gui.sub.certification.controller import CertificationController -from ..helpers import yes_on_top_message_box +from ..helpers import click_on_top_message_box_button @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) - yes_on_top_message_box() + click_on_top_message_box_button(QMessageBox.Yes) 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 a07b3e42e1b8b5cc528440ff6044ab4f1248406b..b0342e2d88a8f45068939593fbef986b74e9c5bc 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -3,6 +3,13 @@ from PyQt5.QtCore import Qt from PyQt5.QtTest import QTest + +def click_on_top_message_box_button(button): + topWidgets = QApplication.topLevelWidgets() + for w in topWidgets: + if isinstance(w, QMessageBox): + QTest.mouseClick(w.button(button), Qt.LeftButton) + def click_on_top_message_box(): topWidgets = QApplication.topLevelWidgets() for w in topWidgets: