1
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3
3
# Ubuntu System Tests
4
# Copyright (C) 2015 Canonical
4
# Copyright (C) 2015-2016 Canonical
6
6
# This program is free software: you can redistribute it and/or modify
7
7
# it under the terms of the GNU General Public License as published by
16
16
# You should have received a copy of the GNU General Public License
17
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
from ubuntu_system_tests.helpers import autopilot
21
from ubuntu_system_tests.helpers import processes
22
from ubuntu_system_tests.helpers.scopes.apps import (
23
launch_application_from_apps_scope
25
from ubuntu_system_tests.helpers.unity8 import close_app
26
from ubuntu_system_tests.helpers import wait_until
29
APP_WIN_ID = 'com.ubuntu.clock_clock'
30
QML = 'ubuntu-clock-app'
33
def launch_clock_app():
35
Launch the clock app from apps scope and return proxy object.
37
:return: Proxy object for clock application.
40
launch_application_from_apps_scope(APP_NAME)
41
wait_until(is_clock_app_running, period=0.5)
42
return get_clock_app_proxy()
45
def close_clock_app():
46
""" Close the calendar app using task switcher """
47
if is_clock_app_running():
51
def is_clock_app_running():
52
""" Indicate if the clock app is currently running """
53
return processes.is_qmlscene_running_with_qmlfile(QML)
56
def get_clock_app_proxy():
58
Return clock app proxy object from existing process.
60
:return: Proxy object for calendar application.
63
from ubuntu_system_tests.helpers.clock import _cpo # NOQA
64
proxy = autopilot.get_proxy_object_for_existing_qmlscene_process(QML)
65
return proxy.main_view