Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Commit

Permalink
chore: move the TEST MODE back off for now and add some more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiyaig committed Dec 13, 2023
1 parent a27d0a1 commit 355506d
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 35 deletions.
2 changes: 1 addition & 1 deletion ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@
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')
self._view_my_profile_button = Button('userContextMenu_ViewMyProfileAction')
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):
Expand All @@ -32,12 +37,6 @@ def profile_image(self):
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()
Expand Down
27 changes: 17 additions & 10 deletions gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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
Expand Down Expand Up @@ -65,37 +65,37 @@ def open_messages_screen(self) -> MessagesScreen:
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:
return self.user_badge_color == '#4ebc60'

@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):
return self.user_badge_color == '#7f8990'

@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):
Expand Down Expand Up @@ -130,9 +130,16 @@ def invite_people_in_community(self, contacts: typing.List[str], message: str, c
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:
Expand Down
1 change: 1 addition & 0 deletions gui/screens/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def is_join_community_visible(self) -> bool:
@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)
Expand Down
2 changes: 1 addition & 1 deletion gui/screens/settings_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def get_keypairs_names(self):
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:
Expand Down
4 changes: 2 additions & 2 deletions tests/communities/test_communities_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tests/communities/test_join_community.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions tests/messages/test_messaging_group_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tests/onboarding/test_onboarding_generate_new_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/onboarding/test_onboarding_import_seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion tests/onboarding/test_onboarding_negative_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/onboarding/test_onboarding_syncing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/online_identifier/test_online_identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
@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

with step('Go to edit profile settings and change the name of the user'):
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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 355506d

Please sign in to comment.