Skip to content

Commit

Permalink
False failed tests fixed - chat, browsing, deeps links, transactions
Browse files Browse the repository at this point in the history
Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
  • Loading branch information
yevh-berdnyk committed Jul 25, 2019
1 parent 2ac0630 commit 7e061e9
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 28 deletions.
9 changes: 5 additions & 4 deletions test/appium/support/utilities.py
@@ -1,6 +1,6 @@
from operator import itemgetter
from typing import List
from datetime import datetime
from operator import itemgetter
from typing import Dict


def fill_string_with_char(string: str, fillchar: str, amount: int, start: bool = False, end: bool = False) -> str:
Expand Down Expand Up @@ -30,15 +30,16 @@ def fill_string_with_char(string: str, fillchar: str, amount: int, start: bool =
return string_revised


def get_merged_txs_list(normal_txs_list, token_events_list) -> List[dict]:
def get_merged_txs_list(normal_txs_list, token_events_list) -> Dict[str, Dict[str, str]]:
res = []
for i in normal_txs_list:
for j in token_events_list:
if i['hash'] == j['hash']:
normal_txs_list.remove(i)
res.extend(normal_txs_list)
res.extend(token_events_list)
return sorted(res, key=itemgetter('timeStamp'), reverse=True)
txs_list = sorted(res, key=itemgetter('timeStamp'), reverse=True)
return dict((item['hash'], item) for item in txs_list)


def generate_timestamp():
Expand Down
2 changes: 1 addition & 1 deletion test/appium/tests/atomic/chats/test_one_to_one.py
Expand Up @@ -694,7 +694,7 @@ def test_purchase_pack_and_send_sticker(self):
home_view = sign_in_view.create_user()

wallet_view = home_view.wallet_button.click()
# wallet_view.set_up_wallet()
wallet_view.set_up_wallet()
wallet_address = wallet_view.get_wallet_address()
home_view = wallet_view.get_back_to_home_view()

Expand Down
3 changes: 2 additions & 1 deletion test/appium/tests/atomic/dapps_and_browsing/test_browsing.py
Expand Up @@ -70,7 +70,8 @@ def test_swipe_to_delete_browser_entry(self):
daap_view = home_view.dapp_tab_button.click()
browsing_view = daap_view.open_url('google.com')
browsing_view.cross_icon.click()
browser_entry = daap_view.get_browser_entry('Google').scroll_to_element()
browser_entry = daap_view.get_browser_entry('Google')
browser_entry.scroll_to_element()
browser_entry.swipe_and_delete()
home_view.relogin()
if browser_entry.is_element_present(20):
Expand Down
Expand Up @@ -74,9 +74,7 @@ def test_deep_link_with_invalid_user_public_key(self):
self.driver.close_app()
deep_link = 'https://get.status.im/user/%s' % basic_user['public_key'][:-10]
sign_in_view.open_weblink_and_login(deep_link)
chat_view = sign_in_view.get_home_view()
chat_view.plus_button.click()
try:
assert chat_view.start_new_chat_button.is_element_present()
except (AssertionError, NoSuchElementException):
home_view = sign_in_view.get_home_view()
home_view.plus_button.click_until_presence_of_element(home_view.start_new_chat_button)
if not home_view.start_new_chat_button.is_element_present():
pytest.fail("Can't navigate to start new chat after app opened from deep link with invalid public key")
Expand Up @@ -274,7 +274,7 @@ def test_not_enough_eth_for_gas_validation_from_dapp(self):
send_transaction_view.gas_price_input.clear()
send_transaction_view.gas_price_input.set_value(gas_price)
send_transaction_view.update_fee_button.click()
send_transaction_view.done_button.click()
# send_transaction_view.done_button.click()

# Check whether sending a tx in batch with normal gas limit and price does not trigger the warning
# so the transaction can be signed
Expand Down Expand Up @@ -338,6 +338,7 @@ def test_not_enough_eth_for_gas_validation_from_wallet(self):
self.network_api.verify_balance_is_updated(initial_balance=0, recipient_address=wallet_address[2:])

wallet = home_view.wallet_button.click()
wallet.accounts_status_account.click()
wallet.send_transaction(asset_name='ETHro', amount=0.1, recipient=recipient, sign_transaction=False)

# Check whether sending all available ETH triggers the warning
Expand Down
24 changes: 8 additions & 16 deletions test/appium/tests/atomic/transactions/test_wallet.py
Expand Up @@ -391,27 +391,19 @@ def test_can_see_all_transactions_in_history(self):
transaction_view = wallet_view.transaction_history_button.click()

status_tx_number = transaction_view.transactions_table.get_transactions_number()
actual_txs_list = []
if status_tx_number < 1:
self.driver.fail('No transactions found')

for n in range(status_tx_number):
transactions_details = transaction_view.transactions_table.transaction_by_index(n).click()

status_tx = {
'hash': transactions_details.get_transaction_hash(),
'from': transactions_details.get_sender_address(),
'to': transactions_details.get_recipient_address(),
}
actual_txs_list.append(status_tx)
transactions_details.back_button.click()

if [tx['hash'] for tx in actual_txs_list] != [tx['hash'] for tx in expected_txs_list]:
self.errors.append('Transactions hashes do not match!')

if [tx['from'] for tx in actual_txs_list] != [tx['from'] for tx in expected_txs_list]:
tx_hash = transactions_details.get_transaction_hash()
tx_from = transactions_details.get_sender_address()
tx_to = transactions_details.get_recipient_address()
if tx_from != expected_txs_list[tx_hash]['from']:
self.errors.append('Transactions senders do not match!')

if [tx['to'] for tx in actual_txs_list] != [tx['to'] for tx in expected_txs_list]:
if tx_to != expected_txs_list[tx_hash]['to']:
self.errors.append('Transactions recipients do not match!')
transactions_details.back_button.click()

self.verify_no_errors()

Expand Down
2 changes: 2 additions & 0 deletions test/appium/views/home_view.py
Expand Up @@ -106,6 +106,8 @@ def swipe_and_delete(self):
break
time.sleep(3)
counter += 1
else:
raise NoSuchElementException('Unable to swipe and delete - Delete button is not found') from None
self.swipe_delete_button.click()

@property
Expand Down

0 comments on commit 7e061e9

Please sign in to comment.