Modified e2e for deleting-clear all dapps

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Churikova Tetiana 2019-09-24 10:50:21 +02:00 committed by Andrey Shovkoplyas
parent 222c6ac20c
commit ebc2ff04cd
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
3 changed files with 38 additions and 19 deletions

View File

@ -2,6 +2,7 @@ import pytest
from tests import marks, connection_not_secure_text, connection_is_secure_text
from tests.base_test_case import SingleDeviceTestCase
from views.sign_in_view import SignInView
from views.dapps_view import DappsView
@pytest.mark.all
@ -64,18 +65,26 @@ class TestBrowsing(SingleDeviceTestCase):
@marks.testrail_id(5390)
@marks.high
def test_swipe_to_delete_browser_entry(self):
def test_long_press_delete_clear_all_dapps(self):
sign_in = SignInView(self.driver)
home_view = sign_in.create_user()
daap_view = home_view.dapp_tab_button.click()
browsing_view = daap_view.open_url('google.com')
dapp_view = home_view.dapp_tab_button.click()
browsing_view = dapp_view.open_url('google.com')
browsing_view.cross_icon.click()
browser_entry = daap_view.get_browser_entry('Google')
browser_entry.scroll_to_element()
browser_entry.swipe_and_delete()
dapp_view = DappsView(self.driver)
browser_entry = dapp_view.remove_browser_entry_long_press('Google')
home_view.relogin()
home_view.dapp_tab_button.click()
if browser_entry.is_element_present(20):
self.driver.fail('The browser entry is present after re-login')
self.errors.append('The browser entry is present after re-login')
for entry in ('google.com', 'status.im'):
browsing_view = dapp_view.open_url(entry)
browsing_view.cross_icon.click()
dapp_view.remove_browser_entry_long_press('Google', clear_all=True)
home_view.relogin()
home_view.dapp_tab_button.click()
if not dapp_view.element_by_text('Browsed websites will appear here.').is_element_displayed():
self.errors.append('Browser history is not empty')
@marks.testrail_id(5320)
@marks.critical

View File

@ -40,6 +40,16 @@ class EnsCheckName(BaseButton):
super(EnsCheckName, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//android.widget.EditText//following-sibling::android.view.ViewGroup[1]')
class RemoveDappButton(BaseButton):
def __init__(self, driver):
super(RemoveDappButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('remove-dapp-from-list')
class ClearAllDappButton(BaseButton):
def __init__(self, driver):
super(ClearAllDappButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('clear-all-dapps')
class DappsView(BaseView):
def __init__(self, driver):
@ -53,6 +63,11 @@ class DappsView(BaseView):
self.ens_name = EnsName(self.driver)
self.check_ens_name = EnsCheckName(self.driver)
#options on long press
self.remove_d_app_button = RemoveDappButton(self.driver)
self.clear_all_d_app_button = ClearAllDappButton(self.driver)
def open_url(self, url):
self.enter_url_editbox.click()
self.enter_url_editbox.send_keys(url)
@ -61,3 +76,10 @@ class DappsView(BaseView):
def get_browser_entry(self, name):
return BrowserEntry(self.driver, name)
def remove_browser_entry_long_press(self, name, clear_all=False):
entry = self.get_browser_entry(name)
entry.scroll_to_element()
entry.long_press_element()
self.clear_all_d_app_button if clear_all else self.remove_d_app_button.click()
return entry

View File

@ -98,18 +98,6 @@ class ChatElement(BaseButton):
return DeleteButton(self.driver, self.locator.value)
def swipe_and_delete(self):
counter = 0
while counter < 3:
self.swipe_left_on_element()
if self.swipe_delete_button.is_element_present():
break
time.sleep(3)
counter += 1
else:
raise NoSuchElementException('Unable to swipe and delete - Delete button is not found') from None
self.swipe_delete_button.click()
@property
def new_messages_counter(self):
class UnreadMessagesCountText(BaseText):