Merge lp:~om26er/ubuntu-terminal-app/initial_autopilot into lp:ubuntu-terminal-app

Proposed by Omer Akram
Status: Merged
Approved by: Michael Hall
Approved revision: 10
Merged at revision: 13
Proposed branch: lp:~om26er/ubuntu-terminal-app/initial_autopilot
Merge into: lp:ubuntu-terminal-app
Diff against target: 183 lines (+140/-0)
7 files modified
debian/control (+8/-0)
debian/ubuntu-terminal-app-autopilot.install (+1/-0)
tests/autopilot/ubuntu_terminal_app/__init__.py (+8/-0)
tests/autopilot/ubuntu_terminal_app/emulators/__init__.py (+6/-0)
tests/autopilot/ubuntu_terminal_app/emulators/main_window.py (+24/-0)
tests/autopilot/ubuntu_terminal_app/tests/__init__.py (+55/-0)
tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py (+38/-0)
To merge this branch: bzr merge lp:~om26er/ubuntu-terminal-app/initial_autopilot
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Michael Hall Approve
Review via email: mp+166789@code.launchpad.net

Commit message

add initial structure for autopilot testing

Description of the change

add initial structure for autopilot testing

To post a comment you must log in.
Revision history for this message
Omer Akram (om26er) wrote :

Could anyone review this one, please?

Revision history for this message
Michael Hall (mhall119) wrote :

Looks good

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2013-05-01 16:22:10 +0000
+++ debian/control 2013-05-31 13:16:57 +0000
@@ -17,3 +17,11 @@
17 qtdeclarative5-konsole-qml-plugin17 qtdeclarative5-konsole-qml-plugin
18Description: Terminal application18Description: Terminal application
19 Core Terminal application19 Core Terminal application
20
21Package: ubuntu-terminal-app-autopilot
22Architecture: all
23Depends: libautopilot-qt,
24 libqt5test5,
25 ubuntu-terminal-app (= ${source:Version})
26Description: Autopilot tests for Terminal Application
27 This package contains the autopilot tests for the Terminal
2028
=== added file 'debian/ubuntu-terminal-app-autopilot.install'
--- debian/ubuntu-terminal-app-autopilot.install 1970-01-01 00:00:00 +0000
+++ debian/ubuntu-terminal-app-autopilot.install 2013-05-31 13:16:57 +0000
@@ -0,0 +1,1 @@
1tests/autopilot/ubuntu_terminal_app/* usr/lib/python2.7/dist-packages/ubuntu_terminal_app/
0\ No newline at end of file2\ No newline at end of file
13
=== added directory 'tests'
=== added directory 'tests/autopilot'
=== added directory 'tests/autopilot/ubuntu_terminal_app'
=== added file 'tests/autopilot/ubuntu_terminal_app/__init__.py'
--- tests/autopilot/ubuntu_terminal_app/__init__.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_terminal_app/__init__.py 2013-05-31 13:16:57 +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"""terminal-app tests and emulators - top level package."""
09
=== added directory 'tests/autopilot/ubuntu_terminal_app/emulators'
=== added file 'tests/autopilot/ubuntu_terminal_app/emulators/__init__.py'
--- tests/autopilot/ubuntu_terminal_app/emulators/__init__.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_terminal_app/emulators/__init__.py 2013-05-31 13:16:57 +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_terminal_app/emulators/main_window.py'
--- tests/autopilot/ubuntu_terminal_app/emulators/main_window.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_terminal_app/emulators/main_window.py 2013-05-31 13:16:57 +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"""Terminal app autopilot emulators."""
9
10
11class MainWindow(object):
12 """An emulator class that makes it easy to interact with the
13 terminal-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_terminal_app/tests'
=== added file 'tests/autopilot/ubuntu_terminal_app/tests/__init__.py'
--- tests/autopilot/ubuntu_terminal_app/tests/__init__.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_terminal_app/tests/__init__.py 2013-05-31 13:16:57 +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"""Terminal 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_terminal_app.emulators.main_window import MainWindow
17
18
19class TerminalTestCase(AutopilotTestCase):
20
21 """A common test case class that provides several useful methods for
22 terminal-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-terminal-app.qml"
31
32 def setUp(self):
33 self.pointing_device = Pointer(self.input_device_class.create())
34 super(TerminalTestCase, 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-terminal-app/ubuntu-terminal-app.qml",
50 "--desktop_file_hint=/usr/share/applications/ubuntu-terminal-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_terminal_app/tests/test_terminal.py'
--- tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_terminal_app/tests/test_terminal.py 2013-05-31 13:16:57 +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"""Terminal app autopilot tests."""
9
10from __future__ import absolute_import
11
12from autopilot.matchers import Eventually
13from testtools.matchers import Equals
14
15from ubuntu_terminal_app.tests import TerminalTestCase
16
17
18class TestMainWindow(TerminalTestCase):
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