Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed multipleaccount test #9049

Merged
merged 1 commit into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def test_contact_profile_view(self):
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()
Expand Down
1 change: 1 addition & 0 deletions test/appium/tests/atomic/test_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def test_sign_typed_message(self):
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')

Expand Down
41 changes: 25 additions & 16 deletions test/appium/tests/atomic/transactions/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,13 @@ def test_send_funds_between_accounts_in_multiaccount_instance(self):
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()
Expand All @@ -451,8 +452,10 @@ def test_send_funds_between_accounts_in_multiaccount_instance(self):
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()
Expand All @@ -461,11 +464,12 @@ def test_send_funds_between_accounts_in_multiaccount_instance(self):
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()
Expand All @@ -474,15 +478,20 @@ def test_send_funds_between_accounts_in_multiaccount_instance(self):
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
Expand Down
3 changes: 3 additions & 0 deletions test/appium/views/base_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,9 @@ def confirm_until_presence_of_element(self, desired_element, attempts=3):
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)
Expand Down
9 changes: 6 additions & 3 deletions test/appium/views/wallet_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def __init__(self, driver):

# 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)
Expand Down Expand Up @@ -385,13 +385,16 @@ def set_up_wallet(self):
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)

Expand Down