~nskaggs/ubuntu-rssreader-app/fix-debian-control

« back to all changes in this revision

Viewing changes to tests/autopilot/ubuntu_rssreader_app/tests/__init__.py

  • Committer: nskaggs
  • Date: 2013-08-13 02:52:16 UTC
  • mfrom: (24.1.12 ubuntu-rssreader-app)
  • Revision ID: nicholas.skaggs@canonical.com-20130813025216-3nmk7ban85r2ez07
merge carla's changes, plus initial conversion to sdk emulator

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
 
# Copyright 2013 Canonical
3
 
#
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.
7
 
 
8
 
"""Rssreader app autopilot tests."""
 
2
#
 
3
# Copyright (C) 2013 Canonical Ltd
 
4
#
 
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.
 
8
#
 
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.
 
13
#
 
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/>.
 
16
#
 
17
# Authored by: Renato Araujo Oliveira Filho <renato@canonical.com>
 
18
 
 
19
 
 
20
"""rssreader-app autopilot tests."""
9
21
 
10
22
import os.path
 
23
import os
11
24
 
12
25
from autopilot.input import Mouse, Touch, Pointer
13
26
from autopilot.platform import model
14
27
from autopilot.testcase import AutopilotTestCase
15
 
 
16
 
from time import sleep
17
 
 
18
 
from ubuntu_rssreader_app.emulators.main_window import MainWindow
19
 
from ubuntu_rssreader_app.emulators.ubuntusdk import ubuntusdk
20
 
 
21
 
 
22
 
 
23
 
class RssreaderTestCase(AutopilotTestCase):
 
28
from autopilot.matchers import Eventually
 
29
from testtools.matchers import GreaterThan
 
30
 
 
31
from ubuntuuitoolkit import emulators as toolkit_emulators
 
32
from ubuntu_rssreader_app import emulators
 
33
 
 
34
class RssReaderAppTestCase(AutopilotTestCase):
24
35
 
25
36
    """A common test case class that provides several useful methods for
26
 
    rssreader-app tests.
 
37
    calendar-app tests.
27
38
 
28
39
    """
29
40
    if model() == 'Desktop':
35
46
 
36
47
    def setUp(self):
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()
41
52
        else:
45
56
        self.app = self.launch_test_application(
46
57
            "qmlscene",
47
58
            self.local_location,
48
 
            app_type='qt')
 
59
            app_type='qt',
 
60
            emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
49
61
 
50
62
    def launch_test_installed(self):
51
63
        self.app = self.launch_test_application(
52
64
            "qmlscene",
53
65
            "/usr/share/ubuntu-rssreader-app/ubuntu-rssreader-app.qml",
54
 
            "--desktop_file_hint="
55
 
            "/usr/share/applications/ubuntu-rssreader-app.desktop",
56
 
            app_type='qt')
57
 
 
58
 
    def tap_item(self, item):
59
 
        self.pointing_device.move_to_object(item)
60
 
        self.pointing_device.press()
61
 
        sleep(1)
62
 
        self.pointing_device.release()
63
 
 
64
 
    @property
65
 
    def main_window(self):
66
 
        return MainWindow(self.app)
67
 
 
68
 
    @property
69
 
    def ubuntusdk(self):
70
 
        return ubuntusdk(self, self.app)
 
66
            "--desktop_file_hint=/usr/share/applications/"
 
67
            "ubuntu-rssreader-app.desktop",
 
68
            app_type='qt',
 
69
            emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
 
70
 
 
71
    @property
 
72
    def main_view(self):
 
73
        return self.app.select_single(emulators.MainView)