1
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
# Copyright 2013 Canonical
4
# This program is free software: you can redistribute it and/or modify it
5
# under the terms of the GNU General Public License version 3, as published
6
# by the Free Software Foundation.
8
"""Rssreader app autopilot tests."""
3
# Copyright (C) 2013 Canonical Ltd
5
# This program is free software: you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License version 3 as
7
# published by the Free Software Foundation.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
# Authored by: Renato Araujo Oliveira Filho <renato@canonical.com>
20
"""rssreader-app autopilot tests."""
12
25
from autopilot.input import Mouse, Touch, Pointer
13
26
from autopilot.platform import model
14
27
from autopilot.testcase import AutopilotTestCase
16
from time import sleep
18
from ubuntu_rssreader_app.emulators.main_window import MainWindow
19
from ubuntu_rssreader_app.emulators.ubuntusdk import ubuntusdk
23
class RssreaderTestCase(AutopilotTestCase):
28
from autopilot.matchers import Eventually
29
from testtools.matchers import GreaterThan
31
from ubuntuuitoolkit import emulators as toolkit_emulators
32
from ubuntu_rssreader_app import emulators
34
class RssReaderAppTestCase(AutopilotTestCase):
25
36
"""A common test case class that provides several useful methods for
29
40
if model() == 'Desktop':
37
48
self.pointing_device = Pointer(self.input_device_class.create())
38
super(RssreaderTestCase, self).setUp()
49
super(RssReaderAppTestCase, self).setUp()
39
50
if os.path.exists(self.local_location):
40
51
self.launch_test_local()
45
56
self.app = self.launch_test_application(
47
58
self.local_location,
60
emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
50
62
def launch_test_installed(self):
51
63
self.app = self.launch_test_application(
53
65
"/usr/share/ubuntu-rssreader-app/ubuntu-rssreader-app.qml",
54
"--desktop_file_hint="
55
"/usr/share/applications/ubuntu-rssreader-app.desktop",
58
def tap_item(self, item):
59
self.pointing_device.move_to_object(item)
60
self.pointing_device.press()
62
self.pointing_device.release()
65
def main_window(self):
66
return MainWindow(self.app)
70
return ubuntusdk(self, self.app)
66
"--desktop_file_hint=/usr/share/applications/"
67
"ubuntu-rssreader-app.desktop",
69
emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
73
return self.app.select_single(emulators.MainView)