Merge lp:~elopio/ubuntu-ui-toolkit/fix1248740-composer_sheet_emulator into lp:ubuntu-ui-toolkit

Proposed by Leo Arias
Status: Merged
Approved by: Cris Dywan
Approved revision: 833
Merged at revision: 870
Proposed branch: lp:~elopio/ubuntu-ui-toolkit/fix1248740-composer_sheet_emulator
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 119 lines (+97/-0)
2 files modified
tests/autopilot/ubuntuuitoolkit/emulators.py (+21/-0)
tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py (+76/-0)
To merge this branch: bzr merge lp:~elopio/ubuntu-ui-toolkit/fix1248740-composer_sheet_emulator
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Florian Boucault (community) Approve
Thomi Richards (community) Approve
Review via email: mp+194267@code.launchpad.net

Commit message

Added a ComposerSheet autopilot emulator.

To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

LGTM

review: Approve
Revision history for this message
Leo Arias (elopio) wrote :

We need to wait for the new autopilot to be packaged and released in order to use wait_until_destroyed().

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:828
http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-ci/1198/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/641
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/626/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-amd64-ci/146
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/146
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-ui-toolkit-trusty-armhf-ci/146/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/582
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/641
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/641/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/626
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/626/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/3045/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/3259/console
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/1308
    SUCCESS: http://10.97.0.26:8080/job/touch-flash-device/1307

Click here to trigger a rebuild:
http://10.97.0.26:8080/job/ubuntu-ui-toolkit-ci/1198/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Florian Boucault (fboucault) wrote :

Good to go.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntuuitoolkit/emulators.py'
2--- tests/autopilot/ubuntuuitoolkit/emulators.py 2013-11-22 15:59:48 +0000
3+++ tests/autopilot/ubuntuuitoolkit/emulators.py 2013-11-27 18:51:44 +0000
4@@ -532,3 +532,24 @@
5
6 class Subtitled(Base):
7 pass
8+
9+
10+class ComposerSheet(UbuntuUIToolkitEmulatorBase):
11+ """ComposerSheet Autopilot emulator."""
12+
13+ def __init__(self, *args):
14+ super(ComposerSheet, self).__init__(*args)
15+
16+ @autopilot_logging.log_action(logger.info)
17+ def confirm(self):
18+ """Confirm the composer sheet."""
19+ button = self.select_single('Button', objectName='confirmButton')
20+ self.pointing_device.click_object(button)
21+ self.wait_until_destroyed()
22+
23+ @autopilot_logging.log_action(logger.info)
24+ def cancel(self):
25+ """Cancel the composer sheet."""
26+ button = self.select_single('Button', objectName='cancelButton')
27+ self.pointing_device.click_object(button)
28+ self.wait_until_destroyed()
29
30=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py'
31--- tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2013-11-17 04:41:14 +0000
32+++ tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2013-11-27 18:51:44 +0000
33@@ -20,6 +20,7 @@
34
35 import autopilot
36 from autopilot import input, platform
37+from autopilot.introspection import dbus
38 from testtools.matchers import GreaterThan, LessThan
39
40 from ubuntuuitoolkit import emulators, tests
41@@ -750,3 +751,78 @@
42 self._go_to_page1()
43 self.main_view.go_back()
44 self.assertEqual(self.header.title, 'Page 0')
45+
46+
47+class ComposerSheetTestCase(tests.QMLStringAppTestCase):
48+
49+ test_qml = ("""
50+import QtQuick 2.0
51+import Ubuntu.Components 0.1
52+import Ubuntu.Components.Popups 0.1
53+
54+MainView {
55+ width: units.gu(48)
56+ height: units.gu(60)
57+
58+ Button {
59+ objectName: "openComposerSheetButton"
60+ text: "Open Composer Sheet"
61+ onClicked: PopupUtils.open(testComposerSheet);
62+ }
63+
64+ Label {
65+ id: "label"
66+ objectName: "actionLabel"
67+ anchors.centerIn: parent
68+ text: "No action taken."
69+ }
70+
71+ Component {
72+ id: testComposerSheet
73+ ComposerSheet {
74+ id: sheet
75+ objectName: "testComposerSheet"
76+ onCancelClicked: {
77+ label.text = "Cancel selected."
78+ }
79+ onConfirmClicked: {
80+ label.text = "Confirm selected."
81+ }
82+ }
83+ }
84+}
85+""")
86+
87+ def setUp(self):
88+ super(ComposerSheetTestCase, self).setUp()
89+ self.label = self.main_view.select_single(
90+ 'Label', objectName='actionLabel')
91+ self.assertEqual(self.label.text, 'No action taken.')
92+ self._open_composer_sheet()
93+ self.composer_sheet = self._select_composer_sheet()
94+
95+ def _open_composer_sheet(self):
96+ button = self.main_view.select_single(
97+ 'Button', objectName='openComposerSheetButton')
98+ self.pointing_device.click_object(button)
99+
100+ def _select_composer_sheet(self):
101+ return self.main_view.select_single(
102+ emulators.ComposerSheet, objectName='testComposerSheet')
103+
104+ def test_select_composer_sheet_custom_emulator(self):
105+ self.assertIsInstance(self.composer_sheet, emulators.ComposerSheet)
106+
107+ def test_confirm_composer_sheet(self):
108+ self.composer_sheet.confirm()
109+ self.assertEqual(self.label.text, 'Confirm selected.')
110+ self._assert_composer_sheet_is_closed()
111+
112+ def _assert_composer_sheet_is_closed(self):
113+ self.assertRaises(
114+ dbus.StateNotFoundError, self._select_composer_sheet)
115+
116+ def test_cancel_composer_sheet(self):
117+ self.composer_sheet.cancel()
118+ self.assertEqual(self.label.text, 'Cancel selected.')
119+ self._assert_composer_sheet_is_closed()

Subscribers

People subscribed via source and target branches

to status/vote changes: