Fixed false failed tests

Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
yevh-berdnyk 2019-07-24 02:10:55 +03:00 committed by Serhy
parent 2acd5b4cb0
commit f7bb0d3648
No known key found for this signature in database
GPG Key ID: 5D7C4B9E2B6F500B
6 changed files with 24 additions and 10 deletions

View File

@ -2,8 +2,8 @@ import pytest
from tests import marks, bootnode_address, mailserver_address, camera_access_error_text, \
photos_access_error_text
from tests.users import transaction_senders, basic_user
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from tests.users import transaction_senders, basic_user
from views.sign_in_view import SignInView
@ -92,8 +92,9 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
wallet.accounts_status_account.click()
wallet.receive_transaction_button.click_until_presence_of_element(wallet.send_transaction_request)
address = wallet.address_text.text
wallet.address_text.long_press_element()
wallet.copy_text()
share_view = home.get_send_transaction_view()
share_view.share_button.click()
share_view.element_by_text('Copy to clipboard').click()
wallet.get_back_to_home_view()
wallet.home_button.click()
home.get_chat_with_user(transaction_senders['M']['username']).click()
@ -268,11 +269,10 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.append('{} Sign in view!'.format(no_link_open_error_msg))
base_web_view.click_system_back_button()
signin_view = SignInView(self.driver)
home_view = signin_view.create_user()
profile = home_view.profile_button.click()
about_view = profile.about_button.click()
base_web_view = about_view.privacy_policy_button.click()
about_view.privacy_policy_button.click()
if not base_web_view.policy_summary.is_element_displayed():
self.errors.append('{} Profile about view!'.format(no_link_open_error_msg))
@ -280,7 +280,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
base_web_view.click_system_back_button()
if about_view.privacy_policy_button.is_element_displayed():
base_web_view.click_system_back_button()
signin_view = profile.logout()
profile.logout()
if signin_view.ok_button.is_element_displayed():
signin_view.ok_button.click()
signin_view.other_multiaccounts_button.click()
@ -288,7 +288,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
if not signin_view.privacy_policy_link.is_element_displayed():
self.driver.fail('{} Sign in view!'.format(no_link_found_error_msg))
base_web_view = signin_view.privacy_policy_link.click()
signin_view.privacy_policy_link.click()
if not base_web_view.policy_summary.is_element_displayed():
self.errors.append('{} Sign in view!'.format(no_link_open_error_msg))

View File

@ -466,7 +466,7 @@ class TestCommandsSingleDevices(SingleDeviceTestCase):
self.errors.append(
"'Insufficient funds' error is now shown when sending %s ETHro from chat with balance %s" % (
round(eth_value + 1), eth_value))
send_transaction.cancel_button.click()
send_transaction.cancel_button.click_until_presence_of_element(chat_view.commands_button)
chat_view.commands_button.click()
chat_view.send_command.click()
chat_view.asset_by_name('STT').scroll_to_element()

View File

@ -120,6 +120,9 @@ class BaseElement(object):
self.driver.swipe(500, 1000, 500, 500)
else:
self.driver.swipe(500, 500, 500, 1000)
else:
raise NoSuchElementException(
"Device %s: '%s' is not found on the screen" % (self.driver.number, self.name)) from None
def is_element_present(self, sec=5):
try:

View File

@ -195,7 +195,7 @@ class HomeView(BaseView):
return ChatView(self.driver)
def join_public_chat(self, chat_name: str):
self.plus_button.click_until_presence_of_element(self.join_public_chat_button)
self.plus_button.click_until_presence_of_element(self.join_public_chat_button, attempts=5)
self.join_public_chat_button.wait_for_visibility_of_element(5)
contacts_view = self.join_public_chat_button.click()
contacts_view.chat_name_editbox.click()

View File

@ -231,7 +231,7 @@ class SendTransactionView(BaseView):
wallet_view.ok_got_it_button.click()
def sign_transaction(self, sender_password: str = common_password):
self.sign_with_password.click()
self.sign_with_password.click_until_presence_of_element(self.enter_password_input)
self.enter_password_input.send_keys(sender_password)
self.sign_button.click_until_presence_of_element(self.ok_button)
self.ok_button.click()

View File

@ -1,3 +1,4 @@
from appium.webdriver.common.touch_action import TouchAction
from selenium.common.exceptions import NoSuchElementException
from tests import common_password
@ -134,6 +135,16 @@ class PrivacyPolicyLink(BaseButton):
super(PrivacyPolicyLink, self).__init__(driver)
self.locator = self.Locator.text_part_selector('privacy policy')
def click(self):
element = self.find_element()
location = element.location
size = element.size
x = int(location['x'] + size['width'] * 0.8)
y = int(location['y'] + size['height'] / 2)
TouchAction(self.driver).tap(None, x, y).perform()
self.driver.info('Tap on %s' % self.name)
return self.navigate()
def navigate(self):
from views.web_views.base_web_view import BaseWebView
return BaseWebView(self.driver)