new test added: check currency fiat value is correct

Signed-off-by: Oleksii Lymarenko <alexey.lymarenko@gmail.com>
This commit is contained in:
Oleksii Lymarenko 2018-11-20 16:56:44 +02:00
parent 7a0fc763a4
commit ad922f4c60
No known key found for this signature in database
GPG Key ID: 2007E841ECE4A02C
3 changed files with 90 additions and 11 deletions

View File

@ -411,6 +411,71 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
self.verify_no_errors() self.verify_no_errors()
@marks.testrail_id(5405)
@marks.high
def test_fiat_value_is_correctly_calculated_on_recipient_side(self):
sender = transaction_senders['Y']
recipient = transaction_recipients['I']
self.create_drivers(2)
signin_view1, signin_view2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_view1, home_view2 = signin_view1.recover_access(sender['passphrase']), signin_view2.recover_access(
recipient['passphrase'])
devices = [
{'home_view': home_view1, 'currency': 'AUD'},
{'home_view': home_view2, 'currency': 'EUR'},
]
# changing currency for both devices
for device in devices:
profile_view = device['home_view'].profile_button.click()
profile_view.set_currency(device['currency'])
profile_view.get_back_to_home_view()
device1 = devices[0]
device2 = devices[1]
# setting up device1 wallet
wallet1 = device1['home_view'].wallet_button.click()
wallet1.set_up_wallet()
wallet1.get_back_to_home_view()
# sending ETH to device2 in 1*1 chat
device1_chat = device1['home_view'].add_contact(recipient['public_key'])
send_amount = device1_chat.get_unique_amount()
device1_chat.send_transaction_in_1_1_chat('ETHro', send_amount)
sent_message = device1_chat.chat_element_by_text(send_amount)
if not sent_message.is_element_displayed() and not sent_message.contains_text(device1['currency']):
self.errors.append('Wrong currency fiat value while sending ETH in 1*1 chat.')
device2_chat = device2['home_view'].get_chat_with_user(sender['username']).click()
received_message = device2_chat.chat_element_by_text(send_amount)
if not received_message.is_element_displayed() and not received_message.contains_text(device2['currency']):
self.errors.append('Wrong currency fiat value while receiving ETH in 1*1 chat.')
device1_chat.get_back_to_home_view()
wallet1 = device1['home_view'].wallet_button.click()
send_amount = device1_chat.get_unique_amount()
# Send and request some ETH from wallet and check whether the fiat currency value of
# the new messages is equal to user-selected
wallet1.send_transaction(asset_name='ETHro', recipient=recipient['username'], amount=send_amount)
wallet1.get_back_to_home_view()
device1_chat = device1['home_view'].get_chat_with_user(recipient['username']).click()
sent_message = device1_chat.chat_element_by_text(send_amount)
received_message = device2_chat.chat_element_by_text(send_amount)
if not sent_message.is_element_displayed() and not sent_message.contains_text(device1['currency']):
self.errors.append('Wrong currency fiat value while sending ETH from wallet.')
if not received_message.is_element_displayed() and not sent_message.contains_text(device2['currency']):
self.errors.append('Wrong currency fiat value while receiving ETH sent via wallet.')
self.verify_no_errors()
@marks.all @marks.all
@marks.chat @marks.chat
@ -521,11 +586,11 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
chat.request_transaction_in_1_1_chat('STT', request_amount) chat.request_transaction_in_1_1_chat('STT', request_amount)
send_message = chat.chat_element_by_text(send_amount) send_message = chat.chat_element_by_text(send_amount)
if not send_message.is_element_displayed() or not send_message.contains_text(default_currency): if not send_message.is_element_displayed() and not send_message.contains_text(default_currency):
self.errors.append('Wrong fiat value while sending assets in 1-1 chat with default currency.') self.errors.append('Wrong fiat value while sending assets in 1-1 chat with default currency.')
request_message = chat.chat_element_by_text(request_amount) request_message = chat.chat_element_by_text(request_amount)
if not request_message.is_element_displayed() or not request_message.contains_text(default_currency): if not request_message.is_element_displayed() and not request_message.contains_text(default_currency):
self.errors.append('Wrong fiat value while requesting assets in 1-1 chat with default currency.') self.errors.append('Wrong fiat value while requesting assets in 1-1 chat with default currency.')
chat.get_back_to_home_view() chat.get_back_to_home_view()
@ -539,11 +604,11 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
# Check whether the fiat currency value of the messages sent is not changed to user-selected # Check whether the fiat currency value of the messages sent is not changed to user-selected
send_message = chat.chat_element_by_text(send_amount) send_message = chat.chat_element_by_text(send_amount)
if not send_message.is_element_displayed() or not send_message.contains_text(default_currency): if not send_message.is_element_displayed() and not send_message.contains_text(default_currency):
self.errors.append('Wrong fiat value while sending assets in 1-1 chat with default currency.') self.errors.append('Wrong fiat value while sending assets in 1-1 chat with default currency.')
request_message = chat.chat_element_by_text(request_amount) request_message = chat.chat_element_by_text(request_amount)
if not request_message.is_element_displayed() or not request_message.contains_text(default_currency): if not request_message.is_element_displayed() and not request_message.contains_text(default_currency):
self.errors.append('Wrong fiat value while requesting assets in 1-1 chat with default currency.') self.errors.append('Wrong fiat value while requesting assets in 1-1 chat with default currency.')
# Send and request some tokens in 1x1 chat and check whether the fiat currency value of # Send and request some tokens in 1x1 chat and check whether the fiat currency value of
@ -553,11 +618,11 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
chat.request_transaction_in_1_1_chat('STT', request_amount) chat.request_transaction_in_1_1_chat('STT', request_amount)
send_message = chat.chat_element_by_text(send_amount) send_message = chat.chat_element_by_text(send_amount)
if not send_message.is_element_displayed() or not send_message.contains_text(user_currency): if not send_message.is_element_displayed() and not send_message.contains_text(user_currency):
self.errors.append('Wrong fiat value while sending assets in 1-1 chat with user selected currency.') self.errors.append('Wrong fiat value while sending assets in 1-1 chat with user selected currency.')
request_message = chat.chat_element_by_text(request_amount) request_message = chat.chat_element_by_text(request_amount)
if not request_message.is_element_displayed() or not request_message.contains_text(user_currency): if not request_message.is_element_displayed() and not request_message.contains_text(user_currency):
self.errors.append('Wrong fiat value while requesting assets in 1-1 chat with user selected currency.') self.errors.append('Wrong fiat value while requesting assets in 1-1 chat with user selected currency.')
chat.get_back_to_home_view() chat.get_back_to_home_view()
@ -574,11 +639,11 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
chat = home_view.get_chat_with_user(recipient_user_name).click() chat = home_view.get_chat_with_user(recipient_user_name).click()
send_message = chat.chat_element_by_text(send_amount) send_message = chat.chat_element_by_text(send_amount)
if not send_message.is_element_displayed() or not send_message.contains_text(user_currency): if not send_message.is_element_displayed() and not send_message.contains_text(user_currency):
self.errors.append('Wrong fiat value while sending assets from wallet with user selected currency.') self.errors.append('Wrong fiat value while sending assets from wallet with user selected currency.')
request_message = chat.chat_element_by_text(request_amount) request_message = chat.chat_element_by_text(request_amount)
if not request_message.is_element_displayed() or not request_message.contains_text(user_currency): if not request_message.is_element_displayed() and not request_message.contains_text(user_currency):
self.errors.append('Wrong fiat value while requesting assets from wallet with user selected currency.') self.errors.append('Wrong fiat value while requesting assets from wallet with user selected currency.')
self.verify_no_errors() self.verify_no_errors()

View File

@ -208,6 +208,13 @@ transaction_senders['X']['address'] = "0xc9cf2ff3ca98a91f2e3dfc35a13cf8425ecaf08
transaction_senders['X']['public_key'] = "0x04a712634920a012cd45d63a23832d494518d992b77d3b8aa81131a302657193e2d174e3a" \ transaction_senders['X']['public_key'] = "0x04a712634920a012cd45d63a23832d494518d992b77d3b8aa81131a302657193e2d174e3a" \
"ffda80dad81bc3bf3edaf84334437cfecfb248f37fdcb1d882773cf08" "ffda80dad81bc3bf3edaf84334437cfecfb248f37fdcb1d882773cf08"
transaction_senders['Y'] = dict()
transaction_senders['Y']['passphrase'] = "slight thunder cup divorce hawk paper blush memory shaft extend laundry bone"
transaction_senders['Y']['username'] = "Lighthearted Empty Longspur"
transaction_senders['Y']['address'] = "0x2a5ed44a7092404ae08369ffde6e54ce47e3761c"
transaction_senders['Y']['public_key'] = "0x04a6515d7f2a1659948429487ba3b747cc1860c29e304a5482492226ab65056c1c6ba6a" \
"5def258316d22882e43dd2b1b98b0f8d2488a7a5a967ac6d86c2a1088e2"
transaction_recipients = dict() transaction_recipients = dict()
transaction_recipients['A'] = dict() transaction_recipients['A'] = dict()
@ -263,3 +270,10 @@ transaction_recipients['H']['username'] = "Glum Tricky Indianskimmer"
transaction_recipients['H']['address'] = "0xe9676a57a28800d83301d9d3f9c77fd2e933609c" transaction_recipients['H']['address'] = "0xe9676a57a28800d83301d9d3f9c77fd2e933609c"
transaction_recipients['H']['public_key'] = "0x0400b4d2cb69c49d147af128a596a2160fb7ac1d2abc54156b26598feb5630e8e7529" \ transaction_recipients['H']['public_key'] = "0x0400b4d2cb69c49d147af128a596a2160fb7ac1d2abc54156b26598feb5630e8e7529" \
"f5a8363a73d6a9df86fdda87c095a9462aca8b4cbf1f331152a9a22cdb35d" "f5a8363a73d6a9df86fdda87c095a9462aca8b4cbf1f331152a9a22cdb35d"
transaction_recipients['I'] = dict()
transaction_recipients['I']['passphrase'] = "engine equal wisdom saddle icon spring express limit surprise salute unique rose"
transaction_recipients['I']['username'] = "Sharp Sour Greathornedowl"
transaction_recipients['I']['address'] = "0x4e6c60f344b13d730682f0a6d8ae1255c75e730e"
transaction_recipients['I']['public_key'] = "0x049d6fe0c874d11ddd92f72ac75659703a7b58211b934fc22f0c7eae835b71651c8" \
"3ae5e4fd688f1c898d39a657ea08a39d05d20a830bbf7eaffb6ccda9bef348f"

View File

@ -278,7 +278,7 @@ class WalletView(BaseView):
def send_transaction(self, **kwargs): def send_transaction(self, **kwargs):
send_transaction_view = self.send_transaction_button.click() send_transaction_view = self.send_transaction_button.click()
send_transaction_view.select_asset_button.click() send_transaction_view.select_asset_button.click()
asset_name = kwargs.get('asset_name', 'ETHro') asset_name = kwargs.get('asset_name', 'ETHro').upper()
asset_button = send_transaction_view.asset_by_name(asset_name) asset_button = send_transaction_view.asset_by_name(asset_name)
send_transaction_view.select_asset_button.click_until_presence_of_element(asset_button) send_transaction_view.select_asset_button.click_until_presence_of_element(asset_button)
asset_button.click() asset_button.click()
@ -308,7 +308,7 @@ class WalletView(BaseView):
self.receive_transaction_button.click() self.receive_transaction_button.click()
send_transaction_view = self.send_transaction_request.click() send_transaction_view = self.send_transaction_request.click()
send_transaction_view.select_asset_button.click() send_transaction_view.select_asset_button.click()
asset_name = kwargs.get('asset_name', 'ETHro') asset_name = kwargs.get('asset_name', 'ETHro').upper()
asset_button = send_transaction_view.asset_by_name(asset_name) asset_button = send_transaction_view.asset_by_name(asset_name)
send_transaction_view.select_asset_button.click_until_presence_of_element(asset_button) send_transaction_view.select_asset_button.click_until_presence_of_element(asset_button)
asset_button.click() asset_button.click()