Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
0
gaia/tests/python/gaia-ui-tests/gaiatest/apps/search/__init__.py
Executable file
0
gaia/tests/python/gaia-ui-tests/gaiatest/apps/search/__init__.py
Executable file
47
gaia/tests/python/gaia-ui-tests/gaiatest/apps/search/app.py
Executable file
47
gaia/tests/python/gaia-ui-tests/gaiatest/apps/search/app.py
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
# 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_driver import expected, By, Wait
|
||||
|
||||
|
||||
class Search(Base):
|
||||
|
||||
name = 'Browser'
|
||||
|
||||
_browser_app_locator = (By.CSS_SELECTOR, 'div[data-manifest-name="Browser"][transition-state="opened"]')
|
||||
_url_bar_locator = (By.CSS_SELECTOR, 'div.search-app .urlbar .title')
|
||||
_history_locator = (By.ID, 'history')
|
||||
_history_item_locator = (By.CSS_SELECTOR, '#history .result')
|
||||
|
||||
def switch_to_content(self):
|
||||
web_frame = self.marionette.find_element(*self._browser_app_locator)
|
||||
self.marionette.switch_to_frame(web_frame)
|
||||
|
||||
def switch_to_chrome(self):
|
||||
self.marionette.switch_to_frame()
|
||||
|
||||
def go_to_url(self, url):
|
||||
# The URL bar shown is actually in the system app not in this Search app.
|
||||
# We switch back to the system app, then tap the panel, but this will only
|
||||
# work from Search app which embiggens the input bar
|
||||
self.marionette.switch_to_frame()
|
||||
if self.is_element_present(*self._url_bar_locator):
|
||||
self.marionette.find_element(*self._url_bar_locator).tap()
|
||||
else:
|
||||
self._url_bar_locator = (By.CSS_SELECTOR, '.urlbar .title')
|
||||
self._root_element = self.marionette.find_element(*self._browser_app_locator)
|
||||
self._root_element.find_element(*self._url_bar_locator).tap()
|
||||
|
||||
from gaiatest.apps.system.regions.search_panel import SearchPanel
|
||||
search_panel = SearchPanel(self.marionette)
|
||||
return search_panel.go_to_url(url)
|
||||
|
||||
@property
|
||||
def history_items_count(self):
|
||||
Wait(self.marionette).until(expected.element_present(*self._history_locator))
|
||||
return len(self.marionette.find_elements(*self._history_item_locator))
|
||||
|
||||
def wait_for_history_to_load(self, number_of_items=1):
|
||||
Wait(self.marionette).until(lambda m: self.history_items_count == number_of_items)
|
||||
0
gaia/tests/python/gaia-ui-tests/gaiatest/apps/search/regions/__init__.py
Executable file
0
gaia/tests/python/gaia-ui-tests/gaiatest/apps/search/regions/__init__.py
Executable file
107
gaia/tests/python/gaia-ui-tests/gaiatest/apps/search/regions/browser.py
Executable file
107
gaia/tests/python/gaia-ui-tests/gaiatest/apps/search/regions/browser.py
Executable file
|
|
@ -0,0 +1,107 @@
|
|||
# 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_driver import expected, By, Wait
|
||||
|
||||
|
||||
class Browser(Base):
|
||||
|
||||
_browser_app_locator = (By.CSS_SELECTOR, 'div[data-manifest-name="Browser"][transition-state="opened"], 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.CSS_SELECTOR, 'button[data-id="add-to-homescreen"]')
|
||||
_share_button_locator = (By.CSS_SELECTOR, 'button[data-id="share"]')
|
||||
_share_to_messages_button_locator = (By.CSS_SELECTOR, 'button[data-manifest="app://sms.gaiamobile.org/manifest.webapp"]')
|
||||
_browser_menu_locator = (By.CSS_SELECTOR, '.contextmenu-list')
|
||||
|
||||
_back_button_locator = (By.CSS_SELECTOR, '.back-button')
|
||||
_forward_button_locator = (By.CSS_SELECTOR, '.forward-button')
|
||||
_reload_button_locator = (By.CSS_SELECTOR, '.reload-button')
|
||||
|
||||
_url_bar_locator = (By.CSS_SELECTOR, '.urlbar .title')
|
||||
|
||||
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 self._root_element.get_attribute('loading-state') == "true"
|
||||
|
||||
def wait_for_page_to_start_loading(self):
|
||||
Wait(self.marionette).until(lambda m: self.is_page_loading)
|
||||
|
||||
def wait_for_page_to_load(self, timeout=30):
|
||||
Wait(self.marionette, timeout).until(lambda m: not self.is_page_loading)
|
||||
|
||||
def tap_menu_button(self):
|
||||
self._root_element.find_element(*self._menu_button_locator).tap()
|
||||
Wait(self.marionette).until(
|
||||
expected.element_displayed(*self._browser_menu_locator))
|
||||
|
||||
def tap_add_to_home(self):
|
||||
element = self._root_element.find_element(*self._add_to_home_button_locator)
|
||||
Wait(self.marionette).until(expected.element_displayed(element))
|
||||
element.tap()
|
||||
from gaiatest.apps.homescreen.regions.bookmark_menu import BookmarkMenu
|
||||
return BookmarkMenu(self.marionette)
|
||||
|
||||
def tap_share(self):
|
||||
element = self._root_element.find_element(*self._share_button_locator)
|
||||
Wait(self.marionette).until(expected.element_displayed(element))
|
||||
element.tap()
|
||||
|
||||
def tap_share_to_messages(self):
|
||||
element = Wait(self.marionette).until(
|
||||
expected.element_present(*self._share_to_messages_button_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(element))
|
||||
element.tap()
|
||||
from gaiatest.apps.messages.regions.new_message import NewMessage
|
||||
return NewMessage(self.marionette)
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
return self._root_element.find_element(*self._browser_frame_locator).get_attribute('data-url')
|
||||
|
||||
def tap_back_button(self):
|
||||
current_url = self.url
|
||||
self._root_element.find_element(*self._back_button_locator).tap()
|
||||
Wait(self.marionette).until(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()
|
||||
Wait(self.marionette).until(lambda m: self.url != current_url)
|
||||
|
||||
def tap_reload_button(self):
|
||||
button = self._root_element.find_element(*self._reload_button_locator)
|
||||
# when the page is loading, this button will not be visible
|
||||
Wait(self.marionette).until(expected.element_displayed(button))
|
||||
button.tap()
|
||||
|
||||
def go_to_url(self, url):
|
||||
self._root_element.find_element(*self._url_bar_locator).tap()
|
||||
from gaiatest.apps.system.regions.search_panel import SearchPanel
|
||||
search_panel = SearchPanel(self.marionette)
|
||||
return search_panel.go_to_url(url)
|
||||
|
||||
class PrivateWindow(Browser):
|
||||
_browser_app_locator = (By.CSS_SELECTOR, 'div.private[data-manifest-name="Browser"][transition-state="opened"]')
|
||||
|
||||
def __init__(self, marionette):
|
||||
Browser.__init__(self, marionette)
|
||||
# Workaround for bug 1204831 where the focus can be removed from the url bar when
|
||||
# the private browser is not ready with loading yet
|
||||
url_bar = self._root_element.find_element(*self._url_bar_locator)
|
||||
Wait(self.marionette).until(lambda m: url_bar.text != 'system.gaiamobile.org')
|
||||
119
gaia/tests/python/gaia-ui-tests/gaiatest/apps/search/regions/html5_player.py
Executable file
119
gaia/tests/python/gaia-ui-tests/gaiatest/apps/search/regions/html5_player.py
Executable file
|
|
@ -0,0 +1,119 @@
|
|||
# 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/.
|
||||
|
||||
import time
|
||||
|
||||
from marionette_driver import expected, By, Wait
|
||||
|
||||
from gaiatest.apps.base import Base
|
||||
from gaiatest.apps.base import PageRegion
|
||||
|
||||
|
||||
class HTML5Player(PageRegion):
|
||||
"""Represents HTML5 Player.
|
||||
|
||||
Reference:
|
||||
http://www.w3.org/TR/2012/WD-html5-20121025/media-elements.html#media-element
|
||||
"""
|
||||
|
||||
_video_element_locator = (By.TAG_NAME, 'video')
|
||||
|
||||
def __init__(self, marionette):
|
||||
Base.__init__(self, marionette)
|
||||
self.root_element = Wait(self.marionette).until(
|
||||
expected.element_present(*self._video_element_locator))
|
||||
Wait(self.marionette).until(
|
||||
expected.element_displayed(self.root_element))
|
||||
|
||||
def wait_for_video_loaded(self):
|
||||
# Wait long enough to make sure enough of the video has been loaded
|
||||
Wait(self.marionette, timeout=60).until(
|
||||
lambda m: int(self.root_element.get_attribute('readyState')) == 4)
|
||||
|
||||
@property
|
||||
def is_fullscreen(self):
|
||||
return self.marionette.execute_script("""return document.mozFullScreenElement ==
|
||||
document.getElementsByTagName("video")[0]""")
|
||||
|
||||
@property
|
||||
def is_playing(self):
|
||||
return self.root_element.get_attribute('paused') != 'true'
|
||||
|
||||
@property
|
||||
def is_muted(self):
|
||||
return self.root_element.get_attribute('muted') == 'true'
|
||||
|
||||
@property
|
||||
def is_ended(self):
|
||||
return self.root_element.get_attribute('ended') == 'true'
|
||||
|
||||
@property
|
||||
def controls_visible(self):
|
||||
return (int(self.get_location('playButton')[0]) > 0)
|
||||
|
||||
def invoke_controls(self):
|
||||
Wait(self.marionette).until(lambda m: not self.controls_visible)
|
||||
self.root_element.tap()
|
||||
Wait(self.marionette).until(lambda m: self.controls_visible)
|
||||
|
||||
def show_controls(self):
|
||||
Wait(self.marionette).until(lambda m: not self.controls_visible)
|
||||
self.marionette.execute_script("""
|
||||
var a = Components.classes["@mozilla.org/inspector/dom-utils;1"]
|
||||
.getService(Components.interfaces.inIDOMUtils)
|
||||
.getChildrenForNode(document.getElementsByTagName('video')[0], true);
|
||||
var x = a[1].ownerDocument.getAnonymousElementByAttribute(a[1],'class', 'controlBar');
|
||||
x.removeAttribute('hidden');
|
||||
""", sandbox='system')
|
||||
Wait(self.marionette).until(lambda m: self.controls_visible)
|
||||
|
||||
def get_location(self, class_name):
|
||||
return self.marionette.execute_script("""
|
||||
var a = Components.classes["@mozilla.org/inspector/dom-utils;1"]
|
||||
.getService(Components.interfaces.inIDOMUtils)
|
||||
.getChildrenForNode(document.getElementsByTagName('video')[0], true);
|
||||
var x1 = document.getElementsByTagName('video')[0].getBoundingClientRect().left;
|
||||
var x2 = a[1].ownerDocument
|
||||
.getAnonymousElementByAttribute(a[1],'class', '%s')
|
||||
.getBoundingClientRect().left;
|
||||
var y1 = document.getElementsByTagName('video')[0]
|
||||
.getBoundingClientRect().top;
|
||||
var y2 = a[1].ownerDocument.getAnonymousElementByAttribute(a[1],'class', '%s')
|
||||
.getBoundingClientRect().top;
|
||||
return (Math.floor(x2-x1) + ',' + Math.floor(y2-y1));
|
||||
""" % (class_name, class_name), sandbox='system').split(',')
|
||||
|
||||
def tap_video_control(self, class_name):
|
||||
location = self.get_location(class_name)
|
||||
if location[0] <= 0 or location[1] <= 0:
|
||||
print 'x=%d, y=%d' % (location[0], location[1])
|
||||
self.assertTrue(False)
|
||||
self.root_element.tap(x=int(location[0]) + 5, y=int(location[1]) + 5)
|
||||
|
||||
def tap_play(self):
|
||||
self.tap_video_control('playButton')
|
||||
Wait(self.marionette).until(lambda m: self.is_playing)
|
||||
# Tapping the play button makes the controls disappear, wait for that to happen
|
||||
Wait(self.marionette).until(lambda m: not self.controls_visible)
|
||||
|
||||
def tap_pause(self):
|
||||
self.tap_video_control('playButton')
|
||||
Wait(self.marionette).until(lambda m: not self.is_playing)
|
||||
|
||||
def tap_mute(self):
|
||||
Wait(self.marionette).until(lambda m: not self.is_muted)
|
||||
self.tap_video_control('muteButton')
|
||||
Wait(self.marionette).until(lambda m: self.is_muted)
|
||||
|
||||
def tap_unmute(self):
|
||||
Wait(self.marionette).until(lambda m: self.is_muted)
|
||||
self.tap_video_control('muteButton')
|
||||
Wait(self.marionette).until(lambda m: not self.is_muted)
|
||||
|
||||
def tap_full_screen(self):
|
||||
self.tap_video_control('fullscreenButton')
|
||||
|
||||
@property
|
||||
def current_timestamp(self):
|
||||
return float(self.root_element.get_attribute('currentTime'))
|
||||
Loading…
Reference in a new issue