Merge lp:~om26er/ubuntu-rssreader-app/add_autopilot_structure into lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk

Proposed by Omer Akram
Status: Merged
Approved by: Joey Chan
Approved revision: 11
Merged at revision: 11
Proposed branch: lp:~om26er/ubuntu-rssreader-app/add_autopilot_structure
Merge into: lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
Diff against target: 182 lines (+140/-0)
7 files modified
debian/control (+8/-0)
debian/ubuntu-rssreader-app-autopilot.install (+1/-0)
tests/autopilot/ubuntu_rssreader_app/__init__.py (+8/-0)
tests/autopilot/ubuntu_rssreader_app/emulators/__init__.py (+6/-0)
tests/autopilot/ubuntu_rssreader_app/emulators/main_window.py (+24/-0)
tests/autopilot/ubuntu_rssreader_app/tests/__init__.py (+55/-0)
tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py (+38/-0)
To merge this branch: bzr merge lp:~om26er/ubuntu-rssreader-app/add_autopilot_structure
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Ubuntu Shorts Developers Pending
Review via email: mp+166788@code.launchpad.net

Commit message

Adds initial structure for autopilot testing

Description of the change

Adds initial structure for autopilot testing

To post a comment you must log in.
Revision history for this message
Joey Chan (qqworini) wrote :

can u explain what is "autopilot" ? sounds like an auto mode in plane

Revision history for this message
Svenn-Arne Dragly (dragly) wrote :

I think Autopilot is a testing framework that will allow us to write unit tests (and similar) for the RSS reader.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) :
review: Approve (continuous-integration)
Revision history for this message
Omer Akram (om26er) wrote :

> can u explain what is "autopilot" ? sounds like an auto mode in plane

Its an auto mode indeed ;) but for testing the UI, see https://wiki.ubuntu.com/Touch/Testing/Autopilot

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2013-04-11 21:21:44 +0000
+++ debian/control 2013-05-31 13:12:34 +0000
@@ -16,3 +16,11 @@
16 qtdeclarative5-qtquick2-plugin16 qtdeclarative5-qtquick2-plugin
17Description: RSS Reader application17Description: RSS Reader application
18 Core RSS Reader application18 Core RSS Reader application
19
20Package: ubuntu-rssreader-app-autopilot
21Architecture: all
22Depends: libautopilot-qt,
23 libqt5test5,
24 ubuntu-rssreader-app (= ${source:Version})
25Description: Autopilot tests for RSS reader Application
26 This package contains the autopilot tests for the RSS reader
1927
=== added file 'debian/ubuntu-rssreader-app-autopilot.install'
--- debian/ubuntu-rssreader-app-autopilot.install 1970-01-01 00:00:00 +0000
+++ debian/ubuntu-rssreader-app-autopilot.install 2013-05-31 13:12:34 +0000
@@ -0,0 +1,1 @@
1tests/autopilot/ubuntu_rssreader_app/* usr/lib/python2.7/dist-packages/ubuntu_rssreader_app/
02
=== added directory 'tests'
=== added directory 'tests/autopilot'
=== added directory 'tests/autopilot/ubuntu_rssreader_app'
=== added file 'tests/autopilot/ubuntu_rssreader_app/__init__.py'
--- tests/autopilot/ubuntu_rssreader_app/__init__.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_rssreader_app/__init__.py 2013-05-31 13:12:34 +0000
@@ -0,0 +1,8 @@
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"""RSS reader app tests and emulators - top level package."""
09
=== added directory 'tests/autopilot/ubuntu_rssreader_app/emulators'
=== added file 'tests/autopilot/ubuntu_rssreader_app/emulators/__init__.py'
--- tests/autopilot/ubuntu_rssreader_app/emulators/__init__.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_rssreader_app/emulators/__init__.py 2013-05-31 13:12:34 +0000
@@ -0,0 +1,6 @@
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.
07
=== added file 'tests/autopilot/ubuntu_rssreader_app/emulators/main_window.py'
--- tests/autopilot/ubuntu_rssreader_app/emulators/main_window.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_rssreader_app/emulators/main_window.py 2013-05-31 13:12:34 +0000
@@ -0,0 +1,24 @@
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"""RSS Reader app autopilot emulators."""
9
10
11class MainWindow(object):
12 """An emulator class that makes it easy to interact with the
13 rssreader-app.
14
15 """
16 def __init__(self, app):
17 self.app = app
18
19 def get_qml_view(self):
20 """Get the main QML view"""
21 return self.app.select_single("QQuickView")
22
23 def get_toolbar(self):
24 return self.app.select_single("Toolbar")
025
=== added directory 'tests/autopilot/ubuntu_rssreader_app/tests'
=== added file 'tests/autopilot/ubuntu_rssreader_app/tests/__init__.py'
--- tests/autopilot/ubuntu_rssreader_app/tests/__init__.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_rssreader_app/tests/__init__.py 2013-05-31 13:12:34 +0000
@@ -0,0 +1,55 @@
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."""
9
10import os.path
11
12from autopilot.input import Mouse, Touch, Pointer
13from autopilot.platform import model
14from autopilot.testcase import AutopilotTestCase
15
16from ubuntu_rssreader_app.emulators.main_window import MainWindow
17
18
19class RssreaderTestCase(AutopilotTestCase):
20
21 """A common test case class that provides several useful methods for
22 rrsreader-app tests.
23
24 """
25 if model() == 'Desktop':
26 scenarios = [('with mouse', dict(input_device_class=Mouse))]
27 else:
28 scenarios = [('with touch', dict(input_device_class=Touch))]
29
30 local_location = "../../ubuntu-rssreader-app.qml"
31
32 def setUp(self):
33 self.pointing_device = Pointer(self.input_device_class.create())
34 super(RssreaderTestCase, self).setUp()
35 if os.path.exists(self.local_location):
36 self.launch_test_local()
37 else:
38 self.launch_test_installed()
39
40 def launch_test_local(self):
41 self.app = self.launch_test_application(
42 "qmlscene",
43 self.local_location,
44 app_type='qt')
45
46 def launch_test_installed(self):
47 self.app = self.launch_test_application(
48 "qmlscene",
49 "/usr/share/ubuntu-rssreader-app/ubuntu-rssreader-app.qml",
50 "--desktop_file_hint=/usr/share/applications/ubuntu-rssreader-app.desktop",
51 app_type='qt')
52
53 @property
54 def main_window(self):
55 return MainWindow(self.app)
056
=== added file 'tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py'
--- tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_rssreader_app/tests/test_rssreader.py 2013-05-31 13:12:34 +0000
@@ -0,0 +1,38 @@
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"""RSS Reader app autopilot tests."""
9
10from __future__ import absolute_import
11
12from autopilot.matchers import Eventually
13from testtools.matchers import Equals
14
15from ubuntu_rssreader_app.tests import RssreaderTestCase
16
17
18class TestMainWindow(RssreaderTestCase):
19
20 def setUp(self):
21 super(TestMainWindow, self).setUp()
22 self.assertThat(
23 self.main_window.get_qml_view().visible, Eventually(Equals(True)))
24
25 def tearDown(self):
26 super(TestMainWindow, self).tearDown()
27
28 def test_toolbar_shows(self):
29 """Make sure that dragging from the bottom reveals the hidden
30 toolbar."""
31 toolbar = self.main_window.get_toolbar()
32
33 x, y, w, h = toolbar.globalRect
34 tx = x + (w / 2)
35 ty = y + (h - 2)
36
37 self.pointing_device.drag(tx, ty, tx, ty - h)
38 self.assertThat(toolbar.state, Eventually(Equals("spread")))

Subscribers

People subscribed via source and target branches