chore: make tests running for dev build and update marks (#16033)

This commit is contained in:
Anastasiya 2024-08-08 18:25:10 +03:00 committed by GitHub
parent 111fd63035
commit eb128d6a97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 44 additions and 46 deletions

View File

@ -7,6 +7,5 @@ def get_platform():
DISPLAY = os.getenv('DISPLAY', ':0') DISPLAY = os.getenv('DISPLAY', ':0')
TEST_MODE = os.getenv('STATUS_RUNTIME_TEST_MODE') TEST_MODE = os.getenv('STATUS_RUNTIME_TEST_MODE')

View File

@ -1,5 +1,4 @@
import logging import logging
from datetime import datetime
import os import os
import allure import allure

View File

@ -190,7 +190,7 @@ class MainWindow(Window):
if configs.system.get_platform() == "Darwin": if configs.system.get_platform() == "Darwin":
AllowNotificationsView().start_using_status() AllowNotificationsView().start_using_status()
SplashScreen().wait_until_appears().wait_until_hidden() SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BetaConsentPopup().confirm() BetaConsentPopup().confirm()
if share_updates_popup.exists: if share_updates_popup.exists:
share_updates_popup.skip() share_updates_popup.skip()
@ -201,7 +201,7 @@ class MainWindow(Window):
share_updates_popup = ShareUsageDataPopup() share_updates_popup = ShareUsageDataPopup()
LoginView().log_in(user_account) LoginView().log_in(user_account)
SplashScreen().wait_until_appears().wait_until_hidden() SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BetaConsentPopup().confirm() BetaConsentPopup().confirm()
if share_updates_popup.exists: if share_updates_popup.exists:
share_updates_popup.skip() share_updates_popup.skip()

View File

@ -1,9 +1,6 @@
import time
import allure import allure
import configs.system import configs.system
import driver
from gui.components.back_up_your_seed_phrase_popup import BackUpYourSeedPhrasePopUp from gui.components.back_up_your_seed_phrase_popup import BackUpYourSeedPhrasePopUp
from gui.elements.object import QObject from gui.elements.object import QObject
from gui.elements.scroll import Scroll from gui.elements.scroll import Scroll
@ -18,26 +15,8 @@ from gui.screens.settings_syncing import SyncingSettingsView
from gui.screens.settings_wallet import WalletSettingsView from gui.screens.settings_wallet import WalletSettingsView
from gui.screens.settings_password import ChangePasswordView from gui.screens.settings_password import ChangePasswordView
from gui.components.settings.sign_out_popup import SignOutPopup from gui.components.settings.sign_out_popup import SignOutPopup
from functools import wraps
from scripts.utils.decorators import handle_settings_opening
def handle_settings_opening(view_class, menu_item):
def open_settings_decorator(func):
@wraps(func)
def wrapper(self, click_attempts=2):
self._open_settings(menu_item)
try:
return func(self)
except (LookupError, AssertionError) as ex:
if click_attempts:
return func(self, click_attempts - 1)
else:
raise ex
return wrapper
return open_settings_decorator
class LeftPanel(QObject): class LeftPanel(QObject):

View File

@ -1,3 +1,6 @@
from functools import wraps
def close_exists(element): def close_exists(element):
def _wrapper(method_to_decorate): def _wrapper(method_to_decorate):
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
@ -8,3 +11,22 @@ def close_exists(element):
return wrapper return wrapper
return _wrapper return _wrapper
def handle_settings_opening(view_class, menu_item):
def open_settings_decorator(func):
@wraps(func)
def wrapper(self, click_attempts=2):
self._open_settings(menu_item)
try:
return func(self)
except (LookupError, AssertionError) as ex:
if click_attempts:
return func(self, click_attempts - 1)
else:
raise ex
return wrapper
return open_settings_decorator

View File

@ -78,7 +78,7 @@ def test_create_community(user_account, main_screen: MainWindow, params):
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703057', 'Edit community') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703057', 'Edit community')
@pytest.mark.case(703057) @pytest.mark.case(703057)
# @pytest.mark.critical TODO: fix creation of community https://github.com/status-im/desktop-qa-automation/issues/658 @pytest.mark.critical
@pytest.mark.parametrize('params', [ @pytest.mark.parametrize('params', [
{ {
'name': 'Updated Name', 'name': 'Updated Name',
@ -245,7 +245,6 @@ def test_community_admin_ban_kick_member_and_delete_message(multiple_instances,
10000), 'Join community button not hidden' 10000), 'Join community button not hidden'
main_screen.hide() main_screen.hide()
with step(f'User {user_two.name}, kick {user_one.name} from the community'): with step(f'User {user_two.name}, kick {user_one.name} from the community'):
aut_two.attach() aut_two.attach()
main_screen.prepare() main_screen.prepare()

View File

@ -22,6 +22,7 @@ pytestmark = marks
'second_channel_description, second_channel_emoji', 'second_channel_description, second_channel_emoji',
[pytest.param('Category in general', True, 'Channel', 'Description', 'sunglasses', 'Second-channel', [pytest.param('Category in general', True, 'Channel', 'Description', 'sunglasses', 'Second-channel',
'Description', 'sunglasses')]) 'Description', 'sunglasses')])
@pytest.mark.critical
def test_create_edit_remove_community_category(main_screen: MainWindow, category_name, general_checkbox, channel_name, def test_create_edit_remove_community_category(main_screen: MainWindow, category_name, general_checkbox, channel_name,
channel_description, channel_emoji, second_channel_name, second_channel_description, channel_description, channel_emoji, second_channel_name, second_channel_description,
second_channel_emoji): second_channel_emoji):

View File

@ -48,7 +48,7 @@ def test_mint_owner_token(keys_screen, main_window, user_account):
if configs.system.get_platform() == "Darwin": if configs.system.get_platform() == "Darwin":
next_view.start_using_status() next_view.start_using_status()
SplashScreen().wait_until_appears().wait_until_hidden() SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BetaConsentPopup().confirm() BetaConsentPopup().confirm()
with step('Enable creation of community option'): with step('Enable creation of community option'):

View File

@ -208,7 +208,6 @@ def test_add_edit_and_remove_permissions(main_screen: MainWindow, params):
@pytest.mark.parametrize('params', [constants.community_params]) @pytest.mark.parametrize('params', [constants.community_params])
@pytest.mark.critical
def test_add_5_member_role_permissions(main_screen: MainWindow, params): def test_add_5_member_role_permissions(main_screen: MainWindow, params):
with step('Enable creation of community option'): with step('Enable creation of community option'):
settings = main_screen.left_panel.open_settings() settings = main_screen.left_panel.open_settings()

View File

@ -23,6 +23,7 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703087', '1-1 Chat') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703087', '1-1 Chat')
@pytest.mark.case(703087) @pytest.mark.case(703087)
@pytest.mark.critical
def test_1x1_chat(multiple_instances): def test_1x1_chat(multiple_instances):
user_one: UserAccount = constants.user_with_random_attributes_1 user_one: UserAccount = constants.user_with_random_attributes_1
user_two: UserAccount = constants.user_with_random_attributes_2 user_two: UserAccount = constants.user_with_random_attributes_2

View File

@ -30,7 +30,7 @@ def keys_screen(main_window) -> KeysView:
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703421', 'Generate new keys') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703421', 'Generate new keys')
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703010', 'Settings - Sign out & Quit') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703010', 'Settings - Sign out & Quit')
@pytest.mark.case(703421, 703010) @pytest.mark.case(703421, 703010)
@pytest.mark.critical # TODO 'https://github.com/status-im/status-desktop/issues/13013' @pytest.mark.critical # TODO 'https://github.com/status-im/status-desktop/issues/13013'
@pytest.mark.parametrize('user_name, password, user_image, zoom, shift', [ @pytest.mark.parametrize('user_name, password, user_image, zoom, shift', [
pytest.param( pytest.param(
''.join((random.choice( ''.join((random.choice(
@ -100,7 +100,7 @@ def test_generate_new_keys_sign_out_from_settings(aut, main_window, keys_screen,
if configs.system.get_platform() == "Darwin": if configs.system.get_platform() == "Darwin":
next_view.start_using_status() next_view.start_using_status()
SplashScreen().wait_until_appears().wait_until_hidden() SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BetaConsentPopup().confirm() BetaConsentPopup().confirm()
with step('Verify that user avatar background color'): with step('Verify that user avatar background color'):

View File

@ -52,7 +52,7 @@ def test_import_seed_phrase(keys_screen, main_window, aut: AUT, user_account, de
if configs.system.get_platform() == "Darwin": if configs.system.get_platform() == "Darwin":
next_view.start_using_status() next_view.start_using_status()
SplashScreen().wait_until_appears().wait_until_hidden() SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BetaConsentPopup().confirm() BetaConsentPopup().confirm()
with (step('Verify that restored account reveals correct status wallet address')): with (step('Verify that restored account reveals correct status wallet address')):

View File

@ -52,7 +52,7 @@ def test_login_with_wrong_password(aut: AUT, keys_screen, main_window, error: st
if configs.system.get_platform() == "Darwin": if configs.system.get_platform() == "Darwin":
next_view.start_using_status() next_view.start_using_status()
SplashScreen().wait_until_appears().wait_until_hidden() SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BetaConsentPopup().confirm() BetaConsentPopup().confirm()
with step('Verify that the user logged in correctly'): with step('Verify that the user logged in correctly'):

View File

@ -89,7 +89,7 @@ def test_sync_device_during_onboarding(multiple_instances):
if configs.system.get_platform() == "Darwin": if configs.system.get_platform() == "Darwin":
AllowNotificationsView().start_using_status() AllowNotificationsView().start_using_status()
SplashScreen().wait_until_appears().wait_until_hidden() SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BetaConsentPopup().confirm() BetaConsentPopup().confirm()
with step('Verify user details are the same with user in first instance'): with step('Verify user details are the same with user in first instance'):

View File

@ -35,7 +35,7 @@ def test_switch_testnet_mode(main_screen: MainWindow):
message = main_screen.wait_for_notification()[0] message = main_screen.wait_for_notification()[0]
assert message == WalletNetworkSettings.TESTNET_ENABLED_TOAST_MESSAGE.value, \ assert message == WalletNetworkSettings.TESTNET_ENABLED_TOAST_MESSAGE.value, \
f"Toast message is incorrect, current message is {message}" f"Toast message is incorrect, current message is {message}"
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
TestnetModeBanner().wait_until_appears() TestnetModeBanner().wait_until_appears()
assert networks.is_testnet_mode_toggle_checked(), f"Testnet toggle if off when it should not" assert networks.is_testnet_mode_toggle_checked(), f"Testnet toggle if off when it should not"
@ -56,7 +56,7 @@ def test_switch_testnet_mode(main_screen: MainWindow):
message = main_screen.wait_for_notification()[1] message = main_screen.wait_for_notification()[1]
assert message == WalletNetworkSettings.TESTNET_DISABLED_TOAST_MESSAGE.value, \ assert message == WalletNetworkSettings.TESTNET_DISABLED_TOAST_MESSAGE.value, \
f"Toast message is incorrect, current message is {message}" f"Toast message is incorrect, current message is {message}"
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
TestnetModeBanner().wait_until_hidden() TestnetModeBanner().wait_until_hidden()
assert not networks.is_testnet_mode_toggle_checked(), f"Testnet toggle is on when it should not" assert not networks.is_testnet_mode_toggle_checked(), f"Testnet toggle is on when it should not"
@ -83,7 +83,7 @@ def test_toggle_testnet_toggle_on_and_close_the_confirmation(main_screen: MainWi
with step('Verify that Testnet mode is not turned off'): with step('Verify that Testnet mode is not turned off'):
assert not ToastMessage().is_visible assert not ToastMessage().is_visible
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
assert not TestnetModeBanner().is_visible, f"Testnet banner is present when it should not" assert not TestnetModeBanner().is_visible, f"Testnet banner is present when it should not"
assert not networks.is_testnet_mode_toggle_checked(), \ assert not networks.is_testnet_mode_toggle_checked(), \
f"Testnet toggle is turned on when it should not" f"Testnet toggle is turned on when it should not"
@ -110,7 +110,7 @@ def test_switch_testnet_off_by_toggle_and_cancel_in_confirmation(main_screen: Ma
message = main_screen.wait_for_notification()[0] message = main_screen.wait_for_notification()[0]
assert message == WalletNetworkSettings.TESTNET_ENABLED_TOAST_MESSAGE.value, \ assert message == WalletNetworkSettings.TESTNET_ENABLED_TOAST_MESSAGE.value, \
f"Toast message is incorrect, current message is {message}" f"Toast message is incorrect, current message is {message}"
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
assert TestnetModeBanner().wait_until_appears(), f"Testnet banner is not present when it should" assert TestnetModeBanner().wait_until_appears(), f"Testnet banner is not present when it should"
assert networks.is_testnet_mode_toggle_checked(), f"testnet toggle is off" assert networks.is_testnet_mode_toggle_checked(), f"testnet toggle is off"
@ -123,5 +123,5 @@ def test_switch_testnet_off_by_toggle_and_cancel_in_confirmation(main_screen: Ma
assert networks.is_testnet_mode_toggle_checked(), f"Testnet toggle is turned OFF when it should not" assert networks.is_testnet_mode_toggle_checked(), f"Testnet toggle is turned OFF when it should not"
with step('Verify that Testnet mode is not turned off'): with step('Verify that Testnet mode is not turned off'):
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
assert TestnetModeBanner().wait_until_appears(), f"Testnet banner is not present when it should" assert TestnetModeBanner().wait_until_appears(), f"Testnet banner is not present when it should"

View File

@ -53,7 +53,7 @@ def test_ens_name_purchase(keys_screen, main_window, user_account, ens_name):
if configs.system.get_platform() == "Darwin": if configs.system.get_platform() == "Darwin":
next_view.start_using_status() next_view.start_using_status()
SplashScreen().wait_until_appears().wait_until_hidden() SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BetaConsentPopup().confirm() BetaConsentPopup().confirm()
with step('Set testnet mode'): with step('Set testnet mode'):

View File

@ -20,7 +20,7 @@ def test_back_up_seed_phrase(main_screen: MainWindow):
settings = main_screen.left_panel.open_settings() settings = main_screen.left_panel.open_settings()
assert driver.waitFor(lambda: settings.left_panel.settings_section_back_up_seed_option.wait_until_appears, assert driver.waitFor(lambda: settings.left_panel.settings_section_back_up_seed_option.wait_until_appears,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f"Back up seed option is not present" configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f"Back up seed option is not present"
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
assert BackUpSeedPhraseBanner().does_back_up_seed_banner_exist(), "Back up seed banner is not present" assert BackUpSeedPhraseBanner().does_back_up_seed_banner_exist(), "Back up seed banner is not present"
assert BackUpSeedPhraseBanner().is_back_up_now_button_present(), 'Back up now button is not present' assert BackUpSeedPhraseBanner().is_back_up_now_button_present(), 'Back up now button is not present'
@ -30,6 +30,6 @@ def test_back_up_seed_phrase(main_screen: MainWindow):
with step('Verify back up seed phrase banner disappeared'): with step('Verify back up seed phrase banner disappeared'):
assert not settings.left_panel.settings_section_back_up_seed_option.exists, f"Back up seed option is present" assert not settings.left_panel.settings_section_back_up_seed_option.exists, f"Back up seed option is present"
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BackUpSeedPhraseBanner().wait_to_hide_the_banner() BackUpSeedPhraseBanner().wait_to_hide_the_banner()
assert not BackUpSeedPhraseBanner().does_back_up_seed_banner_exist(), "Back up seed banner is present" assert not BackUpSeedPhraseBanner().does_back_up_seed_banner_exist(), "Back up seed banner is present"

View File

@ -51,7 +51,7 @@ def test_wallet_send_0_eth(keys_screen, main_window, user_account, receiver_acco
if configs.system.get_platform() == "Darwin": if configs.system.get_platform() == "Darwin":
next_view.start_using_status() next_view.start_using_status()
SplashScreen().wait_until_appears().wait_until_hidden() SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BetaConsentPopup().confirm() BetaConsentPopup().confirm()
with step('Verify that restored account reveals correct status wallet address'): with step('Verify that restored account reveals correct status wallet address'):

View File

@ -51,7 +51,7 @@ def test_wallet_send_nft(keys_screen, main_window, user_account, tab, receiver_a
if configs.system.get_platform() == "Darwin": if configs.system.get_platform() == "Darwin":
next_view.start_using_status() next_view.start_using_status()
SplashScreen().wait_until_appears().wait_until_hidden() SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE: if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BetaConsentPopup().confirm() BetaConsentPopup().confirm()
with step('Set testnet mode'): with step('Set testnet mode'):

View File

@ -15,7 +15,6 @@ from gui.main_window import MainWindow
pytestmark = marks pytestmark = marks
@pytest.mark.critical
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703100', @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703100',
'Manage a watch-only account from context menu option') 'Manage a watch-only account from context menu option')
@pytest.mark.case(703100) @pytest.mark.case(703100)