Fix multipleaccount test

Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
Serhy 2019-09-26 12:11:46 +03:00
parent c047b588ed
commit 42a65a7a1e
No known key found for this signature in database
GPG Key ID: 5D7C4B9E2B6F500B
6 changed files with 37 additions and 21 deletions

View File

@ -252,7 +252,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
chat_view = home_view.get_chat_view()
chat_view.chat_options.click_until_presence_of_element(chat_view.view_profile_button)
chat_view.view_profile_button.click()
for text in basic_user['username'], 'In contacts', 'Send message', 'Chat key':
for text in basic_user['username'], 'Remove from contacts', 'Send message', 'Block this user':
if not chat_view.element_by_text(text).scroll_to_element():
self.errors.append('%s is not visible' % text)
self.verify_no_errors()

View File

@ -13,6 +13,7 @@ from tests.base_test_case import NoDeviceTestCase
class TestTranslations(NoDeviceTestCase):
@marks.testrail_id(6223)
@marks.skip
def test_find_unused_translations(self):
directory = os.sep.join(__file__.split(os.sep)[:-5])
with open(os.path.join(directory, 'translations/en.json'), 'r') as f:

View File

@ -74,7 +74,7 @@ class TestTransactionDApp(SingleDeviceTestCase):
status_test_dapp.transactions_button.click()
send_transaction_view = status_test_dapp.sign_typed_message_button.click()
send_transaction_view.enter_password_input.send_keys(common_password)
send_transaction_view.sign_button.click()
send_transaction_view.sign_button.click_until_presence_of_element(send_transaction_view.ok_button)
status_test_dapp.find_text_part('0xde3048417e5881acc9ca8466ab0b3e2f9f965a70acabbda2d140e95a28b13d2d'
'2d38eba6c0a5bfdc50e5d59e0ed3226c749732fd4a9374b57f34121eaff2a5081c')

View File

@ -434,12 +434,13 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
sign_in_view.create_user()
wallet_view = sign_in_view.wallet_button.click()
wallet_view.set_up_wallet()
address = wallet_view.get_wallet_address()[2:]
status_account_address = wallet_view.get_wallet_address()[2:]
wallet_view.back_button.click()
self.network_api.get_donate(address)
account_name = 'test account'
self.network_api.get_donate(status_account_address)
account_name = 'subaccount'
wallet_view.add_account(account_name)
wallet_view.just_fyi("Send transaction to new account")
wallet_view.accounts_status_account.click()
send_transaction = wallet_view.send_transaction_button.click()
send_transaction.amount_edit_box.click()
@ -451,8 +452,10 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.element_by_text(account_name).click()
send_transaction.sign_transaction_button.click()
send_transaction.sign_transaction()
self.network_api.wait_for_confirmation_of_transaction(address, transaction_amount)
self.network_api.verify_balance_is_updated('0.1', address)
self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount)
self.network_api.verify_balance_is_updated('0.1', status_account_address)
wallet_view.just_fyi("Verifying previously sent transaction in new account")
wallet_view.back_button.click()
wallet_view.get_account_by_name(account_name).click()
wallet_view.send_transaction_button.click()
@ -461,11 +464,12 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
if balance_after_receiving_tx != float(transaction_amount):
self.driver.fail('New account balance %s does not match expected %s after receiving a transaction' % (
balance_after_receiving_tx, transaction_amount))
updated_balance = self.network_api.get_balance(address)
wallet_view.just_fyi("Sending eth from new account to main account")
updated_balance = self.network_api.get_balance(status_account_address)
wallet_view.send_transaction_button.click()
send_transaction.amount_edit_box.click()
transaction_amount_1 = round(float(transaction_amount) * 0.7, 11)
transaction_amount_1 = round(float(transaction_amount) * 0.05, 11)
send_transaction.amount_edit_box.set_value(str(transaction_amount_1))
send_transaction.confirm()
send_transaction.chose_recipient_button.click()
@ -474,15 +478,20 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.sign_transaction_button.click()
total_fee = send_transaction.get_transaction_fee_total()
send_transaction.sign_transaction()
if not wallet_view.wait_for_element_starts_with_text('Transaction sent').is_element_displayed():
self.driver.fail('Transaction was not sent from the new account')
self.network_api.wait_for_confirmation_of_transaction(address, transaction_amount)
self.network_api.verify_balance_is_updated(updated_balance, address)
balance_after_sending_tx = wallet_view.eth_asset_value.text
send_transaction.back_button.click()
sub_account_address = wallet_view.get_wallet_address(account_name)[2:]
self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount)
self.network_api.verify_balance_is_updated(updated_balance, status_account_address)
wallet_view.just_fyi("Verify total ETH on main wallet view")
send_transaction.back_button.click()
balance_of_sub_account = float(self.network_api.get_balance(sub_account_address)) / 1000000000000000000
balance_of_status_account = float(self.network_api.get_balance(status_account_address)) / 1000000000000000000
expected_balance = str(float(balance_after_receiving_tx) - transaction_amount_1 - float(total_fee))
if balance_after_sending_tx != expected_balance:
self.driver.fail('New account balance %s does not match expected %s after sending a transaction' % (
balance_after_sending_tx, transaction_amount))
total_eth_from_two_accounts = float(wallet_view.eth_asset_value.text)
if total_eth_from_two_accounts != (balance_of_status_account + balance_of_sub_account):
self.driver.fail('Total wallet balance %s != of Status account (%s) + SubAccount (%s)' % (
total_eth_from_two_accounts, balance_of_status_account, balance_of_sub_account))
@marks.transaction

View File

@ -385,6 +385,9 @@ class BaseView(object):
except TimeoutException:
counter += 1
def just_fyi(self, string):
self.driver.info(string)
def click_system_back_button(self):
self.driver.info('Click system back button')
self.driver.press_keycode(4)

View File

@ -328,7 +328,7 @@ class WalletView(BaseView):
# elements for multiaccount
self.multiaccount_more_options = MultiaccountMoreOptions(self.driver)
self.accounts_status_account = AccountElementButton(self.driver, 'Status account')
self.accounts_status_account = AccountElementButton(self.driver, account_name="Status account")
self.collectibles_button = CollectiblesButton(self.driver)
self.set_currency_button = SetCurrencyButton(self.driver)
self.add_account_button = AddAccountButton(self.driver)
@ -385,13 +385,16 @@ class WalletView(BaseView):
self.ok_got_it_button.click()
return phrase
def get_wallet_address(self):
self.accounts_status_account.click()
def get_wallet_address(self, account_name="Status account"):
self.wallet_account_by_name(account_name).click()
self.receive_transaction_button.click()
address = self.address_text.text
self.back_button.click()
return address
def wallet_account_by_name(self, account_name):
return AccountElementButton(self.driver, account_name)
def asset_by_name(self, asset_name):
return AssetTextElement(self.driver, asset_name)