Skip to content
Permalink
Browse files

Merge pull request #31812 from mermi/bug1188926

Bug 1188926 - Make all the apps have an manifestURL as well as a name and check for that
  • Loading branch information...
mwargers committed Sep 13, 2015
2 parents 94c1318 + b03213a commit 4d9b996be4b1935651057d0651461c1a36d98a18
Showing with 75 additions and 43 deletions.
  1. +3 −3 tests/atoms/gaia_apps.js
  2. +11 −1 tests/python/gaia-ui-tests/gaiatest/apps/base.py
  3. +2 −1 tests/python/gaia-ui-tests/gaiatest/apps/bzlite/app.py
  4. +3 −3 tests/python/gaia-ui-tests/gaiatest/apps/camera/app.py
  5. +5 −3 tests/python/gaia-ui-tests/gaiatest/apps/contacts/app.py
  6. +2 −1 tests/python/gaia-ui-tests/gaiatest/apps/contacts/regions/contact_form.py
  7. +2 −1 tests/python/gaia-ui-tests/gaiatest/apps/contacts/regions/gmail.py
  8. +2 −0 tests/python/gaia-ui-tests/gaiatest/apps/fmradio/app.py
  9. +1 −1 tests/python/gaia-ui-tests/gaiatest/apps/gallery/app.py
  10. +1 −1 tests/python/gaia-ui-tests/gaiatest/apps/gallery/regions/fullscreen_image.py
  11. +5 −3 tests/python/gaia-ui-tests/gaiatest/apps/gallery/regions/view_image.py
  12. +1 −0 tests/python/gaia-ui-tests/gaiatest/apps/marketplace/app.py
  13. +3 −1 tests/python/gaia-ui-tests/gaiatest/apps/messages/app.py
  14. +2 −1 tests/python/gaia-ui-tests/gaiatest/apps/messages/regions/activities.py
  15. +1 −1 tests/python/gaia-ui-tests/gaiatest/apps/messages/regions/new_message.py
  16. +2 −1 tests/python/gaia-ui-tests/gaiatest/apps/phone/app.py
  17. +1 −1 tests/python/gaia-ui-tests/gaiatest/apps/phone/regions/keypad.py
  18. +2 −1 tests/python/gaia-ui-tests/gaiatest/apps/ring_tone/app.py
  19. +0 −1 tests/python/gaia-ui-tests/gaiatest/apps/search/app.py
  20. +1 −1 tests/python/gaia-ui-tests/gaiatest/apps/settings/app.py
  21. +3 −3 tests/python/gaia-ui-tests/gaiatest/apps/system/regions/activities.py
  22. +2 −3 tests/python/gaia-ui-tests/gaiatest/apps/system/regions/facebook.py
  23. +1 −0 tests/python/gaia-ui-tests/gaiatest/apps/system/regions/iac_publisher.py
  24. +1 −0 tests/python/gaia-ui-tests/gaiatest/apps/testapp/app.py
  25. +1 −0 tests/python/gaia-ui-tests/gaiatest/apps/ui_tests/app.py
  26. +2 −1 tests/python/gaia-ui-tests/gaiatest/apps/ui_tests_privileged/app.py
  27. +1 −0 tests/python/gaia-ui-tests/gaiatest/apps/videoplayer/app.py
  28. +1 −1 tests/python/gaia-ui-tests/gaiatest/apps/wallpaper/app.py
  29. +11 −7 tests/python/gaia-ui-tests/gaiatest/gaia_test.py
  30. +1 −1 tests/python/gaia-ui-tests/gaiatest/tests/functional/dialer/test_call_log_all_calls.py
  31. +1 −1 tests/python/gaia-ui-tests/gaiatest/tests/functional/lockscreen/test_lockscreen_unlock_to_camera.py
@@ -372,13 +372,13 @@ var GaiaApps = {
.query('AppWindowManager.getActiveWindow').getTopMostWindow();
}

let origin = app.origin;
console.log('app with origin \'' + origin + '\' is displayed');
console.log('app with manifestURL \'' + app.manifestURL + '\' displayed');
let result = {
frame: (app.browser) ? app.browser.element : app.frame.firstChild,
src: (app.browser) ? app.browser.element.src : app.iframe.src,
name: app.name,
origin: origin
origin: app.origin,
manifestURL: app.manifestURL
};
return result;
},
@@ -12,13 +12,14 @@


class Base(object):
DEFAULT_APP_HOSTNAME = '.gaiamobile.org'
DEFAULT_PROTOCOL = 'app://'

def __init__(self, marionette):
self.marionette = marionette
self.apps = GaiaApps(self.marionette)
self.accessibility = Accessibility(self.marionette)
self.frame = None
self.manifest_url = hasattr(self, 'manifest_url') and self.manifest_url or None
self.entry_point = hasattr(self, 'entry_point') and self.entry_point or None

def launch(self, launch_timeout=None):
@@ -114,6 +115,15 @@ def keyboard(self):
from gaiatest.apps.keyboard.app import Keyboard
return Keyboard(self.marionette)

@property
def manifest_url(self):
return '{}{}{}/manifest.webapp'.format(self.DEFAULT_PROTOCOL, self.__class__.__name__.lower(), self.DEFAULT_APP_HOSTNAME)

def wait_to_be_displayed(self):
Wait(self.marionette).until(lambda m: self.apps.displayed_app.manifest_url == self.manifest_url)

def wait_to_not_be_displayed(self):
Wait(self.marionette).until(lambda m: self.apps.displayed_app.manifest_url != self.manifest_url)

class PageRegion(Base):
def __init__(self, marionette, element):
@@ -4,6 +4,7 @@
class BugzillaLite(Base):

name = 'Bugzilla Lite'
manifest_url = "https://www.bzlite.com/manifest.webapp"
_given_username = (By.CSS_SELECTOR, "#login input[type='email']")
_given_password = (By.CSS_SELECTOR, "#login input[type='password']")
_button_login = (By.CSS_SELECTOR, "#login input[type='submit']")
@@ -12,7 +13,7 @@ class BugzillaLite(Base):
_dashboard_navigator_locator = (By.ID, 'dashboardNav')
_login_form_locator = (By.ID, 'login')
_popup_intro = (By.ID, 'intro')
_button_popup_intro = (By.ID, 'intro-submit')
_button_popup_intro = (By.ID, 'intro-submit')
def login (self, username, password):
username_element = self.marionette.find_element(*self._given_username)
username_element.tap()
@@ -87,7 +87,7 @@ def tap_select_button(self):
self.tap_element_from_system_app(select)

# Fall back to app beneath the picker
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name != self.name)
self.wait_to_not_be_displayed()
self.apps.switch_to_displayed_app()

def tap_switch_source(self):
@@ -138,7 +138,7 @@ def tap_switch_to_gallery(self):
switch_to_gallery_button.tap()
from gaiatest.apps.gallery.app import Gallery
gallery_app = Gallery(self.marionette)
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == gallery_app.name)
gallery_app.wait_to_be_displayed()
self.apps.switch_to_displayed_app()
return gallery_app

@@ -232,7 +232,7 @@ def tap_switch_to_gallery(self):
self.marionette.find_element(*self._gallery_button_locator).tap()
from gaiatest.apps.gallery.app import Gallery
gallery_app = Gallery(self.marionette)
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == gallery_app.name)
gallery_app.wait_to_be_displayed()
self.apps.switch_to_displayed_app()
Wait(self.marionette).until(expected.element_displayed(*self._thumbnail_list_view_locator))

@@ -12,6 +12,8 @@
class Contacts(Base):

name = "Contacts"
entry_point = "contacts"
manifest_url = '{}communications{}/manifest.webapp'.format(Base.DEFAULT_PROTOCOL,Base.DEFAULT_APP_HOSTNAME)

_new_contact_button_locator = (By.ID, 'add-contact-button')
_settings_button_locator = (By.ID, 'settings-button')
@@ -32,7 +34,7 @@ def launch(self):
*self._settings_button_locator))))

def switch_to_contacts_frame(self):
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == self.name)
self.wait_to_be_displayed()
self.apps.switch_to_displayed_app()

@property
@@ -154,13 +156,13 @@ def _return_class_from_tap(self, return_class='ContactDetails'):
return ContactDetails(self.marionette)
elif return_class == 'EditContact':
# This may seem superfluous but we can enter EditContact from Contacts, or from ActivityPicker
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == Contacts.name)
Contacts(self.marionette).wait_to_be_displayed()
self.apps.switch_to_displayed_app()
from gaiatest.apps.contacts.regions.contact_form import EditContact
return EditContact(self.marionette)
elif return_class == 'SelectContact':
return None
else:
# We are using contacts picker in activity - after choosing, fall back to open app
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name != Contacts.name)
Contacts(self.marionette).wait_to_not_be_displayed()
self.apps.switch_to_displayed_app()
@@ -154,7 +154,8 @@ def tap_update(self, return_details=True):
return ContactDetails(self.marionette)
else:
# else we drop back to the underlying app
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name != self.name)
from gaiatest.apps.contacts.app import Contacts
Contacts(self.marionette).wait_to_not_be_displayed()
self.apps.switch_to_displayed_app()

def tap_cancel(self):
@@ -40,7 +40,8 @@ def tap_grant_access(self):
Wait(self.marionette).until(expected.element_enabled(grant_access))
grant_access.tap()
# Go back to displayed Contacts app before waiting for the picker
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == 'Contacts')
from gaiatest.apps.contacts.app import Contacts
Contacts(self.marionette).wait_to_be_displayed()
self.apps.switch_to_displayed_app()
from gaiatest.apps.contacts.regions.contact_import_picker import ContactImportPicker
return ContactImportPicker(self.marionette)
@@ -11,6 +11,7 @@

class FmRadio(Base):
name = 'FM Radio'
manifest_url = '{}fm{}/manifest.webapp'.format(Base.DEFAULT_PROTOCOL,Base.DEFAULT_APP_HOSTNAME)

_power_button_locator = (By.ID, 'power-switch')
_favorite_list_locator = (By.CSS_SELECTOR, 'div.fav-list-item')
@@ -22,6 +23,7 @@ class FmRadio(Base):
_airplane_mode_title_locator = (By.CSS_SELECTOR, 'div[data-l10n-id="airplaneModeHeader"]')
_airplane_mode_text_locator = (By.CSS_SELECTOR, 'div[data-l10n-id="airplaneModeMsg"]')


def launch(self, airplane_mode=False):
Base.launch(self)
power = Wait(self.marionette).until(
@@ -80,7 +80,7 @@ def switch_to_camera(self):
switch_to_camera_button = self.marionette.find_element(*self._switch_to_camera_button_locator)
switch_to_camera_button.tap()
camera_app = gaiatest.apps.camera.app.Camera(self.marionette)
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == camera_app.name)
camera_app.wait_to_be_displayed()
self.apps.switch_to_displayed_app()
return camera_app

@@ -99,7 +99,7 @@ def tap_switch_to_camera(self):
self.marionette.find_element(*self._camera_locator).tap()
from gaiatest.apps.camera.app import Camera
camera_app = Camera(self.marionette)
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == camera_app.name)
camera_app.wait_to_be_displayed()
self.apps.switch_to_displayed_app()
camera_app.wait_for_capture_ready()
Wait(self.marionette).until(expected.element_not_displayed(*self._loading_screen_locator))
@@ -13,12 +13,13 @@ class ViewImage(Base):
_banner_message_locator = (By.ID, 'message')
_save_image_button_locator = (By.ID, 'save')
_image_locator = (By.CSS_SELECTOR, 'img.image-view')
manifest_url = '{}gallery{}/manifest.webapp'.format(Base.DEFAULT_PROTOCOL,Base.DEFAULT_APP_HOSTNAME)

def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == 'Gallery')
from gaiatest.apps.gallery.app import Gallery
Gallery(self.marionette).wait_to_be_displayed()
self.apps.switch_to_displayed_app()

Wait(self.marionette).until(expected.element_displayed(
Wait(self.marionette).until(expected.element_present(
*self._image_locator))))
@@ -40,7 +41,8 @@ def tap_back_button(self):
self.tap_element_from_system_app(header, x=20)

# wait for the frame to close
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name != 'Gallery')
from gaiatest.apps.gallery.app import Gallery
Gallery(self.marionette).wait_to_not_be_displayed()

self.apps.switch_to_displayed_app()

@@ -17,6 +17,7 @@ class Marketplace(Base):
_marketplace_iframe_locator = (By.CSS_SELECTOR, 'iframe[src*="marketplace"]')
_search_toggle_locator = (By.CSS_SELECTOR, '.header--search-toggle')
name = 'Marketplace'
manifest_url = 'https://marketplace.firefox.com/packaged.webapp'

def search(self, term):
iframe = Wait(self.marionette).until(
@@ -11,6 +11,7 @@
class Messages(Base):

name = 'Messages'
manifest_url = '{}sms{}/manifest.webapp'.format(Base.DEFAULT_PROTOCOL, Base.DEFAULT_APP_HOSTNAME)

_create_new_message_locator = (By.ID, 'threads-composer-link')
_first_message_locator = (By.ID, 'thread-1')
@@ -44,7 +45,8 @@ def tap_create_new_message(self):

def tap_settings(self):
self.marionette.find_element(*self._settings_icon_locator).tap()
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == 'Settings')
from gaiatest.apps.settings.app import Settings
Settings(self.marionette).wait_to_be_displayed()
self.apps.switch_to_displayed_app()
from gaiatest.apps.messages.regions.messaging_settings import MessagingSettings
return MessagingSettings(self.marionette)
@@ -30,7 +30,8 @@ def __init__(self, marionette):

def tap_settings(self):
self.marionette.find_element(*self._settings_button_locator).tap()
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == 'Settings')
from gaiatest.apps.Settings.app import Settings
Settings(self.marionette).wait_to_be_displayed()
self.apps.switch_to_displayed_app()
from gaiatest.apps.messages.regions.messaging_settings import MessagingSettings
return MessagingSettings(self.marionette)
@@ -28,7 +28,7 @@ class NewMessage(Messages):

def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == self.name)
self.wait_to_be_displayed()
self.apps.switch_to_displayed_app()
element = Wait(self.marionette).until(
expected.element_present(*self._panel_conversationview_locator))
@@ -10,7 +10,8 @@
class Phone(Base):

name = "Phone"

entry_point = "dialer"
manifest_url = '{}communications{}/manifest.webapp'.format(Base.DEFAULT_PROTOCOL,Base.DEFAULT_APP_HOSTNAME)
_dialog_locator = (By.ID, 'confirmation-message')
_dialog_title_locator = (By.XPATH, "//*[@id='confirmation-message']/section/h1")
_call_log_toolbar_button_locator = (By.ID, 'option-recents')
@@ -74,7 +74,7 @@ class Keypad(BaseKeypad, Phone):

def __init__(self, marionette):
Phone.__init__(self, marionette)
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == self.name)
self.wait_to_be_displayed()
self.apps.switch_to_displayed_app()
keypad_toolbar_button = self.marionette.find_element(*self._keypad_toolbar_button_locator)
Wait(self.marionette).until(lambda m: 'toolbar-option-selected' in keypad_toolbar_button.get_attribute('class'))
@@ -9,6 +9,7 @@

class RingTone(Base):
name = 'Ringtones'
manifest_url = '{}ringtones{}/manifest.webapp'.format(Base.DEFAULT_PROTOCOL,Base.DEFAULT_APP_HOSTNAME)
_screen_locator = (By.ID, 'list-parent')
_header_locator = (By.ID, 'header')
_ring_tone_locator = (By.CSS_SELECTOR, '#list-parent section > ul > li')
@@ -18,7 +19,7 @@ class RingTone(Base):

def __init__(self, marionette):
Base.__init__(self, marionette)
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == self.name)
self.wait_to_be_displayed()
self.apps.switch_to_displayed_app()

def set_ringtone(self):
@@ -9,7 +9,6 @@
class Search(Base):

name = 'Browser'
manifest_url = "app://search.gaiamobile.org/manifest.webapp"

_url_bar_locator = (By.CSS_SELECTOR, 'div.search-app .urlbar .title')
_history_item_locator = (By.CSS_SELECTOR, '#history .result')
@@ -89,7 +89,7 @@ def launch(self):
expected.element_present(*self._bluetooth_menu_item_locator))

def switch_to_settings_app(self):
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == self.name)
self.wait_to_be_displayed()
self.apps.switch_to_displayed_app()

def enable_airplane_mode(self):
@@ -36,7 +36,7 @@ def tap_wallpaper(self):
expected.element_not_displayed(*self._actions_menu_locator))
from gaiatest.apps.wallpaper.app import Wallpaper
wallpaper = Wallpaper(self.marionette)
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == wallpaper.name)
wallpaper.wait_to_be_displayed()
self.apps.switch_to_displayed_app()
return wallpaper

@@ -50,7 +50,7 @@ def tap_gallery(self):
expected.element_not_displayed(actions_menu))
from gaiatest.apps.gallery.app import Gallery
gallery = Gallery(self.marionette)
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == gallery.name)
gallery.wait_to_be_displayed()
self.apps.switch_to_displayed_app()
return gallery

@@ -64,7 +64,7 @@ def tap_camera(self):
expected.element_not_displayed(actions_menu))
from gaiatest.apps.camera.app import Camera
camera = Camera(self.marionette)
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == camera.name)
camera.wait_to_be_displayed()
self.apps.switch_to_displayed_app()
camera.wait_for_capture_ready()
return camera
@@ -58,9 +58,8 @@ def login(self, user, password):
self.type_password(password)
self.tap_submit()

# Go back to displayed Contacts app before waiting for the picker
Wait(self.marionette).until(
lambda m: self.apps.displayed_app.name == 'Contacts')
from gaiatest.apps.contacts.app import Contacts
Contacts(self.marionette).wait_to_be_displayed()
self.apps.switch_to_displayed_app()

# switch to facebook import page to select the friends
@@ -10,6 +10,7 @@
class IacPublisher(Base):

name = "Test IAC Publisher"
manifest_url = '{}test-iac-publisher{}/manifest.webapp'.format(Base.DEFAULT_PROTOCOL,Base.DEFAULT_APP_HOSTNAME)

_pub_app_msg_to_send_locator = (By.ID, "msgToSend")
_pub_app_send_button_locator = (By.ID, "sendButton")
@@ -10,6 +10,7 @@
class TestContainer(Base):

name = 'Test Container'
manifest_url = '{}test-container{}/manifest.webapp'.format(Base.DEFAULT_PROTOCOL,Base.DEFAULT_APP_HOSTNAME)

_app_selector = (By.CSS_SELECTOR,
'iframe[src*="test-container"][src*="/index.html"]')
@@ -11,6 +11,7 @@


class UiTests(Base):
manifest_url = '{}uitest{}/manifest.webapp'.format(Base.DEFAULT_PROTOCOL,Base.DEFAULT_APP_HOSTNAME)
_test_panel_header_locator = (By.CSS_SELECTOR, '#test-panel-header')
_ui_page_locator = (By.CSS_SELECTOR, 'a[href="#UI"]')
_api_page_locator = (By.CSS_SELECTOR, 'a[href="#API"]')
@@ -9,9 +9,10 @@

UI_TESTS_PRIVILEGED = "UI tests - Privileged App"


class UiTestsPivileged(Base):

manifest_url = '{}uitest-privileged{}/manifest.webapp'.format(Base.DEFAULT_PROTOCOL,Base.DEFAULT_APP_HOSTNAME)

_contacts_locator = (By.LINK_TEXT, 'Contacts')
_get_user_media_locator = (By.LINK_TEXT, 'getUserMedia')
_geolocation_locator = (By.LINK_TEXT, 'Geolocation')
@@ -10,6 +10,7 @@
class VideoPlayer(Base):

name = 'Video'
manifest_url = '{}video{}/manifest.webapp'.format(Base.DEFAULT_PROTOCOL,Base.DEFAULT_APP_HOSTNAME)

_thumbnails_locator = (By.ID, 'thumbnails')

@@ -19,5 +19,5 @@ def tap_wallpaper_by_index(self, index):
message='%d wallpaper(s) not present after timeout' % (index + 1))
self.tap_element_from_system_app(
self.marionette.find_elements(*self._stock_wallpapers_locator)[index])
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name != self.name)
self.wait_to_not_be_displayed()
self.apps.switch_to_displayed_app()

0 comments on commit 4d9b996

Please sign in to comment.
You can’t perform that action at this time.