added test 'sign message in dapp', increased time for validation of a transaction

Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
Anton Danchenko 2018-06-04 13:31:45 +03:00 committed by yevh-berdnyk
parent 8782ecc06d
commit 64f965c392
No known key found for this signature in database
GPG Key ID: E9B425FDFC4DEA9C
5 changed files with 69 additions and 26 deletions

View File

@ -33,7 +33,7 @@ class NetworkApi:
return return
pytest.fail('Transaction is not found in Ropsten network') pytest.fail('Transaction is not found in Ropsten network')
def find_transaction_by_unique_amount(self, address, amount, wait_time=240): def find_transaction_by_unique_amount(self, address, amount, wait_time=600):
counter = 0 counter = 0
while True: while True:
if counter >= wait_time: if counter >= wait_time:

View File

@ -1,4 +1,5 @@
import pytest import pytest
from tests import transaction_users, marks
from tests.base_test_case import SingleDeviceTestCase from tests.base_test_case import SingleDeviceTestCase
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
@ -44,3 +45,35 @@ class TestDAppsAndBrowsing(SingleDeviceTestCase):
self.errors.append("'%s' web page URL instead of '%s'", (home_view.chat_url_text.text, expected_url)) self.errors.append("'%s' web page URL instead of '%s'", (home_view.chat_url_text.text, expected_url))
self.verify_no_errors() self.verify_no_errors()
@marks.pr
@marks.testrail_case_id(3404)
def test_send_transaction_from_daap(self):
sender = transaction_users['B_USER']
sign_in_view = SignInView(self.driver)
sign_in_view.recover_access(sender['passphrase'], sender['password'])
address = transaction_users['B_USER']['address']
initial_balance = self.network_api.get_balance(address)
status_test_dapp = sign_in_view.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.assets_button.click()
send_transaction_view = status_test_dapp.request_stt_button.click()
send_transaction_view.sign_transaction(sender['password'])
self.network_api.verify_balance_is_updated(initial_balance, address)
@marks.pr
@marks.testrail_case_id(3675)
def test_sign_message_from_daap(self):
password = 'passwordfordaap'
sign_in_view = SignInView(self.driver)
sign_in_view.create_user(password)
status_test_dapp = sign_in_view.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.transactions_button.click()
send_transaction_view = status_test_dapp.sign_message_button.click()
send_transaction_view.find_full_text('Kudos to Andrey!')
send_transaction_view.sign_transaction_button.click_until_presence_of_element(
send_transaction_view.enter_password_input)
send_transaction_view.enter_password_input.send_keys(password)
send_transaction_view.sign_transaction_button.click()

View File

@ -84,30 +84,6 @@ class TestTransaction(SingleDeviceTestCase):
chat_view.send_transaction_in_group_chat(transaction_amount, 'qwerty1234', recipient) chat_view.send_transaction_in_group_chat(transaction_amount, 'qwerty1234', recipient)
self.network_api.find_transaction_by_unique_amount(transaction_amount, recipient['address']) self.network_api.find_transaction_by_unique_amount(transaction_amount, recipient['address'])
@marks.pr
@marks.testrail_case_id(3404)
def test_send_transaction_from_daap(self):
sender = transaction_users['B_USER']
sign_in_view = SignInView(self.driver)
sign_in_view.recover_access(sender['passphrase'], sender['password'])
address = transaction_users['B_USER']['address']
initial_balance = self.network_api.get_balance(address)
profile_view = sign_in_view.profile_button.click()
profile_view.advanced_button.click()
profile_view.debug_mode_toggle.click()
home_view = profile_view.home_button.click()
start_new_chat_view = home_view.plus_button.click()
start_new_chat_view.open_d_app_button.click()
start_new_chat_view.status_test_dapp_button.scroll_to_element()
status_test_dapp = start_new_chat_view.status_test_dapp_button.click()
start_new_chat_view.open_button.click()
status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.assets_button.click()
status_test_dapp.request_stt_button.click()
send_transaction_view = home_view.get_send_transaction_view()
send_transaction_view.sign_transaction(sender['password'])
self.network_api.verify_balance_is_updated(initial_balance, address)
@pytest.mark.transactions @pytest.mark.transactions
@pytest.mark.testrail_case_id(3422) @pytest.mark.testrail_case_id(3422)
def test_open_transaction_on_etherscan(self): def test_open_transaction_on_etherscan(self):

View File

@ -2,7 +2,6 @@ from tests import get_current_time, common_password
from views.base_element import BaseButton, BaseEditBox from views.base_element import BaseButton, BaseEditBox
from views.base_view import BaseView from views.base_view import BaseView
class AccountButton(BaseButton): class AccountButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
@ -124,6 +123,18 @@ class SignInView(BaseView):
self.do_not_share.wait_for_element(10) self.do_not_share.wait_for_element(10)
self.do_not_share.click_until_presence_of_element(self.home_button) self.do_not_share.click_until_presence_of_element(self.home_button)
def open_status_test_dapp(self):
profile_view = self.profile_button.click()
profile_view.advanced_button.click()
profile_view.debug_mode_toggle.click()
home_view = profile_view.home_button.click()
start_new_chat_view = home_view.plus_button.click()
start_new_chat_view.open_d_app_button.click()
start_new_chat_view.status_test_dapp_button.scroll_to_element()
status_test_daap = start_new_chat_view.status_test_dapp_button.click()
start_new_chat_view.open_button.click()
return status_test_daap
def sign_in(self, password=common_password): def sign_in(self, password=common_password):
self.password_input.set_value(password) self.password_input.set_value(password)
self.sign_in_button.click() self.sign_in_button.click()

View File

@ -12,6 +12,26 @@ class AssetsButton(BaseButton):
super(AssetsButton.RequestSTTButton, self).__init__(driver) super(AssetsButton.RequestSTTButton, self).__init__(driver)
self.locator = self.Locator.text_selector('Request STT') self.locator = self.Locator.text_selector('Request STT')
def navigate(self):
from views.send_transaction_view import SendTransactionView
return SendTransactionView(self.driver)
class TransactionsButton(BaseButton):
def __init__(self, driver):
super(TransactionsButton, self).__init__(driver)
self.locator = self.Locator.text_selector('Transactions')
class SignMessageButton(BaseButton):
def __init__(self, driver):
super(TransactionsButton.SignMessageButton, self).__init__(driver)
self.locator = self.Locator.text_selector('Sign message')
def navigate(self):
from views.send_transaction_view import SendTransactionView
return SendTransactionView(self.driver)
class StatusTestDAppView(BaseWebView): class StatusTestDAppView(BaseWebView):
@ -21,3 +41,6 @@ class StatusTestDAppView(BaseWebView):
self.assets_button = AssetsButton(self.driver) self.assets_button = AssetsButton(self.driver)
self.request_stt_button = AssetsButton.RequestSTTButton(self.driver) self.request_stt_button = AssetsButton.RequestSTTButton(self.driver)
self.transactions_button = TransactionsButton(self.driver)
self.sign_message_button = TransactionsButton.SignMessageButton(self.driver)