Restart application added (#111)

#110
This commit is contained in:
Vladimir Druzhinin 2023-09-15 10:15:28 +02:00 committed by GitHub
parent e0b5b88199
commit cf8a32f72d
2 changed files with 13 additions and 7 deletions

View File

@ -5,7 +5,6 @@ import squish
import configs import configs
import driver import driver
from configs.system import IS_LIN
from driver import context from driver import context
from driver.server import SquishServer from driver.server import SquishServer
from scripts.utils import system_path, local_system from scripts.utils import system_path, local_system
@ -28,7 +27,8 @@ class AUT:
self.pid = None self.pid = None
self.aut_id = f'AUT_{datetime.now():%H%M%S}' self.aut_id = f'AUT_{datetime.now():%H%M%S}'
self.app_data = configs.testpath.STATUS_DATA / f'app_{datetime.now():%H%M%S_%f}' self.app_data = configs.testpath.STATUS_DATA / f'app_{datetime.now():%H%M%S_%f}'
self.user_data = user_data if user_data is not None:
user_data.copy_to(self.app_data / 'data')
driver.testSettings.setWrappersForApplication(self.aut_id, ['Qt']) driver.testSettings.setWrappersForApplication(self.aut_id, ['Qt'])
def __str__(self): def __str__(self):
@ -64,10 +64,7 @@ class AUT:
local_system.kill_process(self.pid, verify=True) local_system.kill_process(self.pid, verify=True)
@allure.step("Start application") @allure.step("Start application")
def launch(self) -> 'AUT': def launch(self, ) -> 'AUT':
if self.user_data is not None:
self.user_data.copy_to(self.app_data / 'data')
SquishServer().set_aut_timeout() SquishServer().set_aut_timeout()
if configs.ATTACH_MODE: if configs.ATTACH_MODE:
@ -90,3 +87,8 @@ class AUT:
self.pid = self.ctx.pid self.pid = self.ctx.pid
assert squish.waitFor(lambda: self.ctx.isRunning, configs.timeouts.PROCESS_TIMEOUT_SEC) assert squish.waitFor(lambda: self.ctx.isRunning, configs.timeouts.PROCESS_TIMEOUT_SEC)
return self return self
@allure.step('Restart application')
def restart(self):
self.detach().stop()
self.launch()

View File

@ -7,6 +7,7 @@ from allure import step
import configs.timeouts import configs.timeouts
import constants import constants
import driver import driver
from driver.aut import AUT
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
from gui.components.onboarding.welcome_status_popup import WelcomeStatusPopup from gui.components.onboarding.welcome_status_popup import WelcomeStatusPopup
from gui.components.picture_edit_popup import shift_image from gui.components.picture_edit_popup import shift_image
@ -109,7 +110,7 @@ def test_generate_new_keys(main_window, keys_screen, user_name: str, password, u
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703039', 'Import: 12 word seed phrase') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703039', 'Import: 12 word seed phrase')
@pytest.mark.case(703039) @pytest.mark.case(703039)
@pytest.mark.parametrize('user_account', [constants.user.user_account_two]) @pytest.mark.parametrize('user_account', [constants.user.user_account_two])
def test_import_seed_phrase(keys_screen, main_window, user_account): def test_import_seed_phrase(aut: AUT, keys_screen, main_window, user_account):
with step('Open import seed phrase view and enter seed phrase'): with step('Open import seed phrase view and enter seed phrase'):
input_view = keys_screen.open_import_seed_phrase_view().open_seed_phrase_input_view() input_view = keys_screen.open_import_seed_phrase_view().open_seed_phrase_input_view()
profile_view = input_view.input_seed_phrase(user_account.seed_phrase) profile_view = input_view.input_seed_phrase(user_account.seed_phrase)
@ -130,3 +131,6 @@ def test_import_seed_phrase(keys_screen, main_window, user_account):
user_canvas = main_window.left_panel.open_user_canvas() user_canvas = main_window.left_panel.open_user_canvas()
profile_popup = user_canvas.open_profile_popup() profile_popup = user_canvas.open_profile_popup()
assert profile_popup.user_name == user_account.name assert profile_popup.user_name == user_account.name
aut.restart()
main_window.authorize_user(user_account)