Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #25023 from viorelaioia/bug_1080557
Browse files Browse the repository at this point in the history
Bug 1080557 - Update test_browser_bookmark.py to delete the bookmark add...
  • Loading branch information
chirarobert committed Oct 15, 2014
2 parents 049d25e + ffcc1bd commit 41e9fe1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
9 changes: 9 additions & 0 deletions tests/python/gaia-ui-tests/gaiatest/apps/homescreen/app.py
Expand Up @@ -19,6 +19,7 @@ class Homescreen(Base):
_edit_mode_locator = (By.CSS_SELECTOR, 'body.edit-mode')
_search_bar_icon_locator = (By.ID, 'search-input')
_landing_page_locator = (By.ID, 'icons')
_bookmark_icons_locator = (By.CSS_SELECTOR, 'gaia-grid .bookmark')

def launch(self):
Base.launch(self)
Expand All @@ -43,6 +44,9 @@ def wait_for_app_icon_present(self, app_name):
def wait_for_app_icon_not_present(self, app_name):
self.wait_for_condition(lambda m: self.installed_app(app_name) is None)

def wait_for_bookmark_icon_not_present(self, bookmark_title):
self.wait_for_condition(lambda m: self.bookmark(bookmark_title) is None)

def is_app_installed(self, app_name):
"""Checks whether app is installed"""
return self.installed_app(app_name) is not None
Expand Down Expand Up @@ -122,6 +126,11 @@ def installed_app(self, app_name):
if root_el.text == app_name:
return self.InstalledApp(self.marionette, root_el)

def bookmark(self, bookmark_title):
for root_el in self.marionette.find_elements(*self._bookmark_icons_locator):
if root_el.text == bookmark_title:
return self.InstalledApp(self.marionette, root_el)

class InstalledApp(PageRegion):

_delete_app_locator = (By.CSS_SELECTOR, 'span.remove')
Expand Down
Expand Up @@ -11,9 +11,10 @@ class ConfirmDialog(Base):

_confirm_button_locator = (By.CSS_SELECTOR, 'gaia-confirm .confirm')

def tap_confirm(self):
def tap_confirm(self, bookmark=False):
# TODO add a good wait here when Bug 1008961 is resolved
time.sleep(1)
self.marionette.switch_to_frame()
if not bookmark:
self.marionette.switch_to_frame()
self.wait_for_element_displayed(*self._confirm_button_locator)
self.marionette.find_element(*self._confirm_button_locator).tap()
Expand Up @@ -45,3 +45,15 @@ def test_browser_bookmark(self):
self._bookmark_added = homescreen.is_app_installed(self.bookmark_title)

self.assertTrue(self._bookmark_added, 'The bookmark %s was not found to be installed on the home screen.' % self.bookmark_title)

# Delete the bookmark
homescreen.activate_edit_mode()
homescreen.bookmark(self.bookmark_title).tap_delete_app().tap_confirm(bookmark=True)

self.wait_for_condition(lambda m: self.apps.displayed_app.name == homescreen.name)
self.apps.switch_to_displayed_app()
homescreen.wait_for_bookmark_icon_not_present(self.bookmark_title)

# Check that the bookmark icon is no longer displayed on the homescreen
self._bookmark_added = homescreen.is_app_installed(self.bookmark_title)
self.assertFalse(self._bookmark_added, 'The bookmark %s was not successfully removed from homescreen.' % self.bookmark_title)

0 comments on commit 41e9fe1

Please sign in to comment.