From 10da67a63ff82e6a580fbf7a56efb673a8a21d71 Mon Sep 17 00:00:00 2001 From: Anton Danchenko Date: Wed, 13 Dec 2017 14:12:46 +0100 Subject: [PATCH] added 'request transaction from wallet' test --- test/appium/tests/test_multiply_device.py | 10 +++++--- test/appium/tests/test_wallet.py | 31 ++++++++++++++++++++++- test/appium/views/base_view.py | 8 ++++++ test/appium/views/wallet.py | 16 ++++++++++++ 4 files changed, 60 insertions(+), 5 deletions(-) diff --git a/test/appium/tests/test_multiply_device.py b/test/appium/tests/test_multiply_device.py index 31d91ac1d0..ef61bdca83 100644 --- a/test/appium/tests/test_multiply_device.py +++ b/test/appium/tests/test_multiply_device.py @@ -175,10 +175,12 @@ class TestMultiplyDevices(MultiplyDeviceTestCase): pytest.fail('Message is shown for the user which has been removed from the GroupChat', False) @pytest.mark.transaction - @pytest.mark.parametrize("test, recipient, sender", [('group_chat', transaction_users['A_USER'], - transaction_users['B_USER']), - ('one_to_one_chat', transaction_users['B_USER'], - transaction_users['A_USER'])]) + @pytest.mark.parametrize("test, recipient, sender", [('group_chat', + transaction_users['A_USER'], transaction_users['B_USER']), + ('one_to_one_chat', + transaction_users['B_USER'], transaction_users['A_USER'])], + ids=['group_chat', + 'one_to_one_chat']) def test_send_funds_via_request(self, test, recipient, sender): device_1, device_2 = HomeView(self.driver_1), HomeView(self.driver_2) recover_access(device_1, diff --git a/test/appium/tests/test_wallet.py b/test/appium/tests/test_wallet.py index 0dc564811c..c53f0423bd 100644 --- a/test/appium/tests/test_wallet.py +++ b/test/appium/tests/test_wallet.py @@ -28,6 +28,34 @@ class TestWallet(SingleDeviceTestCase): wallet_view.find_full_text('Insufficient funds') @pytest.mark.wallet + def test_request_transaction_from_wallet(self): + home = HomeView(self.driver) + recover_access(home, + transaction_users_wallet['A_USER']['passphrase'], + transaction_users_wallet['A_USER']['password'], + transaction_users_wallet['A_USER']['username']) + chats = home.get_chats() + chats.wait_for_syncing_complete() + + recipient_key = transaction_users_wallet['B_USER']['public_key'] + + chats.plus_button.click() + chats.add_new_contact.click() + chats.public_key_edit_box.send_keys(recipient_key) + chats.confirm() + chats.confirm_public_key_button.click() + + for _ in range(3): + chats.back_button.click() + wallet = chats.wallet_button.click() + wallet.request_button.click() + wallet.amount_edit_box.scroll_to_element() + wallet.amount_edit_box.send_keys('0.1') + wallet.send_request_button.click() + user_contact = chats.element_by_text(transaction_users_wallet['B_USER']['username'], 'button') + user_contact.click() + chats.find_text_part('Requesting 0.1 ETH') + @pytest.mark.parametrize("test, recipient, sender", [('sign_now', 'A_USER', 'B_USER'), ('sign_later', 'B_USER', 'A_USER')], ids=['sign_now', @@ -86,7 +114,8 @@ class TestWallet(SingleDeviceTestCase): transaction = tr_view.transactions_table.find_transaction(amount=amount) details_view = transaction.click() transaction_hash = details_view.get_transaction_hash() - verify_transaction_in_ropsten(address=transaction_users_wallet[sender]['address'], transaction_hash=transaction_hash) + verify_transaction_in_ropsten(address=transaction_users_wallet[sender]['address'], + transaction_hash=transaction_hash) @pytest.mark.wallet def test_balance_and_eth_rate(self): diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 30fc3778cd..d5de0fae19 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -133,6 +133,13 @@ class StatusAppIcon(BaseButton): "//*[@text='Status']") +class ChatsButton(BaseButton): + def __init__(self, driver): + super(ChatsButton, self).__init__(driver) + self.locator = self.Locator.xpath_selector( + "//*[@text='Chats']") + + class BaseViewObject(object): def __init__(self, driver): self.driver = driver @@ -150,6 +157,7 @@ class BaseViewObject(object): self.contacts_button = ContactsButton(self.driver) self.wallet_button = WalletButton(self.driver) self.discover_button = DiscoverButton(self.driver) + self.chats_button = ChatsButton(self.driver) self.save_button = SaveButton(self.driver) diff --git a/test/appium/views/wallet.py b/test/appium/views/wallet.py index 69b9b6c9f1..2adfefc404 100644 --- a/test/appium/views/wallet.py +++ b/test/appium/views/wallet.py @@ -11,6 +11,20 @@ class SendButton(BaseButton): self.locator = self.Locator.xpath_selector("//*[@text='SEND']") +class RequestButton(BaseButton): + + def __init__(self, driver): + super(RequestButton, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//*[@text='REQUEST']") + + +class SendRequestButton(BaseButton): + + def __init__(self, driver): + super(SendRequestButton, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//*[@text='SEND REQUEST']") + + class AmountEditBox(BaseEditBox, BaseButton): def __init__(self, driver): @@ -66,6 +80,8 @@ class WalletViewObject(BaseViewObject): self.transactions_button = TransactionsButton(self.driver) self.eth_asset = EthAssetText(self.driver) self.usd_total_value = UsdTotalValueText(self.driver) + self.request_button = RequestButton(self.driver) + self.send_request_button = SendRequestButton(self.driver) def get_usd_total_value(self): return float(self.usd_total_value.text)