test: Renabled test case for Simple transaction

fixes #7983
This commit is contained in:
Khushboo Mehta 2022-10-20 14:58:56 +02:00 committed by Anthony Laibe
parent d42e1fdc89
commit 8084b90b5c
10 changed files with 42 additions and 36 deletions

View File

@ -169,6 +169,8 @@ class SettingsScreen:
verify(tenorSwitch.enabled, "Tenor GIFs preview is enabled") verify(tenorSwitch.enabled, "Tenor GIFs preview is enabled")
def toggle_test_networks(self): 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.NETWORKS_ITEM.value)
click_obj_by_name(WalletSettingsScreen.TESTNET_TOGGLE.value) click_obj_by_name(WalletSettingsScreen.TESTNET_TOGGLE.value)

View File

@ -23,6 +23,8 @@ class MainWalletScreen(Enum):
RIGHT_SIDE_TABBAR: str = "mainWallet_Right_Side_Tab_Bar" RIGHT_SIDE_TABBAR: str = "mainWallet_Right_Side_Tab_Bar"
MAILSERVER_RETRY: str = "mailserver_retry" MAILSERVER_RETRY: str = "mailserver_retry"
FIRST_ACCOUNT_ITEM: str = "firstWalletAccount_Item" FIRST_ACCOUNT_ITEM: str = "firstWalletAccount_Item"
EPHEMERAL_NOTIFICATION_LIST: str = "mainWallet_Ephemeral_Notification_List"
TOTAL_CURRENCY_BALANCE: str = "mainWallet_totalCurrencyBalance"
class AssetView(Enum): class AssetView(Enum):
LIST: str = "mainWallet_Assets_View_List" LIST: str = "mainWallet_Assets_View_List"
@ -48,12 +50,10 @@ class SendPopup(Enum):
SCROLL_BAR: str = "mainWallet_Send_Popup_Main" SCROLL_BAR: str = "mainWallet_Send_Popup_Main"
HEADER_ACCOUNTS_LIST: str = "mainWallet_Send_Popup_Header_Accounts" HEADER_ACCOUNTS_LIST: str = "mainWallet_Send_Popup_Header_Accounts"
AMOUNT_INPUT: str = "mainWallet_Send_Popup_Amount_Input" 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_TAB: str = "mainWallet_Send_Popup_My_Accounts_Tab"
MY_ACCOUNTS_LIST: str = "mainWallet_Send_Popup_My_Accounts_List" MY_ACCOUNTS_LIST: str = "mainWallet_Send_Popup_My_Accounts_List"
NETWORKS_LIST: str = "mainWallet_Send_Popup_Networks_List" NETWORKS_LIST: str = "mainWallet_Send_Popup_Networks_List"
SEND_BUTTON: str = "mainWallet_Send_Popup_Send_Button" 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_SELECTOR: str = "mainWallet_Send_Popup_Asset_Selector"
ASSET_LIST: str = "mainWallet_Send_Popup_Asset_List" ASSET_LIST: str = "mainWallet_Send_Popup_Asset_List"
HIGH_GAS_BUTTON: str = "mainWallet_Send_Popup_GasSelector_HighGas_Button" HIGH_GAS_BUTTON: str = "mainWallet_Send_Popup_GasSelector_HighGas_Button"
@ -184,9 +184,10 @@ class StatusWalletScreen:
click_obj_by_name(AddAccountPopup.ADD_ACCOUNT_BUTTON.value) click_obj_by_name(AddAccountPopup.ADD_ACCOUNT_BUTTON.value)
def send_transaction(self, account_name, amount, token, chain_name, password): def send_transaction(self, account_name, amount, token, chain_name, password):
# TODO wait for balance to update list = get_obj(AssetView.LIST.value)
# Maybe needs a fix on the app itself. Make the Send modal be responsive to when the balance updates squish.waitFor("list.count > 0", 60*1000*2)
time.sleep(2) squish.waitFor("float(str(list.itemAtIndex(0).balance)) > 0", 60*1000*2)
click_obj_by_name(MainWalletScreen.SEND_BUTTON_FOOTER.value) click_obj_by_name(MainWalletScreen.SEND_BUTTON_FOOTER.value)
self._click_repeater(SendPopup.HEADER_ACCOUNTS_LIST.value, account_name) self._click_repeater(SendPopup.HEADER_ACCOUNTS_LIST.value, account_name)
@ -207,21 +208,17 @@ class StatusWalletScreen:
accounts = get_obj(SendPopup.MY_ACCOUNTS_LIST.value) accounts = get_obj(SendPopup.MY_ACCOUNTS_LIST.value)
for index in range(accounts.count): for index in range(accounts.count):
if(accounts.itemAtIndex(index).objectName == account_name): if(accounts.itemAtIndex(index).objectName == account_name):
print("WE FOUND THE ACCOUNT")
click_obj(accounts.itemAtIndex(index)) click_obj(accounts.itemAtIndex(index))
break break
scroll_obj_by_name(SendPopup.SCROLL_BAR.value) scroll_obj_by_name(SendPopup.SCROLL_BAR.value)
time.sleep(1) time.sleep(1)
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) click_obj_by_name(SendPopup.SEND_BUTTON.value)
wait_for_object_and_type(SharedPopup.PASSWORD_INPUT.value, password)
type(SendPopup.PASSWORD_INPUT.value, password) click_obj_by_name(SharedPopup.PRIMARY_BUTTON.value)
click_obj_by_name(SendPopup.SEND_BUTTON.value)
def _click_repeater(self, repeater_object_name: str, object_name: str): def _click_repeater(self, repeater_object_name: str, object_name: str):
repeater = get_obj(repeater_object_name) repeater = get_obj(repeater_object_name)
@ -350,7 +347,11 @@ class StatusWalletScreen:
verify_failure(f'FAIL: saved address {name} exists') verify_failure(f'FAIL: saved address {name} exists')
def verify_transaction(self): def verify_transaction(self):
print("TODO: fix notification and ensure there is one") pass
# TODO: figure out why it doesn t work in CI
# ephemeral_notification_list = get_obj(MainWalletScreen.EPHEMERAL_NOTIFICATION_LIST.value)
# print(ephemeral_notification_list.itemAtIndex(0).objectName)
# verify(str(ephemeral_notification_list.itemAtIndex(0).primaryText ) == "Transaction pending...", "Tx was not sent!")
def verify_collectibles_exist(self, account_name: str): def verify_collectibles_exist(self, account_name: str):
tabbar = get_obj(MainWalletScreen.RIGHT_SIDE_TABBAR.value) tabbar = get_obj(MainWalletScreen.RIGHT_SIDE_TABBAR.value)

View File

@ -30,7 +30,7 @@ class SettingsSubsection(Enum):
# Main: # Main:
navBarListView_Settings_navbar_StatusNavBarTabButton = {"checkable": True, "container": mainWindow_navBarListView_ListView, "objectName": "Settings-navbar", "type": "StatusNavBarTabButton", "visible": True} 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} 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; # ENS view;
settings_ENS_Start_Button = {"container": statusDesktop_mainWindow, "objectName": "ensStartButton", "type": "StatusButton"} settings_ENS_Start_Button = {"container": statusDesktop_mainWindow, "objectName": "ensStartButton", "type": "StatusButton"}

View File

@ -10,6 +10,7 @@ signPhrase_Ok_Button = {"container": statusDesktop_mainWindow, "type": "StatusFl
mainWallet_Saved_Addresses_Button = {"container": statusDesktop_mainWindow, "objectName": "savedAddressesBtn", "type": "StatusButton"} mainWallet_Saved_Addresses_Button = {"container": statusDesktop_mainWindow, "objectName": "savedAddressesBtn", "type": "StatusButton"}
mainWallet_Network_Selector_Button = {"container": statusDesktop_mainWindow, "objectName": "networkSelectorButton", "type": "StatusListItem"} mainWallet_Network_Selector_Button = {"container": statusDesktop_mainWindow, "objectName": "networkSelectorButton", "type": "StatusListItem"}
mainWallet_Right_Side_Tab_Bar = {"container": statusDesktop_mainWindow, "objectName": "rightSideWalletTabBar", "type": "StatusTabBar"} 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_dialog = {"container": statusDesktop_mainWindow_overlay, "objectName": "mailserverConnectionDialog", "type": "StatusDialog"}
mailserver_retry = {"container": mailserver_dialog, "objectName": "mailserverConnectionDialog_retryButton", "type": "StatusButton"} mailserver_retry = {"container": mailserver_dialog, "objectName": "mailserverConnectionDialog_retryButton", "type": "StatusButton"}
@ -25,6 +26,7 @@ mainWallet_Assets_View_List = {"container": statusDesktop_mainWindow, "objectNam
mainWallet_Network_Popup_Chain_Repeater_1 = {"container": statusDesktop_mainWindow, "objectName": "networkSelectPopupChainRepeaterLayer1", "type": "Repeater"} mainWallet_Network_Popup_Chain_Repeater_1 = {"container": statusDesktop_mainWindow, "objectName": "networkSelectPopupChainRepeaterLayer1", "type": "Repeater"}
# Send popup: # Send popup:
mainWallet_totalCurrencyBalance = {"container": statusDesktop_mainWindow, "objectName": "walletLeftListAmountValue", "type": "StyledTextEdit"}
mainWallet_Footer_Send_Button = {"container": statusDesktop_mainWindow, "objectName": "walletFooterSendButton", "type": "StatusFlatButton"} 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_Main = {"container": statusDesktop_mainWindow, "objectName": "sendModalScroll", "type": "StatusScrollView"}
mainWallet_Send_Popup_Amount_Input = {"container": statusDesktop_mainWindow, "objectName": "amountInput", "type": "TextEdit"} mainWallet_Send_Popup_Amount_Input = {"container": statusDesktop_mainWindow, "objectName": "amountInput", "type": "TextEdit"}
@ -33,7 +35,6 @@ mainWallet_Send_Popup_My_Accounts_List = {"container": statusDesktop_mainWindow,
mainWallet_Send_Popup_Header_Accounts = {"container": statusDesktop_mainWindow, "objectName": "accountsListFloatingHeader", "type": "Repeater"} 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_Networks_List = {"container": statusDesktop_mainWindow, "objectName": "networksList", "type": "Repeater"}
mainWallet_Send_Popup_Send_Button = {"container": statusDesktop_mainWindow, "objectName": "sendModalFooterSendButton", "type": "StatusFlatButton"} 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_Selector = {"container": statusDesktop_mainWindow, "objectName": "assetSelectorButton", "type": "StatusComboBox"}
mainWallet_Send_Popup_Asset_List = {"container": statusDesktop_mainWindow, "objectName": "assetSelectorList", "type": "StatusListView"} mainWallet_Send_Popup_Asset_List = {"container": statusDesktop_mainWindow, "objectName": "assetSelectorList", "type": "StatusListView"}
mainWallet_Send_Popup_GasPrice_Input = {"container": statusDesktop_mainWindow, "objectName": "gasPriceSelectorInput", "type": "StyledTextField"} mainWallet_Send_Popup_GasPrice_Input = {"container": statusDesktop_mainWindow, "objectName": "gasPriceSelectorInput", "type": "StyledTextField"}

View File

@ -1,5 +1,7 @@
AUT=nim_status_client AUT=nim_status_client
ENVVARS=envvars ENVVARS=envvars
HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python LANGUAGE=Python
OBJECTMAPSTYLE=script OBJECTMAPSTYLE=script
TEST_CASES=tst_wallet tst_transaction TEST_CASES=tst_wallet tst_transaction

View File

@ -16,8 +16,7 @@ _seed_phrase = "pelican chief sudden oval media rare swamp elephant lawsuit whea
def hook(context): def hook(context):
common_init_steps.context_init(context) common_init_steps.context_init(context)
common_init_steps.signs_up_with_seed_phrase_process_steps(context, _seed_phrase, _user, _password) common_init_steps.signs_up_with_seed_phrase_process_steps(context, _seed_phrase, _user, _password)
wallet_init_steps.enable_wallet_section() wallet_init_steps.activate_and_open_wallet()
wallet_init_steps.toggle_test_networks()
@OnFeatureEnd @OnFeatureEnd
def hook(context): def hook(context):

View File

@ -16,22 +16,16 @@ Feature: Status Desktop Transaction
** and the user opens wallet screen ** and the user opens wallet screen
** and the user accepts the signing phrase ** and the user accepts the signing phrase
Background: Navigation to main wallet screen
Given the user opens wallet screen
And the user clicks on the first account
@mayfail
Scenario Outline: The user sends a transaction Scenario Outline: The user sends a transaction
When the user sends a transaction to himself from account "Status account" of "<amount>" "<token>" on "<chain_name>" with password "qqqqqqqqqq" 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 Then the transaction is in progress
Examples: Examples:
| amount | token | chain_name | | amount | token | chain_name |
| 1 | ETH | Goerli | | 0.1 | ETH | Ethereum Mainnet |
| 0 | ETH | Goerli | #| 0 | ETH | Goerli |
| 1 | STT | Goerli | #| 1 | STT | Goerli |
| 0 | STT | Goerli | #| 0 | STT | Goerli |
@mayfail @mayfail
Scenario: The user registers an ENS name Scenario: The user registers an ENS name

View File

@ -79,6 +79,7 @@ Rectangle {
StyledTextEdit { StyledTextEdit {
id: walletAmountValue id: walletAmountValue
objectName: "walletLeftListAmountValue"
color: Style.current.textColor color: Style.current.textColor
text: { text: {
Utils.toLocaleString(parseFloat(RootStore.totalCurrencyBalance).toFixed(2), localAppSettings.language, {"currency": true}) + " " + RootStore.currentCurrency.toUpperCase() Utils.toLocaleString(parseFloat(RootStore.totalCurrencyBalance).toFixed(2), localAppSettings.language, {"currency": true}) + " " + RootStore.currentCurrency.toUpperCase()

View File

@ -1209,6 +1209,7 @@ Item {
StatusListView { StatusListView {
id: toastArea id: toastArea
objectName: "ephemeralNotificationList"
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 8 anchors.rightMargin: 8
anchors.bottom: parent.bottom anchors.bottom: parent.bottom

View File

@ -44,6 +44,14 @@ StatusDialog {
standardButtons: StandardButton.Ok standardButtons: StandardButton.Ok
} }
Connections {
target: store.currentAccount.assets
onModelReset: {
popup.selectedAccount = null
popup.selectedAccount = store.currentAccount
}
}
property var sendTransaction: function() { property var sendTransaction: function() {
let recipientAddress = Utils.isValidAddress(popup.addressText) ? popup.addressText : d.resolvedENSAddress let recipientAddress = Utils.isValidAddress(popup.addressText) ? popup.addressText : d.resolvedENSAddress
d.isPendingTx = true d.isPendingTx = true
@ -76,10 +84,7 @@ StatusDialog {
QtObject { QtObject {
id: d id: d
readonly property double maxFiatBalance: { readonly property double maxFiatBalance: assetSelector.selectedAsset ? assetSelector.selectedAsset.totalBalance: 0
console.error(assetSelector.selectedAsset.name," >>> recalaculayte maxFiatBalance = ", assetSelector.selectedAsset.totalBalance)
return assetSelector.selectedAsset ? assetSelector.selectedAsset.totalBalance: 0
}
readonly property bool isReady: amountToSendInput.valid && !amountToSendInput.pending && recipientReady 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 errorMode: (networkSelector.bestRoutes && networkSelector.bestRoutes.length <= 0) || networkSelector.errorMode || isNaN(amountToSendInput.text)
readonly property bool recipientReady: (isAddressValid || isENSValid) && !recipientSelector.isPending readonly property bool recipientReady: (isAddressValid || isENSValid) && !recipientSelector.isPending
@ -517,7 +522,7 @@ StatusDialog {
footer: SendModalFooter { footer: SendModalFooter {
maxFiatFees: popup.isLoading ? "..." : gasSelector.selectedGasFiatValue maxFiatFees: popup.isLoading ? "..." : gasSelector.selectedGasFiatValue
selectedTimeEstimate: popup.isLoading? "..." : gasSelector.selectedTimeEstimate selectedTimeEstimate: popup.isLoading? "..." : gasSelector.selectedTimeEstimate
pending: d.isPendingTx pending: d.isPendingTx || popup.isLoading
visible: d.isReady && !isNaN(amountToSendInput.text) && gasValidator.isValid && !d.errorMode visible: d.isReady && !isNaN(amountToSendInput.text) && gasValidator.isValid && !d.errorMode
onNextButtonClicked: popup.sendTransaction() onNextButtonClicked: popup.sendTransaction()
} }