chore(@e2e): update test for sharing wallet address

This commit is contained in:
Anastasiya Semenkevich 2024-10-12 16:26:01 +03:00 committed by Anastasiya
parent 03db15529e
commit 748b9b94fc
5 changed files with 123 additions and 173 deletions

View File

@ -1,8 +1,7 @@
import random
import string
from collections import namedtuple
from dataclasses import dataclass
from enum import Enum
from dataclasses import dataclass, field
from typing import Optional
import configs
@ -13,22 +12,26 @@ from scripts.utils.generators import random_name_string, random_password_string
class UserAccount:
name: str = None
password: str = None
seed_phrase: Optional[list] = None
seed_phrase: Optional[list] = field(default_factory=list)
status_address: Optional[str] = None
class RandomUser(UserAccount):
def __init__(self):
self.name = random_name_string()
self.password = random_password_string()
super().__init__(
name=random_name_string(),
password=random_password_string()
)
class ReturningUser(UserAccount):
def __init__(self, seed_phrase, status_address):
self.name = random_name_string()
self.password = random_password_string()
self.seed_phrase = seed_phrase
self.status_address = status_address
super().__init__(
name=random_name_string(),
password=random_password_string(),
seed_phrase=seed_phrase,
status_address=status_address
)
user_account_one = UserAccount('squisher', '0000000000', [
@ -129,7 +132,7 @@ permission_data = [
'second_asset_title': False,
'allowed_to_title': 'Become an admin'
}
]
]
permission_data_member = [
{
@ -172,4 +175,4 @@ permission_data_member = [
'asset_title': '5 BTM',
'allowed_to_title': 'Become member'
}
]
]

View File

@ -1,10 +1,8 @@
import allure
import pyperclip
import configs.timeouts
from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.elements.check_box import CheckBox
from gui.elements.object import QObject
from gui.objects_map import names
@ -13,41 +11,16 @@ class ReceivePopup(BasePopup):
def __init__(self):
super().__init__()
self.eth_icon = QObject(names.networkTagRectangle_eth_Rectangle)
self.oeth_icon = QObject(names.networkTagRectangle_oeth_Rectangle)
self.arb_icon = QObject(names.networkTagRectangle_arb1_Rectangle)
self.multichain_tab_button = Button(names.tabBar_Multichain_StatusSwitchTabButton)
self.legacy_tab_button = Button(names.tabBar_Legacy_StatusSwitchTabButton)
self._account_selector = QObject(names.accountSelector_AccountSelectorHeader)
self._account_selector_text = QObject(names.textContent_StatusBaseText)
self._copy_button = Button(names.greenCircleAroundIcon_Rectangle)
self._edit_button = Button(names.edit_pencil_icon_StatusIcon)
self.account_selector_text = QObject(names.textContent_StatusBaseText)
self.copy_button = Button(names.greenCircleAroundIcon_Rectangle)
self.qr_code = QObject(names.qrCodeImage_Image)
self.mainnet_network_checkbox = CheckBox(names.networkSelectorDelegate_Mainnet_NetworkSelectItemDelegate)
self.optimism_network_checkbox = CheckBox(names.networkSelectorDelegate_Optimism_NetworkSelectItemDelegate)
self.arbitrum_network_checkbox = CheckBox(names.networkSelectorDelegate_Arbitrum_NetworkSelectItemDelegate)
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self.multichain_tab_button.wait_until_appears(timeout_msec)
return self
@allure.step('Click account selector combobox')
def click_account_selector(self):
self._account_selector.click()
return self
@allure.step('Get current text in account selector')
def get_text_from_account_selector(self) -> str:
return str(self._account_selector_text.object.text)
return str(self.account_selector_text.object.text)
@allure.step('Copy address')
def copy_address(self) -> str:
self._copy_button.click()
self.copy_button.click()
return str(pyperclip.paste())
@allure.step('Click edit button')
def edit_networks(self):
self._edit_button.click()
self.mainnet_network_checkbox.wait_until_appears()
return self

View File

@ -517,20 +517,11 @@ send_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow
receive_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "receiveMenuItem", "type": "StatusMenuItem", "visible": True}
# Receive popup
networkTagRectangle_eth_Rectangle = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_eth", "type": "Rectangle", "visible": True}
networkTagRectangle_oeth_Rectangle = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_oeth", "type": "Rectangle", "visible": True}
networkTagRectangle_arb1_Rectangle = {"container": statusDesktop_mainWindow_overlay, "objectName": "networkTagRectangle_arb1", "type": "Rectangle", "visible": True}
tabBar_StatusSwitchTabBar = {"container": statusDesktop_mainWindow_overlay, "id": "tabBar", "type": "StatusSwitchTabBar", "unnamed": 1, "visible": True}
tabBar_Multichain_StatusSwitchTabButton = {"checkable": True, "container": tabBar_StatusSwitchTabBar, "objectName": "multichainButton", "type": "StatusSwitchTabButton", "visible": True}
tabBar_Legacy_StatusSwitchTabButton = {"checkable": True, "container": tabBar_StatusSwitchTabBar, "objectName": "legacyButton", "type": "StatusSwitchTabButton", "visible": True}
accountSelector_AccountSelectorHeader = {"container": statusDesktop_mainWindow_overlay, "objectName": "accountSelector", "type": "AccountSelectorHeader", "visible": True}
textContent_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "objectName": "textContent", "type": "StatusBaseText", "visible": True}
edit_pencil_icon_StatusIcon = {"container": statusDesktop_mainWindow_overlay, "objectName": "edit_pencil-icon", "type": "StatusIcon", "visible": True}
greenCircleAroundIcon_Rectangle = {"container": statusDesktop_mainWindow_overlay, "id": "greenCircleAroundIcon", "type": "Rectangle", "unnamed": 1, "visible": True}
qrCodeImage_Image = {"container": statusDesktop_mainWindow_overlay, "objectName": "qrCodeImage", "type": "Image", "visible": True}
networkSelectorDelegate_Mainnet_NetworkSelectItemDelegate = {"container": statusDesktop_mainWindow_overlay, "index": 0, "objectName": "networkSelectorDelegate_Mainnet", "type": "NetworkSelectItemDelegate", "visible": True}
networkSelectorDelegate_Optimism_NetworkSelectItemDelegate = {"container": statusDesktop_mainWindow_overlay, "index": 1, "objectName": "networkSelectorDelegate_Optimism", "type": "NetworkSelectItemDelegate", "visible": True}
networkSelectorDelegate_Arbitrum_NetworkSelectItemDelegate = {"container": statusDesktop_mainWindow_overlay, "index": 2, "objectName": "networkSelectorDelegate_Arbitrum", "type": "NetworkSelectItemDelegate", "visible": True}
# Bridge popup
holdingSelector_TokenSelectorNew = {"container": statusDesktop_mainWindow_overlay, "objectName": "holdingSelector", "type": "TokenSelectorNew", "visible": True}

View File

@ -8,7 +8,6 @@ import configs
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.asset_context_menu_popup import AssetContextMenuPopup
@ -23,7 +22,6 @@ from gui.elements.list import List
from gui.elements.object import QObject
from gui.elements.text_label import TextLabel
from gui.objects_map import wallet_names, settings_names, names
from scripts.utils.decorators import close_exists
class WalletScreen(QObject):

View File

@ -1,6 +1,9 @@
import allure
import pyperclip
import pytest
from allure_commons._allure import step
from constants.wallet import WalletNetworkSettings
from tests.settings.settings_keycard import marks
from gui.components.signing_phrase_popup import SigningPhrasePopup
@ -13,32 +16,14 @@ pytestmark = marks
@pytest.mark.case(738783)
def test_share_wallet_address(main_screen: MainWindow):
with step('Open wallet and choose default account'):
default_name = 'Account 1'
default_name = WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_NAME.value
wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase()
wallet_account = wallet.left_panel.select_account(default_name)
wallet.left_panel.copy_account_address_in_context_menu(default_name)
wallet_address = pyperclip.paste()
with step('Open receive popup from footer and verify all network icons and qr code are visible'):
receive_popup = wallet_account.open_receive_popup().wait_until_appears()
assert receive_popup.eth_icon.exists
assert receive_popup.oeth_icon.exists
assert receive_popup.arb_icon.exists
assert receive_popup.qr_code.is_visible
with step('Copy address and verify it has correct format'):
assert receive_popup.copy_address().startswith('eth:oeth:arb1:')
with step('Uncheck Mainnet network and verify it has correct format'):
receive_popup.edit_networks().mainnet_network_checkbox.set(False)
receive_popup.qr_code.click()
assert receive_popup.copy_address().startswith('oeth:arb1:')
with step('Uncheck Optimism network and verify it has correct format'):
receive_popup.edit_networks().optimism_network_checkbox.set(False)
receive_popup.qr_code.click()
assert receive_popup.copy_address().startswith('arb1:')
with step('Open Legacy tab, copy address and verify it has correct format and qr code is visible'):
receive_popup.legacy_tab_button.click()
assert receive_popup.copy_address().startswith('0x')
assert receive_popup.qr_code.is_visible
with step('Check QR code and address in Receive modal from footer'):
receive_popup = wallet_account.open_receive_popup()
assert receive_popup.qr_code.is_visible, f'QR code is not present in Receive modal'
assert wallet_address == receive_popup.copy_address(), f'Addresses do not match'