test: default account values in send, bridge, receive popups

This commit is contained in:
Valentina Novgorodtceva 2024-07-25 11:10:22 +07:00
parent ff005a219a
commit cc4c3cca76
12 changed files with 227 additions and 0 deletions

View File

@ -0,0 +1,27 @@
import time
import allure
import configs
import driver
from gui.components.base_popup import BasePopup
from gui.components.wallet.send_popup import SendPopup
from gui.elements.object import QObject
from gui.objects_map import names
class AssetContextMenuPopup(BasePopup):
def __init__(self):
super(AssetContextMenuPopup, self).__init__()
self._send_item = QObject(names.send_StatusMenuItem)
self._receive_item = QObject(names.receive_StatusMenuItem)
@allure.step('Click send item')
def click_send_item(self):
self._send_item.click()
return SendPopup().wait_until_appears()
@allure.step('Click receive item')
def click_receive_item(self):
self._receive_item.click()
return self

View File

@ -0,0 +1,34 @@
import allure
import configs.timeouts
from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.elements.object import QObject
from gui.objects_map import names
class BridgePopup(BasePopup):
def __init__(self):
super().__init__()
self._select_token_combobox = QObject(names.holdingSelector_TokenSelectorNew)
self._bridge_header = QObject(names.modalHeader_HeaderTitleText)
self._account_selector = QObject(names.accountSelector_AccountSelectorHeader)
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self._select_token_combobox.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 from header')
def get_text_from_bridge_header(self) -> str:
return str(self._bridge_header.object.text)
@allure.step('Get current text in account selector')
def get_text_from_account_selector(self) -> str:
return str(self._account_selector.object.currentText)

View File

@ -0,0 +1,33 @@
import allure
import configs.timeouts
from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.elements.object import QObject
from gui.objects_map import names
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._account_selector = QObject(names.accountSelector_AccountSelectorHeader)
self._account_selector_text = QObject(names.textContent_StatusBaseText)
@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)

View File

@ -32,6 +32,16 @@ class SendPopup(BasePopup):
self._mainnet_network = QObject(names.mainnet_StatusListItem) self._mainnet_network = QObject(names.mainnet_StatusListItem)
self._fiat_fees_label = TextLabel(names.fiatFees_StatusBaseText) self._fiat_fees_label = TextLabel(names.fiatFees_StatusBaseText)
self._send_button = Button(names.send_StatusFlatButton) self._send_button = Button(names.send_StatusFlatButton)
self._account_selector = QObject(names.accountSelector_AccountSelectorHeader)
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self._ens_address_text_edit.wait_until_appears(timeout_msec)
return self
@allure.step('Get current text in account selector')
def get_text_from_account_selector(self) -> str:
return str(self._account_selector.object.currentText)
@allure.step('Select asset or collectible by name') @allure.step('Select asset or collectible by name')
def _select_asset_or_collectible(self, name: str, tab: str, attempts: int = 2): def _select_asset_or_collectible(self, name: str, tab: str, attempts: int = 2):

View File

@ -513,6 +513,23 @@ send_StatusFlatButton = {"checkable": False, "container": statusDesktop_mainWind
o_SearchBoxWithRightIcon = {"container": statusDesktop_mainWindow_overlay, "type": "SearchBoxWithRightIcon", "unnamed": 1, "visible": True} o_SearchBoxWithRightIcon = {"container": statusDesktop_mainWindow_overlay, "type": "SearchBoxWithRightIcon", "unnamed": 1, "visible": True}
search_TextEdit = {"container": o_SearchBoxWithRightIcon, "id": "edit", "type": "TextEdit", "unnamed": 1, "visible": True} search_TextEdit = {"container": o_SearchBoxWithRightIcon, "id": "edit", "type": "TextEdit", "unnamed": 1, "visible": True}
# Assets Context Menu popup
send_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "sendMenuItem", "type": "StatusMenuItem", "visible": True}
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}
accountSelector_AccountSelectorHeader = {"container": statusDesktop_mainWindow_overlay, "objectName": "accountSelector", "type": "AccountSelectorHeader", "visible": True}
textContent_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "objectName": "textContent", "type": "StatusBaseText", "visible": True}
# Bridge popup
holdingSelector_TokenSelectorNew = {"container": statusDesktop_mainWindow_overlay, "objectName": "holdingSelector", "type": "TokenSelectorNew", "visible": True}
modalHeader_HeaderTitleText = {"container": statusDesktop_mainWindow_overlay, "objectName": "modalHeader", "type": "HeaderTitleText", "visible": True}
# Verify identity popup # Verify identity popup
profileSendContactRequestModal_sayWhoYouAreInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileSendContactRequestModal_sayWhoYouAreInput", "type": "TextEdit", "visible": True} profileSendContactRequestModal_sayWhoYouAreInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileSendContactRequestModal_sayWhoYouAreInput", "type": "TextEdit", "visible": True}
send_verification_request_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "ProfileSendContactRequestModal_sendContactRequestButton", "type": "StatusButton", "visible": True} send_verification_request_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "ProfileSendContactRequestModal_sendContactRequestButton", "type": "StatusButton", "visible": True}

View File

@ -27,6 +27,8 @@ savedAddresses_area = {"container": mainWindow_SavedAddressesView_2, "objectName
mainWindow_RightTabView = {"container": statusDesktop_mainWindow, "type": "RightTabView", "unnamed": 1, "visible": True} mainWindow_RightTabView = {"container": statusDesktop_mainWindow, "type": "RightTabView", "unnamed": 1, "visible": True}
mainWallet_Account_Name = {"container": mainWindow_RightTabView, "objectName": "walletHeaderTitle", "type": "StatusBaseText", "visible": True} mainWallet_Account_Name = {"container": mainWindow_RightTabView, "objectName": "walletHeaderTitle", "type": "StatusBaseText", "visible": True}
mainWindow_Send_Button = {"container": statusDesktop_mainWindow, "objectName": "walletFooterSendButton", "type": "StatusFlatButton", "visible": True} mainWindow_Send_Button = {"container": statusDesktop_mainWindow, "objectName": "walletFooterSendButton", "type": "StatusFlatButton", "visible": True}
mainWindow_Receive_Button = {"checkable": False, "container": statusDesktop_mainWindow, "objectName": "walletFooterReceiveButton", "type": "StatusFlatButton", "visible": True}
mainWindow_Bridge_Button = {"checkable": False, "container": statusDesktop_mainWindow, "objectName": "walletFooterBridgeButton", "type": "StatusFlatButton", "visible": True}
mainWindow_RightTabView = {"container": statusDesktop_mainWindow, "type": "RightTabView", "unnamed": 1, "visible": True} mainWindow_RightTabView = {"container": statusDesktop_mainWindow, "type": "RightTabView", "unnamed": 1, "visible": True}
filterButton_StatusFlatButton = {"checkable": True, "container": mainWindow_RightTabView, "objectName": "filterButton", "type": "StatusFlatButton", "visible": True} filterButton_StatusFlatButton = {"checkable": True, "container": mainWindow_RightTabView, "objectName": "filterButton", "type": "StatusFlatButton", "visible": True}
cmbTokenOrder_SortOrderComboBox = {"container": mainWindow_RightTabView, "objectName": "cmbTokenOrder", "type": "SortOrderComboBox", "visible": True} cmbTokenOrder_SortOrderComboBox = {"container": mainWindow_RightTabView, "objectName": "cmbTokenOrder", "type": "SortOrderComboBox", "visible": True}

View File

@ -10,7 +10,10 @@ from driver.objects_access import walk_children
from gui.components.base_popup import BasePopup from gui.components.base_popup import BasePopup
from gui.components.context_menu import ContextMenu from gui.components.context_menu import ContextMenu
from gui.components.wallet.add_saved_address_popup import AddressPopup, EditSavedAddressPopup from gui.components.wallet.add_saved_address_popup import AddressPopup, EditSavedAddressPopup
from gui.components.wallet.asset_context_menu_popup import AssetContextMenuPopup
from gui.components.wallet.bridge_popup import BridgePopup
from gui.components.wallet.confirmation_popup import ConfirmationPopup from gui.components.wallet.confirmation_popup import ConfirmationPopup
from gui.components.wallet.receive_popup import ReceivePopup
from gui.components.wallet.remove_wallet_account_popup import RemoveWalletAccountPopup from gui.components.wallet.remove_wallet_account_popup import RemoveWalletAccountPopup
from gui.components.wallet.send_popup import SendPopup from gui.components.wallet.send_popup import SendPopup
from gui.components.wallet.wallet_account_popups import AccountPopup from gui.components.wallet.wallet_account_popups import AccountPopup
@ -196,6 +199,8 @@ class WalletAccountView(QObject):
self._account_name_text_label = TextLabel(wallet_names.mainWallet_Account_Name) self._account_name_text_label = TextLabel(wallet_names.mainWallet_Account_Name)
self._addresses_panel = QObject(names.mainWallet_Address_Panel) self._addresses_panel = QObject(names.mainWallet_Address_Panel)
self._send_button = Button(wallet_names.mainWindow_Send_Button) self._send_button = Button(wallet_names.mainWindow_Send_Button)
self._receive_button = Button(wallet_names.mainWindow_Receive_Button)
self._bridge_button = Button(wallet_names.mainWindow_Bridge_Button)
self._filter_button = Button(wallet_names.filterButton_StatusFlatButton) self._filter_button = Button(wallet_names.filterButton_StatusFlatButton)
self._assets_combobox = List(wallet_names.cmbTokenOrder_SortOrderComboBox) self._assets_combobox = List(wallet_names.cmbTokenOrder_SortOrderComboBox)
self._assets_tab_button = Button(wallet_names.rightSideWalletTabBar_Assets_StatusTabButton) self._assets_tab_button = Button(wallet_names.rightSideWalletTabBar_Assets_StatusTabButton)
@ -224,6 +229,16 @@ class WalletAccountView(QObject):
self._send_button.click() self._send_button.click()
return SendPopup().wait_until_appears() return SendPopup().wait_until_appears()
@allure.step('Open bridge popup')
def open_bridge_popup(self) -> BridgePopup:
self._bridge_button.click()
return BridgePopup().wait_until_appears()
@allure.step('Open receive popup')
def open_receive_popup(self) -> ReceivePopup:
self._receive_button.click()
return ReceivePopup().wait_until_appears()
@allure.step('Open assets tab') @allure.step('Open assets tab')
def open_assets_tab(self): def open_assets_tab(self):
self._assets_tab_button.click() self._assets_tab_button.click()
@ -271,6 +286,11 @@ class WalletAccountView(QObject):
sorted(token_list_items, key=lambda item: item.y) sorted(token_list_items, key=lambda item: item.y)
return token_list_items return token_list_items
@allure.step('Open asset context menu')
def open_asset_context_menu(self, index: int):
QObject(real_name=driver.objectMap.realName(self.get_list_of_assets()[index])).right_click()
return AssetContextMenuPopup().wait_until_appears()
@allure.step('Get list of collectibles') @allure.step('Get list of collectibles')
def get_list_of_collectibles(self) -> typing.List: def get_list_of_collectibles(self) -> typing.List:
time.sleep(1) time.sleep(1)

View File

@ -0,0 +1,73 @@
import allure
import pytest
from allure_commons._allure import step
import configs
import constants
import driver
from constants.wallet import WalletTransactions
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
from gui.components.onboarding.beta_consent_popup import BetaConsentPopup
from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.components.splash_screen import SplashScreen
from gui.components.authenticate_popup import AuthenticatePopup
from gui.screens.onboarding import KeysView, WelcomeToStatusView, BiometricsView, YourEmojihashAndIdenticonRingView
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704527',
'Send: can send 0 ETH to address pasted into receiver field with Simple flow')
@pytest.mark.case(704527)
@pytest.mark.transaction
@pytest.mark.parametrize('default_name, address, name, color, emoji', [
pytest.param('Account 1', '0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A', 'AccWatch1', '#2a4af5', 'sunglasses')
])
def test_wallet_modals_default_account_values(main_screen, default_name, address, name, color, emoji):
with step('Add watched address with plus action button'):
wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase()
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_watched_address(address).save_changes()
account_popup.wait_until_hidden()
with step('Change account order to have watched account first'):
account_order = main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_account_order()
account_order.drag_account(name, 0)
with step('Open wallet and choose default account'):
wallet = main_screen.left_panel.open_wallet()
wallet_account = wallet.left_panel.select_account(default_name)
with step('Verify that default account is chosen in send, receive and bridge popups opened from footer'):
send_popup = wallet_account.open_send_popup().wait_until_appears()
assert send_popup.get_text_from_account_selector() == default_name
main_screen.left_panel.click()
bridge_popup = wallet_account.open_bridge_popup().wait_until_appears()
assert bridge_popup.get_text_from_account_selector() == default_name
main_screen.left_panel.click()
receive_popup = wallet_account.open_receive_popup().wait_until_appears()
assert receive_popup.get_text_from_account_selector() == default_name
main_screen.left_panel.click()
with step('Verify that default account is chosen in send, receive and bridge popups opened from asset context menu'):
wallet_account.open_asset_context_menu(0).click_send_item()
assert send_popup.get_text_from_account_selector() == default_name
main_screen.left_panel.click()
wallet_account.open_asset_context_menu(0).click_receive_item()
assert receive_popup.get_text_from_account_selector() == default_name
main_screen.left_panel.click()
with step('Choose watched account'):
wallet_account = wallet.left_panel.select_account(name)
with step('Verify that watched account is chosen in receive popup'):
receive_popup = wallet_account.open_receive_popup().wait_until_appears()
assert receive_popup.get_text_from_account_selector() == name
main_screen.left_panel.click()
with step('Verify that watched account is chosen in receive popup opened from asset context menu'):
wallet_account.open_asset_context_menu(0).click_receive_item()
assert receive_popup.get_text_from_account_selector() == name
main_screen.left_panel.click()

View File

@ -114,6 +114,7 @@ Rectangle {
} }
StatusFlatButton { StatusFlatButton {
objectName: "walletFooterReceiveButton"
icon.name: "receive" icon.name: "receive"
text: qsTr("Receive") text: qsTr("Receive")
visible: d.receiveActionAvailable visible: d.receiveActionAvailable
@ -124,6 +125,7 @@ Rectangle {
} }
StatusFlatButton { StatusFlatButton {
objectName: "walletFooterBridgeButton"
icon.name: "bridge" icon.name: "bridge"
text: qsTr("Bridge") text: qsTr("Bridge")
interactive: !d.isCollectibleSoulbound && networkConnectionStore.sendBuyBridgeEnabled interactive: !d.isCollectibleSoulbound && networkConnectionStore.sendBuyBridgeEnabled
@ -134,6 +136,7 @@ Rectangle {
StatusFlatButton { StatusFlatButton {
id: buySellBtn id: buySellBtn
objectName: "walletFooterBuyButton"
visible: d.buyActionAvailable visible: d.buyActionAvailable
icon.name: "token" icon.name: "token"
@ -143,6 +146,7 @@ Rectangle {
StatusFlatButton { StatusFlatButton {
id: swap id: swap
objectName: "walletFooterSwapButton"
interactive: !d.isCollectibleSoulbound && networkConnectionStore.sendBuyBridgeEnabled interactive: !d.isCollectibleSoulbound && networkConnectionStore.sendBuyBridgeEnabled
visible: d.swapActionAvailable visible: d.swapActionAvailable

View File

@ -188,9 +188,11 @@ StatusModal {
currentIndex: 1 currentIndex: 1
StatusSwitchTabButton { StatusSwitchTabButton {
objectName: "legacyButton"
text: qsTr("Legacy") text: qsTr("Legacy")
} }
StatusSwitchTabButton { StatusSwitchTabButton {
objectName: "multichainButton"
text: qsTr("Multichain") text: qsTr("Multichain")
} }
} }
@ -232,6 +234,7 @@ StatusModal {
Image { Image {
id: qrCodeImage id: qrCodeImage
objectName: "qrCodeImage"
anchors.centerIn: parent anchors.centerIn: parent
height: parent.height height: parent.height
width: parent.width width: parent.width

View File

@ -333,6 +333,7 @@ StatusDialog {
HeaderTitleText { HeaderTitleText {
id: modalHeader id: modalHeader
objectName: "modalHeader"
Layout.maximumWidth: contentWidth Layout.maximumWidth: contentWidth
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
text: d.isBridgeTx ? qsTr("Bridge") : qsTr("Send") text: d.isBridgeTx ? qsTr("Bridge") : qsTr("Send")
@ -340,6 +341,7 @@ StatusDialog {
TokenSelectorNew { TokenSelectorNew {
id: holdingSelector id: holdingSelector
objectName: "holdingSelector"
property var selectedItem property var selectedItem
property bool onlyAssets: false property bool onlyAssets: false

View File

@ -20,6 +20,7 @@ StatusMenu {
signal manageTokensRequested signal manageTokensRequested
StatusAction { StatusAction {
objectName: "sendMenuItem"
enabled: root.sendEnabled enabled: root.sendEnabled
visibleOnDisabled: true visibleOnDisabled: true
icon.name: "send" icon.name: "send"
@ -27,6 +28,7 @@ StatusMenu {
onTriggered: root.sendRequested() onTriggered: root.sendRequested()
} }
StatusAction { StatusAction {
objectName: "receiveMenuItem"
icon.name: "receive" icon.name: "receive"
text: qsTr("Receive") text: qsTr("Receive")
onTriggered: root.receiveRequested() onTriggered: root.receiveRequested()