This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1059245 - Update tests and framework to use the new Browser app
- Loading branch information
Robert Chira
authored and
Robert Chira
committed
Aug 29, 2014
1 parent
0535f7a
commit d4747df
Showing
18 changed files
with
168 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
from gaiatest.apps.base import Base | ||
from marionette.by import By | ||
|
||
|
||
class Search(Base): | ||
|
||
name = 'Browser' | ||
|
||
_url_bar_locator = (By.CSS_SELECTOR, 'div.search-app .urlbar .title') | ||
|
||
def launch(self): | ||
Base.launch(self) | ||
self.wait_for_condition(lambda m: self.apps.displayed_app.name == self.name) | ||
self.wait_for_element_displayed(*self._url_bar_locator) | ||
|
||
def go_to_url(self, url): | ||
self.marionette.find_element(*self._url_bar_locator).tap() | ||
|
||
from gaiatest.apps.homescreen.regions.search_panel import SearchPanel | ||
search_panel = SearchPanel(self.marionette) | ||
search_panel.go_to_url(url) | ||
|
||
from regions.browser import Browser2 | ||
return Browser2(self.marionette) |
Empty file.
67 changes: 67 additions & 0 deletions
67
tests/python/gaia-ui-tests/gaiatest/apps/search/regions/browser.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
from gaiatest.apps.base import Base | ||
from marionette.by import By | ||
|
||
|
||
class Browser2(Base): | ||
|
||
_browser_app_locator = (By.CSS_SELECTOR, 'div.browser[transition-state="opened"]') | ||
_browser_frame_locator = (By.CSS_SELECTOR, 'iframe.browser') | ||
|
||
_menu_button_locator = (By.CSS_SELECTOR, '.menu-button') | ||
_add_to_home_button_locator = (By.ID, 'add-to-home') | ||
_browser_menu_locator = (By.CSS_SELECTOR, '.overflow-menu') | ||
|
||
_back_button_locator = (By.CSS_SELECTOR, '.back-button') | ||
_forward_button_locator = (By.CSS_SELECTOR, '.forward-button') | ||
|
||
def __init__(self, marionette): | ||
Base.__init__(self, marionette) | ||
self.marionette.switch_to_frame() | ||
self._root_element = self.marionette.find_element(*self._browser_app_locator) | ||
|
||
def switch_to_content(self): | ||
web_frame = self._root_element.find_element(*self._browser_frame_locator) | ||
self.marionette.switch_to_frame(web_frame) | ||
|
||
def switch_to_chrome(self): | ||
self.marionette.switch_to_frame() | ||
|
||
@property | ||
def is_page_loading(self): | ||
return "loading" in self._root_element.value_of_css_property('class') | ||
|
||
def wait_for_page_to_load(self, timeout=30): | ||
self.wait_for_condition(lambda m: not self.is_page_loading, timeout=timeout) | ||
|
||
def tap_menu_button(self): | ||
self._root_element.find_element(*self._menu_button_locator).tap() | ||
self.wait_for_element_displayed(*self._browser_menu_locator) | ||
|
||
def tap_add_to_home(self): | ||
self.wait_for_element_displayed(*self._add_to_home_button_locator) | ||
self._root_element.find_element(*self._add_to_home_button_locator).tap() | ||
from gaiatest.apps.homescreen.regions.bookmark_menu import BookmarkMenu | ||
|
||
return BookmarkMenu(self.marionette) | ||
|
||
@property | ||
def url(self): | ||
return self._root_element.find_element(*self._browser_frame_locator).get_attribute('data-url') | ||
|
||
@property | ||
def data_origin(self): | ||
return self._root_element.find_element(*self._browser_frame_locator).get_attribute('data-frame-origin') | ||
|
||
def tap_back_button(self): | ||
current_url = self.url | ||
self._root_element.find_element(*self._back_button_locator).tap() | ||
self.wait_for_condition(lambda m: self.url != current_url) | ||
|
||
def tap_forward_button(self): | ||
current_url = self.url | ||
self._root_element.find_element(*self._forward_button_locator).tap() | ||
self.wait_for_condition(lambda m: self.url != current_url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 0 additions & 52 deletions
52
tests/python/gaia-ui-tests/gaiatest/tests/functional/browser/test_browser_tabs.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.