Skip to content
Snippets Groups Projects
Commit ddb0f283 authored by Florian Thöni's avatar Florian Thöni
Browse files

Specific helper for certification

To avoid regression on tests for connection_cfg
parent 3c3013b8
Branches
Tags
1 merge request!684READY:Test helpers : Message box, click yes vs enter
......@@ -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)
......
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment