chore: Mock keycard option added in start AUT (#261)

#260
This commit is contained in:
Vladimir Druzhinin 2023-11-06 12:31:34 +01:00 committed by GitHub
parent 24e9a11544
commit 8ac0133de0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 7 deletions

1
constants/aut_options.py Normal file
View File

@ -0,0 +1 @@
MOCK_KEYCARD = '--test-mode=1'

View File

@ -31,6 +31,7 @@ class AUT:
self.app_data = configs.testpath.STATUS_DATA / f'app_{datetime.now():%H%M%S_%f}'
if user_data is not None:
user_data.copy_to(self.app_data / 'data')
self.options = ''
driver.testSettings.setWrappersForApplication(self.aut_id, ['Qt'])
def __str__(self):
@ -76,7 +77,8 @@ class AUT:
self.pid = None
@allure.step("Start application")
def launch(self, attempt: int = 2) -> 'AUT':
def launch(self, options='', attempt: int = 2) -> 'AUT':
self.options = options
try:
self.port = local_system.find_free_port(configs.squish.AUT_PORT, 1000)
if configs.ATTACH_MODE:
@ -85,7 +87,8 @@ class AUT:
configs.testpath.SQUISH_DIR / 'bin' / 'startaut',
f'--port={self.port}',
f'"{self.path}"',
f'-d={self.app_data}'
f'-d={self.app_data}',
options
]
self.pid = local_system.execute(command)
else:
@ -101,7 +104,7 @@ class AUT:
_logger.debug(err)
self.stop()
if attempt:
return self.launch(attempt-1)
return self.launch(options, attempt - 1)
else:
raise err

View File

@ -10,6 +10,13 @@ from scripts.utils import system_path
from scripts.utils.system_path import SystemPath
@pytest.fixture
def options(request):
if hasattr(request, 'param'):
return request.param
return ''
@pytest.fixture
def application_logs():
yield
@ -47,8 +54,8 @@ def multiple_instance():
@pytest.fixture
def main_window(aut: AUT, user_data):
aut.launch()
def main_window(aut: AUT, user_data, options):
aut.launch(options)
yield MainWindow().wait_until_appears().prepare()
aut.stop()

View File

@ -20,6 +20,6 @@ class Button(QObject):
):
if None not in (x, y, button):
getattr(self.object, 'clicked')()
_logger.info(f'{self}: clicked')
else:
super(Button, self).click(x, y, button)
_logger.info(f'{self}: clicked')

View File

@ -4,7 +4,7 @@ from allure import step
import configs
import driver
from constants import ColorCodes
from constants import ColorCodes, aut_options
from constants.keycard import Keycard
from gui.main_window import MainWindow
from gui.mocked_keycard_controller import MockedKeycardController