Nicholas Skaggs has proposed merging lp:~nskaggs/ubuntu-rssreader-app/add-ap-template into lp:ubuntu-rssreader-app.
Commit message: Re-add autopilot shell Requested reviews: Ubuntu Shorts Developers (ubuntu-shorts-dev) For more details, see: https://code.launchpad.net/~nskaggs/ubuntu-rssreader-app/add-ap-template/+merge/288840 Re-add autopilot shell -- Your team Ubuntu Shorts Developers is requested to review the proposed merge of lp:~nskaggs/ubuntu-rssreader-app/add-ap-template into lp:ubuntu-rssreader-app.
=== added directory 'tests' === added directory 'tests/autopilot' === added directory 'tests/autopilot/shorts_app' === added file 'tests/autopilot/shorts_app/__init__.py' --- tests/autopilot/shorts_app/__init__.py 1970-01-01 00:00:00 +0000 +++ tests/autopilot/shorts_app/__init__.py 2016-03-11 21:33:09 +0000 @@ -0,0 +1,41 @@ +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- +# +# Copyright (C) 2013-2016 Canonical Ltd. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Shorts app autopilot helpers.""" + +import ubuntuuitoolkit + + +class ShortsApp(object): + + """Autopilot helper object for the shorts application.""" + + def __init__(self, app_proxy): + self.app = app_proxy + self.main_view = self.app.select_single(MainView) + + @property + def pointing_device(self): + return self.app.pointing_device + + +class MainView(ubuntuuitoolkit.MainView): + + """Autopilot custom proxy object for the MainView.""" + + def __init__(self, *args): + super(MainView, self).__init__(*args) + self.visible.wait_for(True) === added directory 'tests/autopilot/shorts_app/tests' === added file 'tests/autopilot/shorts_app/tests/__init__.py' --- tests/autopilot/shorts_app/tests/__init__.py 1970-01-01 00:00:00 +0000 +++ tests/autopilot/shorts_app/tests/__init__.py 2016-03-11 21:33:09 +0000 @@ -0,0 +1,100 @@ +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- +# Copyright 2013-2016 Canonical +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 3, as published +# by the Free Software Foundation. + +"""Shorts app autopilot tests.""" + +import os.path +import fixtures +import logging +import tempfile +import gi + +from autopilot import logging as autopilot_logging +from autopilot.testcase import AutopilotTestCase +import ubuntuuitoolkit + +import shorts_app +gi.require_version('Click', '0.4') +from gi.repository import Click + + +logger = logging.getLogger(__name__) + + +class ShortsTestCase(AutopilotTestCase): + + """A common testcase class that provides useful methods for the shorts + app. + + """ + + local_build_location = os.path.dirname(os.path.dirname(os.getcwd())) + sdk_build_location = os.path.join(os.path.dirname(local_build_location), + os.path.basename(local_build_location) + + '-build') + + local_build_location_qml = os.path.join( + local_build_location, 'shorts', 'qml', 'shorts-app.qml') + local_build_location_binary = os.path.join(local_build_location, + 'shorts', 'shorts-app') + sdk_build_location_qml = os.path.join( + sdk_build_location, 'shorts', 'qml', 'shorts-app.qml') + sdk_build_location_binary = os.path.join(sdk_build_location, + 'shorts', 'shorts-app') + installed_location_binary = os.path.join('usr', 'bin', + 'shorts-app') + installed_location_qml = os.path.join('usr', 'share', + 'shorts-app', 'qml', + 'shorts-app.qml') + + def setUp(self): + super(ShortsTestCase, self).setUp() + launcher_method, _ = self.get_launcher_method_and_type() + self.app = shorts_app.ShortsApp(launcher_method()) + + def get_launcher_method_and_type(self): + if os.path.exists(self.local_build_location_binary): + launcher = self.launch_test_local + test_type = 'local' + elif os.path.exists(self.sdk_build_location_binary): + launcher = self.launch_test_sdk + test_type = 'sdk' + elif os.path.exists(self.installed_location_binary): + launcher = self.launch_test_installed + test_type = 'deb' + else: + launcher = self.launch_test_click + test_type = 'click' + return launcher, test_type + + @autopilot_logging.log_action(logger.info) + def launch_test_local(self): + return self.launch_test_application( + self.local_build_location_binary, + app_type='qt', + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) + + @autopilot_logging.log_action(logger.info) + def launch_test_sdk(self): + return self.launch_test_application( + self.sdk_build_location_binary, + app_type='qt', + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) + + @autopilot_logging.log_action(logger.info) + def launch_test_installed(self): + return self.launch_test_application( + self.installed_location_binary, + app_type='qt', + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) + + @autopilot_logging.log_action(logger.info) + def launch_test_click(self): + return self.launch_click_package( + "com.ubuntu.shorts", + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) + === added file 'tests/autopilot/shorts_app/tests/test_shorts.py' --- tests/autopilot/shorts_app/tests/test_shorts.py 1970-01-01 00:00:00 +0000 +++ tests/autopilot/shorts_app/tests/test_shorts.py 2016-03-11 21:33:09 +0000 @@ -0,0 +1,17 @@ +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- +# Copyright 2013-2016 Canonical +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 3, as published +# by the Free Software Foundation. + +"""Shorts app autopilot tests.""" + +from shorts_app.tests import ShortsTestCase + + +class TestMainWindow(ShortsTestCase): + def test_example_test(self): + """Just launch app, assert on main view""" + main_view = self.app.main_view + self.assertTrue(main_view)
-- Mailing list: https://launchpad.net/~ubuntu-touch-coreapps-reviewers Post to : ubuntu-touch-coreapps-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~ubuntu-touch-coreapps-reviewers More help : https://help.launchpad.net/ListHelp