e2e tests aligned with new commands design

Signed-off-by: Anton Danchenko <ant.danchenko@gmail.com>
This commit is contained in:
Anton Danchenko 2018-06-18 16:10:34 +03:00
parent 252dab26bc
commit c1120119b2
No known key found for this signature in database
GPG Key ID: C2D4819B698627E4
2 changed files with 14 additions and 10 deletions

View File

@ -221,8 +221,7 @@ class TestTransactions(MultipleDeviceTestCase):
device_1_chat.first_recipient_button.click()
device_1_chat.send_as_keyevent(amount)
device_1_chat.send_message_button.click()
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')
device_2_chat.send_eth_to_request(request_button, sender['password'])
device_2_chat.send_eth_to_request(amount, sender['password'])
self.network_api.find_transaction_by_unique_amount(recipient['address'], amount)
@marks.pr
@ -251,13 +250,12 @@ class TestTransactions(MultipleDeviceTestCase):
except TimeoutException:
device_1_chat.chat_message_input.send_keys('ping')
device_1_chat.send_message_button.click()
one_to_one_chat_device_2.click()
one_to_one_chat_device_2.click_until_presence_of_element(device_2_chat.commands_button)
device_1_chat.commands_button.click_until_presence_of_element(device_1_chat.request_command)
device_1_chat.request_command.click()
device_1_chat.send_as_keyevent(amount)
device_1_chat.send_message_button.click()
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')
device_2_chat.send_eth_to_request(request_button, sender['password'], wallet_set_up=True)
device_2_chat.send_eth_to_request(amount, sender['password'], wallet_set_up=True)
self.network_api.find_transaction_by_unique_amount(recipient['address'], amount)
device_2_chat.back_button.click()
device_2_wallet = device_2_home.wallet_button.click()
@ -296,6 +294,5 @@ class TestTransactions(MultipleDeviceTestCase):
one_to_one_chat_device_2 = device_2_chat.element_by_text_part(recipient['username'][:25], 'button')
one_to_one_chat_device_2.wait_for_visibility_of_element(120)
one_to_one_chat_device_2.click()
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')
device_2_chat.send_eth_to_request(request_button, sender['password'], wallet_set_up=True)
device_2_chat.send_eth_to_request(amount, sender['password'], wallet_set_up=True)
self.network_api.find_transaction_by_unique_amount(recipient['address'], amount)

View File

@ -182,6 +182,12 @@ class ProfileSendTransactionButton(BaseButton):
self.locator = self.Locator.accessibility_id('send-transaction-button')
class SendRequestButton(BaseButton):
def __init__(self, driver, amount):
super(SendRequestButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[contains(@text, "%s.ETH")]/../*[@text="Send"]' % amount)
class ChatView(BaseView):
def __init__(self, driver):
super(ChatView, self).__init__(driver)
@ -260,9 +266,10 @@ class ChatView(BaseView):
errors.append("Message '%s' was received but username is '%s' instead of %s" %
(message, element.text, username))
def send_eth_to_request(self, request, sender_password, wallet_set_up=False):
def send_eth_to_request(self, amount, sender_password, wallet_set_up=False):
gas_popup = self.element_by_text_part('Specify amount')
request.click_until_presence_of_element(gas_popup)
send_request_button = SendRequestButton(self.driver, amount)
send_request_button.click_until_presence_of_element(gas_popup)
send_transaction = self.get_send_transaction_view()
if wallet_set_up:
wallet_view = self.get_wallet_view()
@ -295,7 +302,7 @@ class ChatView(BaseView):
else:
self.send_message_button.click_until_presence_of_element(send_transaction_view.sign_transaction_button)
send_transaction_view.sign_transaction(password)
send_transaction_view.find_full_text(amount)
send_transaction_view.find_text_part(amount)
try:
self.find_full_text('Sent', 10)
except TimeoutException: