tests: merge 2 tests into one

This commit is contained in:
Anastasiya Semenkevich 2024-09-10 16:18:10 +03:00 committed by Anastasiya
parent 0a1ebb69bd
commit ef60105c72
5 changed files with 44 additions and 61 deletions

View File

@ -11,12 +11,14 @@ settingsContentBaseScrollView_Flickable = {"container": settingsContentBase_Scro
mainWindow_LeftTabView = {"container": statusDesktop_mainWindow, "type": "LeftTabView", "unnamed": 1, "visible": True} mainWindow_LeftTabView = {"container": statusDesktop_mainWindow, "type": "LeftTabView", "unnamed": 1, "visible": True}
LeftTabView_ScrollView = {"container": mainWindow_LeftTabView, "type": "StatusScrollView", "unnamed": 1, "visible": True} LeftTabView_ScrollView = {"container": mainWindow_LeftTabView, "type": "StatusScrollView", "unnamed": 1, "visible": True}
LeftTabProfileMenu = {"container": LeftTabView_ScrollView, "objectName": "leftTabViewProfileMenu", "type": "MenuPanel", "visible": True} LeftTabProfileMenu = {"container": LeftTabView_ScrollView, "objectName": "leftTabViewProfileMenu", "type": "MenuPanel", "visible": True}
mainWindow_Settings_StatusNavigationPanelHeadline = {"container": mainWindow_LeftTabView, "type": "StatusNavigationPanelHeadline", "unnamed": 1, "visible": True} mainWindow_Settings_StatusNavigationPanelHeadline = {"container": mainWindow_LeftTabView, "type": "StatusNavigationPanelHeadline", "unnamed": 1, "visible": True}
mainWindow_scrollView_StatusScrollView = {"container": mainWindow_LeftTabView, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True} mainWindow_scrollView_StatusScrollView = {"container": mainWindow_LeftTabView, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
scrollView_MenuItem_StatusNavigationListItem = {"container": mainWindow_scrollView_StatusScrollView, "type": "StatusNavigationListItem", "visible": True} scrollView_MenuItem_StatusNavigationListItem = {"container": mainWindow_scrollView_StatusScrollView, "type": "StatusNavigationListItem", "visible": True}
scrollView_Flickable = {"container": mainWindow_scrollView_StatusScrollView, "type": "Flickable", "unnamed": 1, "visible": True} scrollView_Flickable = {"container": mainWindow_scrollView_StatusScrollView, "type": "Flickable", "unnamed": 1, "visible": True}
settingsBackUpSeedPhraseOption = {"container": mainWindow_scrollView_StatusScrollView, "objectName": "18-MainMenuItem", "type": "StatusNavigationListItem", "visible": True} settingsBackUpSeedPhraseOption = {"container": mainWindow_scrollView_StatusScrollView, "objectName": "18-MainMenuItem", "type": "StatusNavigationListItem", "visible": True}
settingsWalletOption = {"container": LeftTabView_ScrollView, "objectName": "5-AppMenuItem", "type": "StatusNavigationListItem", "visible": True} settingsWalletOption = {"container": LeftTabView_ScrollView, "objectName": "5-AppMenuItem", "type": "StatusNavigationListItem", "visible": True}
settingsSignOutQuitOption = {"container": LeftTabProfileMenu, "objectName": "17-ExtraMenuItem", "type": "StatusNavigationListItem", "visible": True}
# Communities View # Communities View
mainWindow_CommunitiesView = {"container": statusDesktop_mainWindow, "type": "CommunitiesView", "unnamed": 1, "visible": True} mainWindow_CommunitiesView = {"container": statusDesktop_mainWindow, "type": "CommunitiesView", "unnamed": 1, "visible": True}

View File

@ -26,7 +26,8 @@ class LeftPanel(QObject):
self._settings_section_template = QObject(settings_names.scrollView_MenuItem_StatusNavigationListItem) self._settings_section_template = QObject(settings_names.scrollView_MenuItem_StatusNavigationListItem)
self._scroll = Scroll(settings_names.mainWindow_scrollView_StatusScrollView) self._scroll = Scroll(settings_names.mainWindow_scrollView_StatusScrollView)
self.settings_section_back_up_seed_option = QObject(settings_names.settingsBackUpSeedPhraseOption) self.settings_section_back_up_seed_option = QObject(settings_names.settingsBackUpSeedPhraseOption)
self._settings_section_wallet_option = QObject(settings_names.settingsWalletOption) self.settings_section_wallet_option = QObject(settings_names.settingsWalletOption)
self.settings_section_sign_out_quit_option = QObject(settings_names.settingsSignOutQuitOption)
@allure.step('Wait until appears {0}') @allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
@ -84,7 +85,7 @@ class LeftPanel(QObject):
@allure.step('Choose sign out and quit in settings') @allure.step('Choose sign out and quit in settings')
@handle_settings_opening(SignOutPopup, '17-ExtraMenuItem') @handle_settings_opening(SignOutPopup, '17-ExtraMenuItem')
def open_sign_out_and_quit(self, click_attempts: int = 2) -> 'SignOutPopup': def open_sign_out_and_quit(self, click_attempts: int = 2) -> 'SignOutPopup':
assert SignOutPopup().exists, 'Sign out modal was not opened' assert SignOutPopup().wait_until_appears(), 'Sign out modal was not opened'
return SignOutPopup() return SignOutPopup()
@allure.step('Open keycard settings') @allure.step('Open keycard settings')

View File

@ -1,11 +1,13 @@
import random import random
import string
import allure import allure
import pytest import pytest
from allure import step from allure import step
import constants import constants
import driver
from constants import RandomUser
from gui.components.back_up_your_seed_phrase_banner import BackUpSeedPhraseBanner
from tests.onboarding import marks from tests.onboarding import marks
import configs.timeouts import configs.timeouts
@ -13,7 +15,7 @@ from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
from gui.components.picture_edit_popup import shift_image, PictureEditPopup from gui.components.picture_edit_popup import shift_image, PictureEditPopup
from gui.components.splash_screen import SplashScreen from gui.components.splash_screen import SplashScreen
from gui.screens.onboarding import WelcomeToStatusView, BiometricsView, KeysView, \ from gui.screens.onboarding import WelcomeToStatusView, BiometricsView, \
YourEmojihashAndIdenticonRingView YourEmojihashAndIdenticonRingView
pytestmark = marks pytestmark = marks
@ -23,22 +25,20 @@ pytestmark = marks
@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_account',
[
pytest.param(
RandomUser())
])
@pytest.mark.parametrize('user_image, zoom, shift', [
pytest.param( pytest.param(
''.join((random.choice( random.choice(['sample_JPEG_1920×1280.jpeg', 'file_example_PNG_3MB.png', 'file_example_JPG_2500kB.jpg']
string.ascii_letters + string.digits + random.choice('_- ')) ),
for i in range(5, 25)) random.choice(range(1, 11, )),
).strip(' '),
''.join((random.choice(
string.ascii_letters + string.digits + string.punctuation)
for _ in range(10, 28))
),
random.choice(['sample_JPEG_1920×1280.jpeg', 'file_example_PNG_3MB.png', 'file_example_JPG_2500kB.jpg']),
5,
shift_image(0, 1000, 1000, 0)) shift_image(0, 1000, 1000, 0))
]) ])
def test_generate_new_keys_sign_out_from_settings(aut, main_window, user_name: str, password, def test_generate_account_back_up_seed_sign_out(aut, main_window, user_account,
user_image: str, zoom: int, shift): user_image: str, zoom: int, shift):
with step('Click generate new keys and open profile view'): with step('Click generate new keys and open profile view'):
BeforeStartedPopUp().get_started() BeforeStartedPopUp().get_started()
keys_screen = WelcomeToStatusView().wait_until_appears().get_keys() keys_screen = WelcomeToStatusView().wait_until_appears().get_keys()
@ -48,8 +48,8 @@ def test_generate_new_keys_sign_out_from_settings(aut, main_window, user_name: s
f'Next button is enabled on profile screen when it should not' f'Next button is enabled on profile screen when it should not'
with step('Type in the display name on the profile view'): with step('Type in the display name on the profile view'):
profile_view.set_display_name(user_name) profile_view.set_display_name(user_account.name)
assert profile_view.get_display_name() == user_name, \ assert profile_view.get_display_name() == user_account.name, \
f'Display name is empty or was not filled in' f'Display name is empty or was not filled in'
assert not profile_view.get_error_message, \ assert not profile_view.get_error_message, \
f'Error message {profile_view.get_error_message} is present when it should not' f'Error message {profile_view.get_error_message} is present when it should not'
@ -65,7 +65,7 @@ def test_generate_new_keys_sign_out_from_settings(aut, main_window, user_name: s
create_password_view = profile_view.next() create_password_view = profile_view.next()
assert not create_password_view.is_create_password_button_enabled, \ assert not create_password_view.is_create_password_button_enabled, \
f'Create password button is enabled when it should not' f'Create password button is enabled when it should not'
confirm_password_view = create_password_view.create_password(password) confirm_password_view = create_password_view.create_password(user_account.password)
confirm_password_view.back() confirm_password_view.back()
assert create_password_view.get_password_from_first_field is not None, \ assert create_password_view.get_password_from_first_field is not None, \
f'Password field lost its value when clicking back button' f'Password field lost its value when clicking back button'
@ -78,7 +78,7 @@ def test_generate_new_keys_sign_out_from_settings(aut, main_window, user_name: s
f'Finalise Status password creation button is enabled when it should not' f'Finalise Status password creation button is enabled when it should not'
with step('Confirm password and login'): with step('Confirm password and login'):
confirm_password_view.confirm_password(password) confirm_password_view.confirm_password(user_account.password)
if configs.system.get_platform() == "Darwin": if configs.system.get_platform() == "Darwin":
assert BiometricsView().is_touch_id_button_visible(), f"TouchID button is not found" assert BiometricsView().is_touch_id_button_visible(), f"TouchID button is not found"
BiometricsView().wait_until_appears().prefer_password() BiometricsView().wait_until_appears().prefer_password()
@ -105,8 +105,8 @@ def test_generate_new_keys_sign_out_from_settings(aut, main_window, user_name: s
with step('Open online identifier and check the data'): with step('Open online identifier and check the data'):
online_identifier = main_window.left_panel.open_online_identifier() online_identifier = main_window.left_panel.open_online_identifier()
assert online_identifier.get_user_name == user_name, \ assert online_identifier.get_user_name == user_account.name, \
f'Display name in online identifier is wrong, current: {online_identifier.get_user_name}, expected: {user_name}' f'Display name in online identifier is wrong, current: {online_identifier.get_user_name}, expected: {user_account.name}'
assert online_identifier._identicon_ring.is_visible, \ assert online_identifier._identicon_ring.is_visible, \
f'Identicon ring is not present when it should' f'Identicon ring is not present when it should'
assert str(online_identifier.object.pubkey) is not None, \ assert str(online_identifier.object.pubkey) is not None, \
@ -117,8 +117,8 @@ def test_generate_new_keys_sign_out_from_settings(aut, main_window, user_name: s
profile_popup = online_identifier.open_profile_popup_from_online_identifier() profile_popup = online_identifier.open_profile_popup_from_online_identifier()
profile_popup_user_name = profile_popup.user_name profile_popup_user_name = profile_popup.user_name
profile_popup_chat_key = profile_popup.copy_chat_key profile_popup_chat_key = profile_popup.copy_chat_key
assert profile_popup_user_name == user_name, \ assert profile_popup_user_name == user_account.name, \
f'Display name in user profile is wrong, current: {profile_popup_user_name}, expected: {user_name}' f'Display name in user profile is wrong, current: {profile_popup_user_name}, expected: {user_account.name}'
assert profile_popup_chat_key == chat_key, \ assert profile_popup_chat_key == chat_key, \
f'Chat key in user profile is wrong, current: {profile_popup_chat_key}, expected: {chat_key}' f'Chat key in user profile is wrong, current: {profile_popup_chat_key}, expected: {chat_key}'
assert profile_popup.get_emoji_hash == emoji_hash_public_key, \ assert profile_popup.get_emoji_hash == emoji_hash_public_key, \
@ -136,6 +136,21 @@ def test_generate_new_keys_sign_out_from_settings(aut, main_window, user_name: s
with step('Click left panel and open settings'): with step('Click left panel and open settings'):
main_window.left_panel.click() main_window.left_panel.click()
settings = main_window.left_panel.open_settings() settings = main_window.left_panel.open_settings()
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"
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().is_back_up_now_button_present(), 'Back up now button is not present'
with step('Open back up seed phrase in settings'):
back_up = settings.left_panel.open_back_up_seed_phrase()
back_up.back_up_seed_phrase()
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"
if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BackUpSeedPhraseBanner().wait_to_hide_the_banner()
assert not BackUpSeedPhraseBanner().does_back_up_seed_banner_exist(), "Back up seed banner is present"
with step('Click sign out and quit in settings'): with step('Click sign out and quit in settings'):
sign_out_screen = settings.left_panel.open_sign_out_and_quit() sign_out_screen = settings.left_panel.open_sign_out_and_quit()

View File

@ -1,35 +0,0 @@
import allure
import pytest
from allure_commons._allure import step
import driver
from tests.settings import marks
import configs
from gui.components.back_up_your_seed_phrase_banner import BackUpSeedPhraseBanner
from gui.main_window import MainWindow
pytestmark = marks
@pytest.mark.critical
@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 option is visible for new account'):
settings = main_screen.left_panel.open_settings()
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"
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().is_back_up_now_button_present(), 'Back up now button is not present'
with step('Open back up seed phrase in settings'):
back_up = settings.left_panel.open_back_up_seed_phrase()
back_up.back_up_seed_phrase()
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"
if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BackUpSeedPhraseBanner().wait_to_hide_the_banner()
assert not BackUpSeedPhraseBanner().does_back_up_seed_banner_exist(), "Back up seed banner is present"

View File

@ -3,7 +3,7 @@ import pytest
from allure_commons._allure import step from allure_commons._allure import step
from constants import UserAccount, RandomUser from constants import UserAccount, RandomUser
from scripts.utils.generators import random_name_string, random_password_string from scripts.utils.generators import random_name_string
from . import marks from . import marks
import constants import constants