e2e: bookmarks

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-12-21 14:06:48 +01:00
parent aac7a97e13
commit 7f22912f1e
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
4 changed files with 103 additions and 13 deletions

View File

@ -34,19 +34,19 @@
[quo/list-item
{:theme :accent
:title (i18n/label :t/open-in-new-tab)
:accessibility-label :remove-dapp-from-list
:accessibility-label :open-in-new-tab
:icon :main-icons/tabs
:on-press #(hide-sheet-and-dispatch [:browser.ui/open-url url])}]
[quo/list-item
{:theme :accent
:title (i18n/label :t/edit)
:accessibility-label :remove-dapp-from-list
:accessibility-label :edit-bookmark
:icon :main-icons/edit
:on-press #(hide-sheet-and-dispatch [:navigate-to :new-bookmark bookmark])}]
[quo/list-item
{:theme :negative
:title (i18n/label :t/delete)
:accessibility-label :clear-all-dapps
:accessibility-label :delete-bookmark
:icon :main-icons/delete
:on-press #(hide-sheet-and-dispatch [:browser/delete-bookmark url])}]])}]))
:title name

View File

@ -176,6 +176,52 @@ class TestBrowsing(SingleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6633)
@marks.high
def test_browser_managing_bookmarks(self):
home_view = SignInView(self.driver).create_user()
dapp_view = home_view.dapp_tab_button.click()
home_view.just_fyi('Add some url to bookmarks with default name')
browsing_view = dapp_view.open_url('status.im')
default_bookmark_name = browsing_view.add_to_bookmarks()
browsing_view.browser_previous_page_button.click()
if not browsing_view.element_by_text(default_bookmark_name).is_element_displayed():
self.errors.append("Bookmark with default name is not added!")
home_view.just_fyi('Add some url to bookmarks with custom name')
custom_name = 'Custom BBC'
dapp_view.open_url('bbc.com')
browsing_view.add_to_bookmarks(custom_name)
browsing_view.dapp_tab_button.click()
if not browsing_view.element_by_text(custom_name).is_element_displayed():
self.driver.fail("Bookmark with custom name is not added!")
home_view.just_fyi('Check deleting bookmark on long tap and that it is deleted after relogin')
dapp_view.browser_entry_long_press(custom_name)
dapp_view.delete_bookmark_button.click()
if browsing_view.element_by_text(custom_name).is_element_displayed():
self.errors.append("Bookmark with custom name is not deleted!")
profile_view = dapp_view.profile_button.click()
profile_view.relogin()
profile_view.dapp_tab_button.click()
if browsing_view.element_by_text(custom_name).is_element_displayed():
self.errors.append("Bookmark with custom name is reappeared after relogin!")
home_view.just_fyi('Check "Edit bookmark" and "Open in new tab"')
edited_name = 'My Fav Status'
dapp_view.browser_entry_long_press(default_bookmark_name)
dapp_view.edit_bookmark_button.click()
browsing_view.edit_bookmark_name(edited_name)
if not browsing_view.element_by_text(edited_name).is_element_displayed():
self.driver.fail("Edited bookmark name is not shown!")
dapp_view.browser_entry_long_press(edited_name)
dapp_view.open_in_new_tab_button.click()
browsing_view.options_button.click()
if not browsing_view.find_element_by_translation_id('remove-favourite').is_element_displayed():
self.errors.append("Remove favourite is not shown on added bookmark!")
self.errors.verify_no_errors()
@marks.testrail_id(5321)
@marks.critical
def test_back_forward_buttons_browsing_website(self):

View File

@ -50,16 +50,22 @@ class EnsCheckName(BaseButton):
self.locator = self.Locator.xpath_selector('//android.widget.EditText//following-sibling::android.view.ViewGroup[1]')
class RemoveDappButton(BaseButton):
class DeleteBookmarkButton(BaseButton):
def __init__(self, driver):
super(RemoveDappButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('remove-dapp-from-list')
super(DeleteBookmarkButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('delete-bookmark')
class ClearAllDappButton(BaseButton):
class EditBookmarkButton(BaseButton):
def __init__(self, driver):
super(ClearAllDappButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('clear-all-dapps')
super(EditBookmarkButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('edit-bookmark')
class OpenInNewTabButton(BaseButton):
def __init__(self, driver):
super(OpenInNewTabButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('open-in-new-tab')
class SelectAccountButton(BaseButton):
def __init__(self, driver):
@ -111,8 +117,9 @@ class DappsView(BaseView):
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)
self.delete_bookmark_button = DeleteBookmarkButton(self.driver)
self.open_in_new_tab_button = OpenInNewTabButton(self.driver)
self.edit_bookmark_button = EditBookmarkButton(self.driver)
#select account
self.select_account_button = SelectAccountButton(self.driver)
@ -133,11 +140,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):
def browser_entry_long_press(self, name):
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
def select_account_by_name(self, account_name=''):

View File

@ -101,6 +101,23 @@ class OpenTabsButton(BaseButton):
super(OpenTabsButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('browser-open-tabs')
class AddRemoveFavoritesButton(BaseButton):
def __init__(self, driver):
super(AddRemoveFavoritesButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('add-remove-fav')
class BookmarkNameInput(BaseEditBox):
def __init__(self, driver):
super(BookmarkNameInput, self).__init__(driver)
self.locator = self.Locator.accessibility_id('bookmark-input')
class SaveBookmarkButton(BaseEditBox):
def __init__(self, driver):
super(SaveBookmarkButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('save-bookmark')
class CloseAllButton(BaseButton):
def __init__(self, driver):
super(CloseAllButton, self).__init__(driver)
@ -137,6 +154,11 @@ class BaseWebView(BaseView):
self.open_tabs_button = OpenTabsButton(self.driver)
self.close_all_button = CloseAllButton(self.driver)
# bookmarks management
self.add_remove_favorites_button = AddRemoveFavoritesButton(self.driver)
self.bookmark_name_input = BookmarkNameInput(self.driver)
self.save_bookmark_button = SaveBookmarkButton(self.driver)
def wait_for_d_aap_to_load(self, wait_time=35):
counter = 0
while self.progress_bar_icon.is_element_present(5):
@ -160,3 +182,19 @@ class BaseWebView(BaseView):
close_button.scroll_to_element()
close_button.click()
def edit_bookmark_name(self, name):
self.bookmark_name_input.clear()
self.bookmark_name_input.send_keys(name)
self.save_bookmark_button.click()
def add_to_bookmarks(self, name=''):
self.options_button.click()
self.add_remove_favorites_button.click()
if name:
self.edit_bookmark_name(name)
bookmark_name = name
else:
bookmark_name = self.bookmark_name_input.text
self.save_bookmark_button.click()
return bookmark_name