chore: move the TEST MODE back off for now and add some more fixes

This commit is contained in:
Anastasiya Semiankevich 2023-12-13 11:20:56 +03:00 committed by Anastasiya
parent 0573a1ea29
commit 8fe9b4731c
17 changed files with 43 additions and 35 deletions

View File

@ -76,7 +76,7 @@ pipeline {
TESTRAIL_PROJECT_ID = 17
/* Runtime flag to make testing of the app easier. Switched off: unpredictable app behavior under new tests */
STATUS_RUNTIME_TEST_MODE = 'True'
/* STATUS_RUNTIME_TEST_MODE = 'True' */
}
stages {

View File

@ -11,10 +11,10 @@ from gui.elements.object import QObject
from gui.elements.text_label import TextLabel
class UserCanvas(QObject):
class OnlineIdentifier(QObject):
def __init__(self):
super(UserCanvas, self).__init__('o_StatusListView')
super(OnlineIdentifier, self).__init__('o_StatusListView')
self._always_active_button = Button('userContextmenu_AlwaysActiveButton')
self._inactive_button = Button('userContextmenu_InActiveButton')
self._automatic_button = Button('userContextmenu_AutomaticButton')
@ -22,6 +22,11 @@ class UserCanvas(QObject):
self._user_name_text_label = TextLabel('userLabel_StyledText')
self._profile_image = QObject('o_StatusIdenticonRing')
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
driver.waitFor(lambda: self._view_my_profile_button.is_visible, timeout_msec)
return self
@property
@allure.step('Get profile image')
def profile_image(self):
@ -32,12 +37,6 @@ class UserCanvas(QObject):
def user_name(self) -> str:
return self._user_name_text_label.text
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
super(UserCanvas, self).wait_until_appears(timeout_msec)
time.sleep(1)
return self
@allure.step('Set user state online')
def set_user_state_online(self):
self._always_active_button.click()

View File

@ -14,7 +14,7 @@ from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
from gui.components.splash_screen import SplashScreen
from gui.components.toast_message import ToastMessage
from gui.components.user_canvas import UserCanvas
from gui.components.online_identifier import OnlineIdentifier
from gui.elements.button import Button
from gui.elements.object import QObject
from gui.elements.window import Window
@ -65,21 +65,21 @@ class LeftPanel(QObject):
self._messages_button.click()
return MessagesScreen().wait_until_appears()
@allure.step('Open user online identifier')
def open_user_online_identifier(self, attempts: int = 2) -> UserCanvas:
@allure.step('Open online identifier')
def open_online_identifier(self, attempts: int = 2) -> OnlineIdentifier:
time.sleep(0.5)
self._profile_button.click()
try:
return UserCanvas()
return OnlineIdentifier().wait_until_appears()
except Exception as ex:
if attempts:
self.open_user_online_identifier(attempts - 1)
self.open_online_identifier(attempts - 1)
else:
raise ex
@allure.step('Set user to online')
def set_user_to_online(self):
self.open_user_online_identifier().set_user_state_online()
self.open_online_identifier().set_user_state_online()
@allure.step('Verify: User is online')
def user_is_online(self) -> bool:
@ -87,7 +87,7 @@ class LeftPanel(QObject):
@allure.step('Set user to offline')
def set_user_to_offline(self):
self.open_user_online_identifier().set_user_state_offline()
self.open_online_identifier().set_user_state_offline()
@allure.step('Verify: User is offline')
def user_is_offline(self):
@ -95,7 +95,7 @@ class LeftPanel(QObject):
@allure.step('Set user to automatic')
def set_user_to_automatic(self):
self.open_user_online_identifier().set_user_automatic_state()
self.open_online_identifier().set_user_automatic_state()
@allure.step('Verify: User is set to automatic')
def user_is_set_to_automatic(self):
@ -130,9 +130,16 @@ class LeftPanel(QObject):
InviteContactsPopup().wait_until_appears().invite(contacts, message)
@allure.step('Open settings')
def open_settings(self) -> SettingsScreen:
def open_settings(self, attempts: int = 2) -> SettingsScreen:
self._settings_button.click()
return SettingsScreen().wait_until_appears()
time.sleep(0.5)
try:
return SettingsScreen()
except Exception as ex:
if attempts:
self.open_settings(attempts - 1)
else:
raise ex
@allure.step('Open Wallet section')
def open_wallet(self, attempts: int = 2) -> WalletScreen:

View File

@ -201,6 +201,7 @@ class LeftPanel(QObject):
@property
@allure.step('Get channels')
def channels(self) -> typing.List[UserChannel]:
time.sleep(0.5)
channels_list = []
for obj in driver.findAllObjects(self._channel_list_item.real_name):
container = driver.objectMap.realName(obj)

View File

@ -66,7 +66,7 @@ class WalletSettingsView(QObject):
keypair_names = []
for item in driver.findAllObjects(self._wallet_settings_keypair_item.real_name):
keypair_names.append(str(getattr(item, 'title', '')))
if keypair_names == 0:
if len(keypair_names) == 0:
raise LookupError(
'No keypairs found on the wallet settings screen')
else:

View File

@ -70,5 +70,5 @@ def test_delete_community_channel(main_screen):
with step('Delete channel'):
community_screen.delete_channel('general')
with step('Verify channel is not exists'):
assert not community_screen.left_panel.channels
with step('Verify channel list is empty'):
assert len(community_screen.left_panel.channels) == 0

View File

@ -35,7 +35,7 @@ def test_join_community_via_owner_invite(multiple_instance, user_data_one, user_
with step(f'User {user_two.name}, get chat key'):
aut_two.attach()
main_window.prepare()
profile_popup = main_window.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier()
profile_popup = main_window.left_panel.open_online_identifier().open_profile_popup_from_online_identifier()
chat_key = profile_popup.chat_key
profile_popup.close()
main_window.hide()

View File

@ -36,7 +36,7 @@ def test_group_chat(multiple_instance, user_data_one, user_data_two, user_data_t
with step(f'User {user_two.name}, get chat key'):
aut_two.attach()
main_window.prepare()
profile_popup = main_window.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier()
profile_popup = main_window.left_panel.open_online_identifier().open_profile_popup_from_online_identifier()
chat_key = profile_popup.chat_key
profile_popup.close()
main_window.hide()
@ -63,7 +63,7 @@ def test_group_chat(multiple_instance, user_data_one, user_data_two, user_data_t
with step(f'User {user_three.name}, get chat key'):
aut_three.attach()
main_window.prepare()
profile_popup = main_window.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier()
profile_popup = main_window.left_panel.open_online_identifier().open_profile_popup_from_online_identifier()
chat_key = profile_popup.chat_key
profile_popup.close()
main_window.hide()

View File

@ -84,7 +84,7 @@ def test_generate_new_keys(main_window, keys_screen, user_name: str, password, u
with step('Open User Canvas and verify user info'):
user_canvas = main_window.left_panel.open_user_online_identifier()
user_canvas = main_window.left_panel.open_online_identifier()
assert user_canvas.user_name == user_name
# TODO: temp removing tesseract usage because it is not stable
# if user_image is None:

View File

@ -58,7 +58,7 @@ def test_import_seed_phrase(aut: AUT, keys_screen, main_window, user_account, au
f"Recovered account should have address {user_account.status_address}, but has {address}"
with step('Verify that the user logged in via seed phrase correctly'):
user_canvas = main_window.left_panel.open_user_online_identifier()
user_canvas = main_window.left_panel.open_online_identifier()
profile_popup = user_canvas.open_profile_popup_from_online_identifier()
assert profile_popup.user_name == user_account.name

View File

@ -50,7 +50,7 @@ def test_login_with_wrong_password(aut: AUT, keys_screen, main_window, error: st
BetaConsentPopup().confirm()
with step('Verify that the user logged in correctly'):
user_canvas = main_window.left_panel.open_user_online_identifier()
user_canvas = main_window.left_panel.open_online_identifier()
profile_popup = user_canvas.open_profile_popup_from_online_identifier()
assert profile_popup.user_name == user_one.name

View File

@ -86,7 +86,7 @@ def test_sync_device_during_onboarding(multiple_instance, user_data):
BetaConsentPopup().confirm()
with step('Verify user details are the same with user in first instance'):
user_canvas = main_window.left_panel.open_user_online_identifier()
user_canvas = main_window.left_panel.open_online_identifier()
user_canvas_name = user_canvas.user_name
assert user_canvas_name == user.name
# TODO: temp removing tesseract usage because it is not stable

View File

@ -16,7 +16,7 @@ pytestmark = allure.suite("Settings")
@pytest.mark.parametrize('new_name', [pytest.param('NewUserName')])
def test_change_own_display_name(main_screen: MainWindow, user_account, new_name):
with step('Open own profile popup and check name of user is correct'):
profile = main_screen.left_panel.open_user_online_identifier()
profile = main_screen.left_panel.open_online_identifier()
profile_popup = profile.open_profile_popup_from_online_identifier()
assert profile_popup.user_name == user_account.name
@ -24,7 +24,7 @@ def test_change_own_display_name(main_screen: MainWindow, user_account, new_name
profile_popup.edit_profile().set_name(new_name)
with step('Open own profile popup and check name of user is correct'):
assert main_screen.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier().user_name == new_name
assert main_screen.left_panel.open_online_identifier().open_profile_popup_from_online_identifier().user_name == new_name
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703002', 'Switch state to offline')

View File

@ -31,7 +31,7 @@ def test_messaging_settings_accepting_request(multiple_instance, user_data_one,
with step(f'User {user_two.name}, get chat key'):
aut_two.attach()
main_window.prepare()
profile_popup = main_window.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier()
profile_popup = main_window.left_panel.open_online_identifier().open_profile_popup_from_online_identifier()
chat_key = profile_popup.chat_key
profile_popup.close()
main_window.hide()

View File

@ -32,7 +32,7 @@ def test_messaging_settings_identity_verification(multiple_instance, user_data_o
with step(f'User {user_two.name}, get chat key'):
aut_two.attach()
main_window.prepare()
profile_popup = main_window.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier()
profile_popup = main_window.left_panel.open_online_identifier().open_profile_popup_from_online_identifier()
chat_key = profile_popup.chat_key
profile_popup.close()
main_window.hide()

View File

@ -30,7 +30,8 @@ def test_messaging_settings_rejecting_request(multiple_instance, user_data_one,
with step(f'User {user_two.name}, get chat key'):
aut_two.attach()
main_window.prepare()
profile_popup = main_window.left_panel.open_user_online_identifier().open_profile_popup_from_online_identifier()
online_identifier = main_window.left_panel.open_online_identifier()
profile_popup = online_identifier.open_profile_popup_from_online_identifier()
chat_key = profile_popup.chat_key
profile_popup.close()
main_window.hide()

View File

@ -24,6 +24,6 @@ def test_change_password_and_login(aut: AUT, main_screen: MainWindow, user_accou
main_screen.authorize_user(user_account_changed_password)
with step('Verify that the user logged in correctly'):
user_canvas = main_screen.left_panel.open_user_online_identifier()
user_canvas = main_screen.left_panel.open_online_identifier()
profile_popup = user_canvas.open_profile_popup_from_online_identifier()
assert profile_popup.user_name == user_account.name