From ddb0f28346b5e4a4d8f3fd5d95a231633d25cdba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Th=C3=B6ni?= <florian.thoni@teamwork.net> Date: Sun, 30 Apr 2017 12:02:06 +0200 Subject: [PATCH] Specific helper for certification To avoid regression on tests for connection_cfg --- tests/functional/test_certification_dialog.py | 4 ++-- tests/helpers.py | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/functional/test_certification_dialog.py b/tests/functional/test_certification_dialog.py index 645ded5a..e6cc8421 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 709a071f..a07b3e42 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: -- GitLab