Skip to content

Commit

Permalink
test: Renabled test case for Simple transaction
Browse files Browse the repository at this point in the history
fixes #7983
  • Loading branch information
Khushboo-dev-cpp authored and alaibe committed Nov 18, 2022
1 parent da6524b commit 2427795
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 35 deletions.
2 changes: 2 additions & 0 deletions test/ui-test/src/screens/SettingsScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ def check_tenor_gif_preview_is_enabled(self):
verify(tenorSwitch.enabled, "Tenor GIFs preview is enabled")

def toggle_test_networks(self):
# needed cause if we do it immmediately the toggle doesn't work
time.sleep(2)
click_obj_by_name(WalletSettingsScreen.NETWORKS_ITEM.value)
click_obj_by_name(WalletSettingsScreen.TESTNET_TOGGLE.value)

Expand Down
43 changes: 26 additions & 17 deletions test/ui-test/src/screens/StatusWalletScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class MainWalletScreen(Enum):
RIGHT_SIDE_TABBAR: str = "mainWallet_Right_Side_Tab_Bar"
MAILSERVER_RETRY: str = "mailserver_retry"
FIRST_ACCOUNT_ITEM: str = "firstWalletAccount_Item"
EPHEMERAL_NOTIFICATION_LIST: str = "mainWallet_Ephemeral_Notification_List"
TOTAL_CURRENCY_BALANCE: str = "mainWallet_totalCurrencyBalance"

class AssetView(Enum):
LIST: str = "mainWallet_Assets_View_List"
Expand All @@ -48,12 +50,10 @@ class SendPopup(Enum):
SCROLL_BAR: str = "mainWallet_Send_Popup_Main"
HEADER_ACCOUNTS_LIST: str = "mainWallet_Send_Popup_Header_Accounts"
AMOUNT_INPUT: str = "mainWallet_Send_Popup_Amount_Input"
GAS_PRICE_INPUT: str = "mainWallet_Send_Popup_GasPrice_Input"
MY_ACCOUNTS_TAB: str = "mainWallet_Send_Popup_My_Accounts_Tab"
MY_ACCOUNTS_LIST: str = "mainWallet_Send_Popup_My_Accounts_List"
NETWORKS_LIST: str = "mainWallet_Send_Popup_Networks_List"
SEND_BUTTON: str = "mainWallet_Send_Popup_Send_Button"
PASSWORD_INPUT: str = "mainWallet_Send_Popup_Password_Input"
ASSET_SELECTOR: str = "mainWallet_Send_Popup_Asset_Selector"
ASSET_LIST: str = "mainWallet_Send_Popup_Asset_List"
HIGH_GAS_BUTTON: str = "mainWallet_Send_Popup_GasSelector_HighGas_Button"
Expand Down Expand Up @@ -184,11 +184,12 @@ def verify_account_name_is_present(self, account_name: str):
click_obj_by_name(AddAccountPopup.ADD_ACCOUNT_BUTTON.value)

def send_transaction(self, account_name, amount, token, chain_name, password):
# TODO wait for balance to update
# Maybe needs a fix on the app itself. Make the Send modal be responsive to when the balance updates
time.sleep(2)
click_obj_by_name(MainWalletScreen.SEND_BUTTON_FOOTER.value)

list = get_obj(AssetView.LIST.value)
squish.waitFor("list.count > 0", 60*1000*2)
squish.waitFor("float(str(list.itemAtIndex(0).balance)) > 0", 60*1000*2)

self._click_repeater(SendPopup.HEADER_ACCOUNTS_LIST.value, account_name)
time.sleep(1)
type(SendPopup.AMOUNT_INPUT.value, amount)
Expand All @@ -207,22 +208,27 @@ def send_transaction(self, account_name, amount, token, chain_name, password):
accounts = get_obj(SendPopup.MY_ACCOUNTS_LIST.value)
for index in range(accounts.count):
if(accounts.itemAtIndex(index).objectName == account_name):
print("WE FOUND THE ACCOUNT")
click_obj(accounts.itemAtIndex(index))
break

time.sleep(5)

scroll_obj_by_name(SendPopup.SCROLL_BAR.value)
time.sleep(1)
time.sleep(5)
o = get_obj(SendPopup.SEND_BUTTON.value)
print("TESTING")
print(o.objectName)
print(o.visible)

self._click_repeater(SendPopup.NETWORKS_LIST.value, chain_name)

# With the simulator, the gas price estimation doesn't work
type(SendPopup.GAS_PRICE_INPUT.value, "20")

click_obj_by_name(SendPopup.SEND_BUTTON.value)

type(SendPopup.PASSWORD_INPUT.value, password)
click_obj_by_name(SendPopup.SEND_BUTTON.value)

o = get_obj(SendPopup.SEND_BUTTON.value)
print(o.objectName)
print(o.visible)

wait_for_object_and_type(SharedPopup.PASSWORD_INPUT.value, password)

click_obj_by_name(SharedPopup.PRIMARY_BUTTON.value)

def _click_repeater(self, repeater_object_name: str, object_name: str):
repeater = get_obj(repeater_object_name)
for index in range(repeater.count):
Expand Down Expand Up @@ -350,7 +356,10 @@ def verify_saved_address_doesnt_exist(self, name: str):
verify_failure(f'FAIL: saved address {name} exists')

def verify_transaction(self):
print("TODO: fix notification and ensure there is one")
pass
# ephemeral_notification_list = get_obj(MainWalletScreen.EPHEMERAL_NOTIFICATION_LIST.value)
# squish.waitFor("ephemeral_notification_list.count > 0", 60*1000)
# verify(str(ephemeral_notification_list.itemAtIndex(0).primaryText ) == "Transaction pending...", "Tx was not sent!")

def verify_collectibles_exist(self, account_name: str):
tabbar = get_obj(MainWalletScreen.RIGHT_SIDE_TABBAR.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SettingsSubsection(Enum):
# Main:
navBarListView_Settings_navbar_StatusNavBarTabButton = {"checkable": True, "container": mainWindow_navBarListView_ListView, "objectName": "Settings-navbar", "type": "StatusNavBarTabButton", "visible": True}
settingsSave_StatusButton = {"container": statusDesktop_mainWindow, "objectName": "settingsDirtyToastMessageSaveButton", "type": "StatusButton", "visible": True}
settings_Sidebar_ENS_Item = {"container": mainWindow_ScrollView, "objectName": "ENS usernames-MainMenu", "type": "StatusNavigationListItem"}
settings_Sidebar_ENS_Item = {"container": mainWindow_ScrollView, "objectName": SettingsSubsection.ENS_USERNAMES.value, "type": "StatusNavigationListItem"}

# ENS view;
settings_ENS_Start_Button = {"container": statusDesktop_mainWindow, "objectName": "ensStartButton", "type": "StatusButton"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
mainWallet_Saved_Addresses_Button = {"container": statusDesktop_mainWindow, "objectName": "savedAddressesBtn", "type": "StatusButton"}
mainWallet_Network_Selector_Button = {"container": statusDesktop_mainWindow, "objectName": "networkSelectorButton", "type": "StatusListItem"}
mainWallet_Right_Side_Tab_Bar = {"container": statusDesktop_mainWindow, "objectName": "rightSideWalletTabBar", "type": "StatusTabBar"}
mainWallet_Ephemeral_Notification_List = {"container": statusDesktop_mainWindow, "objectName": "ephemeralNotificationList", "type": "StatusListView"}

mailserver_dialog = {"container": statusDesktop_mainWindow_overlay, "objectName": "mailserverConnectionDialog", "type": "StatusDialog"}
mailserver_retry = {"container": mailserver_dialog, "objectName": "mailserverConnectionDialog_retryButton", "type": "StatusButton"}
Expand All @@ -25,6 +26,7 @@
mainWallet_Network_Popup_Chain_Repeater_1 = {"container": statusDesktop_mainWindow, "objectName": "networkSelectPopupChainRepeaterLayer1", "type": "Repeater"}

# Send popup:
mainWallet_totalCurrencyBalance = {"container": statusDesktop_mainWindow, "objectName": "walletLeftListAmountValue", "type": "StyledTextEdit"}
mainWallet_Footer_Send_Button = {"container": statusDesktop_mainWindow, "objectName": "walletFooterSendButton", "type": "StatusFlatButton"}
mainWallet_Send_Popup_Main = {"container": statusDesktop_mainWindow, "objectName": "sendModalScroll", "type": "StatusScrollView"}
mainWallet_Send_Popup_Amount_Input = {"container": statusDesktop_mainWindow, "objectName": "amountInput", "type": "TextEdit"}
Expand All @@ -33,7 +35,6 @@
mainWallet_Send_Popup_Header_Accounts = {"container": statusDesktop_mainWindow, "objectName": "accountsListFloatingHeader", "type": "Repeater"}
mainWallet_Send_Popup_Networks_List = {"container": statusDesktop_mainWindow, "objectName": "networksList", "type": "Repeater"}
mainWallet_Send_Popup_Send_Button = {"container": statusDesktop_mainWindow, "objectName": "sendModalFooterSendButton", "type": "StatusFlatButton"}
mainWallet_Send_Popup_Password_Input = {"container": statusDesktop_mainWindow, "objectName": "transactionSignerPasswordInput", "type": "StyledTextField"}
mainWallet_Send_Popup_Asset_Selector = {"container": statusDesktop_mainWindow, "objectName": "assetSelectorButton", "type": "StatusComboBox"}
mainWallet_Send_Popup_Asset_List = {"container": statusDesktop_mainWindow, "objectName": "assetSelectorList", "type": "StatusListView"}
mainWallet_Send_Popup_GasPrice_Input = {"container": statusDesktop_mainWindow, "objectName": "gasPriceSelectorInput", "type": "StyledTextField"}
Expand Down
2 changes: 2 additions & 0 deletions test/ui-test/testSuites/suite_wallet/suite.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
AUT=nim_status_client
ENVVARS=envvars
HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAPSTYLE=script
TEST_CASES=tst_wallet tst_transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
def hook(context):
common_init_steps.context_init(context)
common_init_steps.signs_up_with_seed_phrase_process_steps(context, _seed_phrase, _user, _password)
wallet_init_steps.enable_wallet_section()
wallet_init_steps.toggle_test_networks()
wallet_init_steps.activate_and_open_wallet()

@OnFeatureEnd
def hook(context):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@ Feature: Status Desktop Transaction
** and the user opens wallet screen
** and the user accepts the signing phrase

Background: Navigation to main wallet screen
# Background: Navigation to main wallet screen
# Given the user opens wallet screen
# And the user clicks on the first account

Given the user opens wallet screen
And the user clicks on the first account

@mayfail
Scenario Outline: The user sends a transaction
Then the user has a positive balance of "ETH"
When the user sends a transaction to himself from account "Status account" of "<amount>" "<token>" on "<chain_name>" with password "qqqqqqqqqq"
Then the transaction is in progress

Examples:
| amount | token | chain_name |
| 1 | ETH | Goerli |
| 0 | ETH | Goerli |
| 1 | STT | Goerli |
| 0 | STT | Goerli |
| 0.1 | ETH | Goerli |
#| 0 | ETH | Goerli |
#| 1 | STT | Goerli |
#| 0 | STT | Goerli |

@mayfail
Scenario: The user registers an ENS name
Expand Down
1 change: 1 addition & 0 deletions ui/app/AppLayouts/Wallet/views/LeftTabView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Rectangle {

StyledTextEdit {
id: walletAmountValue
objectName: "walletLeftListAmountValue"
color: Style.current.textColor
text: {
Utils.toLocaleString(parseFloat(RootStore.totalCurrencyBalance).toFixed(2), localAppSettings.language, {"currency": true}) + " " + RootStore.currentCurrency.toUpperCase()
Expand Down
1 change: 1 addition & 0 deletions ui/app/mainui/AppMain.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,7 @@ Item {

StatusListView {
id: toastArea
objectName: "ephemeralNotificationList"
anchors.right: parent.right
anchors.rightMargin: 8
anchors.bottom: parent.bottom
Expand Down
15 changes: 10 additions & 5 deletions ui/imports/shared/popups/SendModal.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ StatusDialog {
standardButtons: StandardButton.Ok
}

Connections {
target: store.currentAccount.assets
onModelReset: {
popup.selectedAccount = null
popup.selectedAccount = store.currentAccount
}
}

property var sendTransaction: function() {
let recipientAddress = Utils.isValidAddress(popup.addressText) ? popup.addressText : d.resolvedENSAddress
d.isPendingTx = true
Expand Down Expand Up @@ -76,10 +84,7 @@ StatusDialog {

QtObject {
id: d
readonly property double maxFiatBalance: {
console.error(assetSelector.selectedAsset.name," >>> recalaculayte maxFiatBalance = ", assetSelector.selectedAsset.totalBalance)
return assetSelector.selectedAsset ? assetSelector.selectedAsset.totalBalance: 0
}
readonly property double maxFiatBalance: assetSelector.selectedAsset ? assetSelector.selectedAsset.totalBalance: 0
readonly property bool isReady: amountToSendInput.valid && !amountToSendInput.pending && recipientReady
readonly property bool errorMode: (networkSelector.bestRoutes && networkSelector.bestRoutes.length <= 0) || networkSelector.errorMode || isNaN(amountToSendInput.text)
readonly property bool recipientReady: (isAddressValid || isENSValid) && !recipientSelector.isPending
Expand Down Expand Up @@ -517,7 +522,7 @@ StatusDialog {
footer: SendModalFooter {
maxFiatFees: popup.isLoading ? "..." : gasSelector.selectedGasFiatValue
selectedTimeEstimate: popup.isLoading? "..." : gasSelector.selectedTimeEstimate
pending: d.isPendingTx
pending: d.isPendingTx || popup.isLoading
visible: d.isReady && !isNaN(amountToSendInput.text) && gasValidator.isValid && !d.errorMode
onNextButtonClicked: popup.sendTransaction()
}
Expand Down

0 comments on commit 2427795

Please sign in to comment.