Fix/147 test sync device (#157)

* Code was formatted with pep8 recommendations

* Fix attaching squish server config
This commit is contained in:
Vladimir Druzhinin 2023-10-09 19:04:29 +02:00 committed by GitHub
parent 227e20512d
commit e292a0d347
36 changed files with 56 additions and 63 deletions

View File

@ -20,7 +20,6 @@ if system.IS_WIN and 'bin' not in APP_DIR:
exit('Please use launcher from "bin" folder in "APP_DIR"')
APP_DIR = SystemPath(APP_DIR)
# Application will be stuck in test execution if set to False (Mac only)
# We need to investigate more time on it.
ATTACH_MODE = True

View File

@ -7,9 +7,9 @@ from PIL import ImageGrab
import configs
import driver
from fixtures.path import generate_test_info
from scripts.utils import local_system
from scripts.utils.system_path import SystemPath
from fixtures.path import generate_test_info
_logger = logging.getLogger(__name__)

View File

@ -1,5 +1,5 @@
from . import commands
from .colors import *
from .social_links import *
from .tesseract import *
from .user import *
from .social_links import *

View File

@ -46,4 +46,4 @@ boundaries = {
[10, 100, 20],
[25, 255, 255]
]
}
}

View File

@ -1,4 +1,5 @@
from enum import Enum
class GroupChatMessages(Enum):
WELCOME_GROUP_MESSAGE = "Welcome to the beginning of the "

View File

@ -1,2 +1,3 @@
# List of social links
social_links = ['testerTwitter', 'status.im', 'testerGithub', 'testerTube', 'testerDiscord', 'testerTelegram', 'customLink', 'https://status.im/']
social_links = ['testerTwitter', 'status.im', 'testerGithub', 'testerTube', 'testerDiscord', 'testerTelegram',
'customLink', 'https://status.im/']

View File

@ -3,7 +3,6 @@ from copy import deepcopy
import configs.timeouts
import driver
from scripts.utils import local_system
if configs.system.IS_MAC:
from atomacos._a11y import _running_apps_with_bundle_id

View File

@ -9,6 +9,7 @@ from gui.main_window import MainWindow
from scripts.utils import system_path
from scripts.utils.system_path import SystemPath
@pytest.fixture
def application_logs():
yield

View File

@ -19,4 +19,5 @@ def start_squish_server():
pytest.exit(err)
yield squish_server
squish_server.stop()
allure.attach.file('Squish server config', str(squish_server.config))
if squish_server.config.exists():
allure.attach.file(str(squish_server.config), 'Squish server config')

View File

@ -14,7 +14,6 @@ from gui.elements.scroll import Scroll
from gui.elements.text_edit import TextEdit
from gui.screens.community import CommunityScreen
_logger = logging.getLogger(__name__)
@ -80,7 +79,7 @@ class CreateCommunityPopup(BasePopup):
except LookupError as err:
if attempt:
_logger.debug(err)
return self._open_logo_file_dialog(attempt-1)
return self._open_logo_file_dialog(attempt - 1)
else:
raise

View File

@ -1,7 +1,7 @@
import allure
from gui.components.community.authenticate_popup import AuthenticatePopup
from gui.components.base_popup import BasePopup
from gui.components.community.authenticate_popup import AuthenticatePopup
from gui.elements.button import Button
from gui.elements.object import QObject
from gui.elements.text_label import TextLabel

View File

@ -12,4 +12,4 @@ class ContextMenu(QObject):
@allure.step('Select in context menu')
def select(self, value: str):
self._menu_item.real_name['text'] = value
self._menu_item.click()
self._menu_item.click()

View File

@ -1,9 +1,9 @@
import allure
import configs
from .base_popup import BasePopup
from gui.elements.object import QObject
from gui.elements.text_edit import TextEdit
from .base_popup import BasePopup
class EmojiPopup(BasePopup):
@ -22,4 +22,4 @@ class EmojiPopup(BasePopup):
self._search_text_edit.text = name
self._emoji_item.real_name['objectName'] = 'statusEmoji_' + name
self._emoji_item.click()
self._search_text_edit.wait_until_hidden()
self._search_text_edit.wait_until_hidden()

View File

@ -34,7 +34,7 @@ class ProfilePopup(BasePopup):
self._profile_image.image.update_view()
self._profile_image.image.crop(
driver.UiTypes.ScreenRectangle(
15, 15, self._profile_image.image.width-30, self._profile_image.image.height-30
15, 15, self._profile_image.image.width - 30, self._profile_image.image.height - 30
))
return self._profile_image.image

View File

@ -7,7 +7,8 @@ from gui.elements.object import QObject
class ChangesDetectedToastMessage(QObject):
def __init__(self):
super(ChangesDetectedToastMessage, self).__init__('mainWindow_settingsDirtyToastMessage_SettingsDirtyToastMessage')
super(ChangesDetectedToastMessage, self).__init__(
'mainWindow_settingsDirtyToastMessage_SettingsDirtyToastMessage')
self._save_button = Button('settingsSave_StatusButton')
@allure.step('Save changes')

View File

@ -13,4 +13,4 @@ class SigningPhrasePopup(BasePopup):
@allure.step('Confirm signing phrase in popup')
def confirm_phrase(self):
self._ok_got_it_button.click()
SigningPhrasePopup().wait_until_hidden()
SigningPhrasePopup().wait_until_hidden()

View File

@ -3,10 +3,10 @@ import typing
import allure
from .base_popup import BasePopup
from gui.elements.button import Button
from gui.elements.object import QObject
from gui.elements.text_edit import TextEdit
from .base_popup import BasePopup
class SocialLinksPopup(BasePopup):
@ -41,4 +41,3 @@ class SocialLinksPopup(BasePopup):
self._get_text_field(occurrence).text = link
self._add_button.click()
self.wait_until_hidden()

View File

@ -1,7 +1,6 @@
import allure
import configs
from gui.elements.object import QObject

View File

@ -62,6 +62,6 @@ class UserCanvas(QObject):
def is_user_image_contains(self, text: str):
# To remove all artifacts, the image cropped.
crop = driver.UiTypes.ScreenRectangle(
5, 5, self._profile_image.image.width-10, self._profile_image.image.height-10
)
5, 5, self._profile_image.image.width - 10, self._profile_image.image.height - 10
)
return self._profile_image.image.has_text(text, constants.tesseract.text_on_profile_image, crop=crop)

View File

@ -100,4 +100,4 @@ class EditSavedAddressPopup(AddSavedAddressPopup):
self.set_arbitrum_mainnet_network(False)
self._save_add_address_button.click()
self._save_add_address_button.click()
self.wait_until_hidden()
self.wait_until_hidden()

View File

@ -1,8 +1,8 @@
import allure
from gui.elements.button import Button
from gui.elements.text_edit import TextEdit
from gui.elements.object import QObject
from gui.elements.text_edit import TextEdit
class AuthenticatePopup(QObject):

View File

@ -13,4 +13,4 @@ class ConfirmationPopup(QObject):
@allure.step('Confirm action')
def confirm(self):
self._confirm_button.click()
self.wait_until_hidden()
self.wait_until_hidden()

View File

@ -1,5 +1,5 @@
from gui.elements.object import QObject
from gui.elements.button import Button
from gui.elements.object import QObject
class TestnetModeBanner(QObject):

View File

@ -1,14 +1,14 @@
import typing
import allure
from gui.components.wallet.authenticate_popup import AuthenticatePopup
import configs
import constants.wallet
import driver
from gui.components.wallet.back_up_your_seed_phrase_popup import BackUpYourSeedPhrasePopUp
from gui.components.base_popup import BasePopup
from gui.components.emoji_popup import EmojiPopup
from gui.components.wallet.authenticate_popup import AuthenticatePopup
from gui.components.wallet.back_up_your_seed_phrase_popup import BackUpYourSeedPhrasePopUp
from gui.elements.button import Button
from gui.elements.check_box import CheckBox
from gui.elements.object import QObject

View File

@ -412,7 +412,6 @@ class BiometricsView(OnboardingView):
return self._yes_use_touch_id_button.is_visible
class LoginView(QObject):
def __init__(self):

View File

@ -1,12 +1,11 @@
from objectmaphelper import RegularExpression
import time
import typing
import allure
from objectmaphelper import RegularExpression
import configs.timeouts
import driver
from constants import UserCommunityInfo, wallet_account_list_item
from constants.syncing import SyncingSettings
from driver import objects_access
@ -515,7 +514,7 @@ class EditNetworkSettings(WalletSettingsView):
and current_value_failover == self._network_failover_json_rpc_url.text):
assert attempts > 0, "value not reverted"
time.sleep(1)
self.revert_to_default(attempts-1)
self.revert_to_default(attempts - 1)
@allure.step('Get value from Main json rpc input')
def get_edit_network_main_json_rpc_url_value(self):

View File

@ -7,11 +7,11 @@ import constants.user
import driver
from driver.objects_access import walk_children
from gui.components.base_popup import BasePopup
from gui.components.context_menu import ContextMenu
from gui.components.wallet.add_saved_address_popup import AddressPopup, EditSavedAddressPopup
from gui.components.wallet.confirmation_popup import ConfirmationPopup
from gui.components.wallet.remove_wallet_account_popup import RemoveWalletAccountPopup
from gui.components.wallet.wallet_account_popups import AccountPopup
from gui.components.context_menu import ContextMenu
from gui.elements.button import Button
from gui.elements.object import QObject
from gui.elements.text_label import TextLabel

View File

@ -232,4 +232,3 @@ def compare(actual: Image,
else:
raise AssertionError('Images comparison failed')
_logger.info(f'Screenshot comparison passed')

View File

@ -7,4 +7,4 @@ def close_exists(element):
return wrapper
return _wrapper
return _wrapper

View File

@ -50,7 +50,7 @@ def kill_process(pid, verify: bool = False, timeout_sec: int = configs.timeouts.
wait_for_close(pid, timeout_sec)
except RuntimeError as err:
if attempt:
kill_process(pid, verify, timeout_sec, attempt-1)
kill_process(pid, verify, timeout_sec, attempt - 1)
else:
raise err

View File

@ -96,16 +96,16 @@ def test_edit_community_separately(main_screen, community_params):
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703057', 'Edit community')
@pytest.mark.case(703057)
@pytest.mark.parametrize('params', [
{
'name': 'Updated Name',
'description': 'Updated Description',
'logo': {'fp': configs.testpath.TEST_FILES / 'banner.png', 'zoom': None, 'shift': None},
'banner': {'fp': configs.testpath.TEST_FILES / 'tv_signal.png', 'zoom': None, 'shift': None},
'color': '#ff7d46',
'tags': ['Ethereum'],
'intro': 'Updated Intro',
'outro': 'Updated Outro'
}
{
'name': 'Updated Name',
'description': 'Updated Description',
'logo': {'fp': configs.testpath.TEST_FILES / 'banner.png', 'zoom': None, 'shift': None},
'banner': {'fp': configs.testpath.TEST_FILES / 'tv_signal.png', 'zoom': None, 'shift': None},
'color': '#ff7d46',
'tags': ['Ethereum'],
'intro': 'Updated Intro',
'outro': 'Updated Outro'
}
])
def test_edit_community(main_screen: MainWindow, params):
main_screen.create_community(constants.community_params)

View File

@ -5,13 +5,11 @@ import pytest
from allure import step
import configs.timeouts
import driver
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
from gui.components.picture_edit_popup import shift_image
from gui.components.splash_screen import SplashScreen
from gui.screens.onboarding import AllowNotificationsView, WelcomeToStatusView, BiometricsView, KeysView
from scripts.tools import image
_logger = logging.getLogger(__name__)
pytestmark = allure.suite("Onboarding")
@ -49,13 +47,13 @@ def test_generate_new_keys(main_window, keys_screen, user_name: str, password, u
details_view = profile_view.next()
# TODO: temp removing tesseract usage because it is not stable
#if user_image is None:
# if user_image is None:
# assert not details_view.is_user_image_background_white()
# assert driver.waitFor(
# lambda: details_view.is_user_image_contains(user_name[:2]),
# configs.timeouts.UI_LOAD_TIMEOUT_MSEC
# )
#else:
# else:
# image.compare(
# details_view.cropped_profile_image,
# f'{user_image.split(".")[1]}_onboarding.png',
@ -83,11 +81,11 @@ def test_generate_new_keys(main_window, keys_screen, user_name: str, password, u
user_canvas = main_window.left_panel.open_user_canvas()
assert user_canvas.user_name == user_name
# TODO: temp removing tesseract usage because it is not stable
# if user_image is None:
# assert driver.waitFor(
# lambda: user_canvas.is_user_image_contains(user_name[:2]),
# configs.timeouts.UI_LOAD_TIMEOUT_MSEC
# )
# if user_image is None:
# assert driver.waitFor(
# lambda: user_canvas.is_user_image_contains(user_name[:2]),
# configs.timeouts.UI_LOAD_TIMEOUT_MSEC
# )
with step('Open Profile popup and verify user info'):
@ -96,12 +94,12 @@ def test_generate_new_keys(main_window, keys_screen, user_name: str, password, u
assert profile_popup.chat_key == chat_key
assert profile_popup.emoji_hash.compare(emoji_hash.view, threshold=0.9)
# TODO: temp removing tesseract usage because it is not stable
#if user_image is None:
# if user_image is None:
# assert driver.waitFor(
# lambda: profile_popup.is_user_image_contains(user_name[:2]),
# configs.timeouts.UI_LOAD_TIMEOUT_MSEC
# )
#else:
# else:
# image.compare(
# profile_popup.cropped_profile_image,
# f'{user_image.split(".")[1]}_profile.png',

View File

@ -31,7 +31,6 @@ def sync_screen(main_window) -> SyncCodeView:
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703592', 'Sync device during onboarding')
@pytest.mark.case(703592)
@pytest.mark.parametrize('user_data', [configs.testpath.TEST_USER_DATA / 'user_account_one'])
@pytest.mark.skip(reason = "https://github.com/status-im/desktop-qa-automation/issues/147")
def test_sync_device_during_onboarding(multiple_instance, user_data):
user: UserAccount = constants.user_account_one
main_window = MainWindow()
@ -86,10 +85,10 @@ def test_sync_device_during_onboarding(multiple_instance, user_data):
user_canvas_name = user_canvas.user_name
assert user_canvas_name == user.name
# TODO: temp removing tesseract usage because it is not stable
#assert driver.waitFor(
# assert driver.waitFor(
# lambda: user_canvas.is_user_image_contains(user.name[:2]),
# configs.timeouts.UI_LOAD_TIMEOUT_MSEC
#)
# )
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703631', 'Wrong sync code')

View File

@ -11,7 +11,8 @@ from gui.main_window import MainWindow
'Change the password and login with new password')
@pytest.mark.case(703005)
@pytest.mark.parametrize('user_account, user_account_changed_password',
[pytest.param(constants.user.user_account_one, constants.user.user_account_one_changed_password)])
[pytest.param(constants.user.user_account_one,
constants.user.user_account_one_changed_password)])
def test_change_password_and_login(aut: AUT, main_screen: MainWindow, user_account, user_account_changed_password):
with step('Open profile settings and change password'):
main_screen.left_panel.open_settings().left_panel.open_profile_settings().open_change_password_popup().change_password(

View File

@ -7,9 +7,7 @@ from gui.components.back_up_your_seed_phrase_banner import BackUpSeedPhraseBanne
from gui.main_window import MainWindow
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703001','Backup seed phrase')
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703001', 'Backup seed phrase')
@pytest.mark.case(703001)
def test_back_up_seed_phrase(main_screen: MainWindow):
with step('Check back up seed phrase banner is visible for new account'):