17
17
# You should have received a copy of the GNU General Public License
18
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
from ubuntu_system_tests.helpers import autopilot
22
from ubuntu_system_tests.helpers import click
23
from ubuntu_system_tests.helpers import processes
24
from ubuntu_system_tests.helpers.scopes.apps import (
25
launch_application_from_apps_scope
27
from ubuntu_system_tests.helpers.unity8 import (
28
close_app, launch_application_from_launcher
33
APP_WIN_ID = 'com.ubuntu.gallery_gallery'
34
APP_CLICK = 'com.ubuntu.gallery'
37
def launch_gallery_app():
39
Launch the gallery app from apps scope and return proxy object.
41
:return: Proxy object for gallery application.
44
from ubuntu_system_tests.helpers.gallery._cpo import EventsView
45
launch_application_from_apps_scope(APP_NAME)
46
return EventsView(get_gallery_app_proxy())
49
def close_gallery_app():
50
""" Close the gallery app using task switcher """
51
if is_gallery_app_running():
55
def is_gallery_app_running():
56
""" Indicate if the gallery app is currently running """
57
return processes.is_process_running(APP)
60
def get_gallery_app_proxy():
62
Return gallery app proxy object from existing process.
64
:return: Proxy object for gallery application.
67
proxy = autopilot.get_proxy_object_for_existing_app(
68
APP, cleanup_process=click.get_click_app_identifier(APP_CLICK))
72
def get_gallery_events_view():
73
"""Return a gallery_app EventsView custom proxy object."""
74
from ubuntu_system_tests.helpers.gallery._cpo import EventsView
75
return EventsView(get_gallery_app_proxy())
78
def get_gallery_photo_viewer():
79
"""Return a gallery_app PhotoViewer custom proxy object."""
80
from ubuntu_system_tests.helpers.gallery._cpo import PhotoViewer
81
return PhotoViewer(get_gallery_app_proxy())
84
def launch_gallery_app_from_launcher():
85
"""Drag out the launcher and tap the gallery app icon to start it."""
86
launch_application_from_launcher(APP_WIN_ID)
87
return get_gallery_app_proxy()