Fix deep links tests

Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
Serhy 2019-05-17 17:40:35 +03:00
parent 23b04288f1
commit aa7292d757
No known key found for this signature in database
GPG Key ID: 5D7C4B9E2B6F500B
6 changed files with 13 additions and 10 deletions

View File

@ -37,7 +37,6 @@ class TestDeepLinks(SingleDeviceTestCase):
if not chat_view.element_by_text(text).scroll_to_element(10): if not chat_view.element_by_text(text).scroll_to_element(10):
pytest.fail("User profile screen is not opened") pytest.fail("User profile screen is not opened")
@marks.testrail_id(5442) @marks.testrail_id(5442)
@marks.medium @marks.medium
def test_open_dapp_using_deep_link(self): def test_open_dapp_using_deep_link(self):

View File

@ -159,13 +159,19 @@ class BaseElement(object):
self.template = file_name self.template = file_name
return not ImageChops.difference(self.image, self.template).getbbox() return not ImageChops.difference(self.image, self.template).getbbox()
def swipe_element(self): def swipe_left_on_element(self):
element = self.find_element() element = self.find_element()
location, size = element.location, element.size location, size = element.location, element.size
x, y = location['x'], location['y'] x, y = location['x'], location['y']
width, height = size['width'], size['height'] width, height = size['width'], size['height']
self.driver.swipe(start_x=x + width * 0.75, start_y=y + height / 2, end_x=x, end_y=y + height / 2) self.driver.swipe(start_x=x + width * 0.75, start_y=y + height / 2, end_x=x, end_y=y + height / 2)
def swipe_to_web_element(self):
element = self.find_element()
location = element.location
x, y = location['x'], location['y']
self.driver.swipe(start_x=x, start_y=y, end_x=x, end_y=400)
def long_press_element(self): def long_press_element(self):
element = self.find_element() element = self.find_element()
self.driver.info('Long press %s' % self.name) self.driver.info('Long press %s' % self.name)

View File

@ -279,10 +279,7 @@ class OpenInStatusButton(BaseButton):
def click(self): def click(self):
self.wait_for_visibility_of_element() self.wait_for_visibility_of_element()
self.swipe_to_web_element()
# 'Open in Status' button already in DOM but need to scroll down so that click action works
self.driver.swipe(500, 500, 500, 200)
self.driver.info('Tap on %s' % self.name)
self.wait_for_element().click() self.wait_for_element().click()

View File

@ -96,7 +96,7 @@ class ChatElement(BaseButton):
def swipe_and_delete(self): def swipe_and_delete(self):
counter = 0 counter = 0
while counter < 3: while counter < 3:
self.swipe_element() self.swipe_left_on_element()
if self.swipe_delete_button.is_element_present(): if self.swipe_delete_button.is_element_present():
break break
time.sleep(3) time.sleep(3)

View File

@ -141,8 +141,7 @@ class SignInView(BaseView):
return self.get_home_view() return self.get_home_view()
def sign_in(self, password=common_password): def sign_in(self, password=common_password):
if self.ok_button.is_element_displayed(): self.accept_agreements()
self.ok_button.click()
self.password_input.set_value(password) self.password_input.set_value(password)
return self.sign_in_button.click() return self.sign_in_button.click()

View File

@ -1,4 +1,5 @@
from views.web_views.base_web_view import BaseWebView, BaseButton from views.web_views.base_web_view import BaseWebView, BaseButton
import time
class AssetsButton(BaseButton): class AssetsButton(BaseButton):
@ -65,7 +66,8 @@ class TransactionsButton(BaseButton):
return SendTransactionView(self.driver) return SendTransactionView(self.driver)
def click(self): def click(self):
self.driver.swipe(500, 1000, 500, 800) self.swipe_to_web_element()
time.sleep(2)
self.wait_for_visibility_of_element().click() self.wait_for_visibility_of_element().click()
return self.navigate() return self.navigate()