Merge lp:~elopio/ubuntu-ui-toolkit/closeActionsPopover-test_modules into lp:~tpeeters/ubuntu-ui-toolkit/closeActionsPopover

Proposed by Leo Arias
Status: Superseded
Proposed branch: lp:~elopio/ubuntu-ui-toolkit/closeActionsPopover-test_modules
Merge into: lp:~tpeeters/ubuntu-ui-toolkit/closeActionsPopover
Diff against target: 332 lines (+196/-89)
4 files modified
tests/autopilot/ubuntuuitoolkit/tests/components/__init__.py (+24/-0)
tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderTestCase.qml (+64/-0)
tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py (+48/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py (+60/-89)
To merge this branch: bzr merge lp:~elopio/ubuntu-ui-toolkit/closeActionsPopover-test_modules
Reviewer Review Type Date Requested Status
Tim Peeters Needs Resubmitting
Review via email: mp+222703@code.launchpad.net

This proposal has been superseded by a proposal from 2014-06-13.

Commit message

Moved the regression test to the components module.

To post a comment you must log in.
Revision history for this message
Tim Peeters (tpeeters) wrote :

the branch to merge this into already went into our staging. Please resubmit

review: Needs Resubmitting
1102. By Leo Arias

Merged with staging.

Unmerged revisions

1102. By Leo Arias

Merged with staging.

1101. By Leo Arias

Fixed flake.

1100. By Leo Arias

Moved the regression test to the components module.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'tests/autopilot/ubuntuuitoolkit/tests/components'
2=== added file 'tests/autopilot/ubuntuuitoolkit/tests/components/__init__.py'
3--- tests/autopilot/ubuntuuitoolkit/tests/components/__init__.py 1970-01-01 00:00:00 +0000
4+++ tests/autopilot/ubuntuuitoolkit/tests/components/__init__.py 2014-06-10 17:58:34 +0000
5@@ -0,0 +1,24 @@
6+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
7+#
8+# Copyright (C) 2014 Canonical Ltd.
9+#
10+# This program is free software; you can redistribute it and/or modify
11+# it under the terms of the GNU Lesser General Public License as published by
12+# the Free Software Foundation; version 3.
13+#
14+# This program is distributed in the hope that it will be useful,
15+# but WITHOUT ANY WARRANTY; without even the implied warranty of
16+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+# GNU Lesser General Public License for more details.
18+#
19+# You should have received a copy of the GNU Lesser General Public License
20+# along with this program. If not, see <http://www.gnu.org/licenses/>.
21+
22+"""Tests for the Ubuntu UI Toolkit components."""
23+
24+
25+# Note that the feedback loop that you get from testing QML components with
26+# Autopilot is bigger than what you would get by doing it with QtTest.
27+# So, the QML components need to be tested first in isolation at a lower level
28+# with QtTest, leaving Autopilot to test complex user interactions or user
29+# stories.
30
31=== added file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderTestCase.qml'
32--- tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderTestCase.qml 1970-01-01 00:00:00 +0000
33+++ tests/autopilot/ubuntuuitoolkit/tests/components/test_header.HeaderTestCase.qml 2014-06-10 17:58:34 +0000
34@@ -0,0 +1,64 @@
35+/*
36+ * Copyright 2014 Canonical Ltd.
37+ *
38+ * This program is free software; you can redistribute it and/or modify
39+ * it under the terms of the GNU Lesser General Public License as published by
40+ * the Free Software Foundation; version 3.
41+ *
42+ * This program is distributed in the hope that it will be useful,
43+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
44+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45+ * GNU Lesser General Public License for more details.
46+ *
47+ * You should have received a copy of the GNU Lesser General Public License
48+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
49+ */
50+
51+import QtQuick 2.0
52+import Ubuntu.Components 1.1
53+
54+MainView {
55+ width: units.gu(48)
56+ height: units.gu(60)
57+
58+ useDeprecatedToolbar: false
59+
60+ PageStack {
61+ id: stack
62+ Component.onCompleted: stack.push(page)
63+
64+ Page {
65+ title: "Test title"
66+ id: page
67+
68+ tools: ToolbarItems {
69+
70+ Repeater {
71+ id: buttonRepeater
72+ model: 5
73+ ToolbarButton {
74+ action: Action {
75+ objectName: "action" + index
76+ text: "text " + index
77+ iconName: "add"
78+ }
79+ }
80+ }
81+
82+ ToolbarButton {
83+ action: Action {
84+ objectName: "pushStackAction"
85+ text: "Push page"
86+ iconName: "add"
87+ onTriggered: stack.push(pushMe)
88+ }
89+ }
90+ }
91+ }
92+
93+ Page {
94+ title: "Pushed page"
95+ id: pushMe
96+ }
97+ }
98+}
99
100=== added file 'tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py'
101--- tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py 1970-01-01 00:00:00 +0000
102+++ tests/autopilot/ubuntuuitoolkit/tests/components/test_header.py 2014-06-10 17:58:34 +0000
103@@ -0,0 +1,48 @@
104+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
105+#
106+# Copyright (C) 2014 Canonical Ltd.
107+#
108+# This program is free software; you can redistribute it and/or modify
109+# it under the terms of the GNU Lesser General Public License as published by
110+# the Free Software Foundation; version 3.
111+#
112+# This program is distributed in the hope that it will be useful,
113+# but WITHOUT ANY WARRANTY; without even the implied warranty of
114+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
115+# GNU Lesser General Public License for more details.
116+#
117+# You should have received a copy of the GNU Lesser General Public License
118+# along with this program. If not, see <http://www.gnu.org/licenses/>.
119+
120+"""Tests for the Ubuntu UI Toolkit Header component."""
121+
122+import os
123+
124+from autopilot.matchers import Eventually
125+from testtools.matchers import Equals
126+
127+from ubuntuuitoolkit import tests
128+
129+
130+class HeaderTestCase(tests.QMLFileAppTestCase):
131+
132+ path = os.path.abspath(__file__)
133+ dir_path = os.path.dirname(path)
134+ test_qml_file_path = os.path.join(
135+ dir_path, 'test_header.HeaderTestCase.qml')
136+
137+ def setUp(self):
138+ super(HeaderTestCase, self).setUp()
139+ self.header = self.main_view.get_header()
140+
141+ def test_click_header_overflow_action_must_close_popover(self):
142+ """Test that clicking an action from the popover must close it.
143+
144+ Regression test for http://pad.lv/1326963
145+
146+ """
147+ overflow_popover = self.main_view.select_single(
148+ 'Popover',
149+ objectName='actions_overflow_popover')
150+ self.header.click_action_button('pushStackAction')
151+ self.assertThat(overflow_popover.visible, Eventually(Equals(False)))
152
153=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py'
154--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-06-05 21:21:44 +0000
155+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-06-10 17:58:34 +0000
156@@ -18,8 +18,6 @@
157
158 import ubuntuuitoolkit
159 from ubuntuuitoolkit import tests
160-from testtools.matchers import Equals
161-from autopilot.matchers import Eventually
162
163
164 class HeaderTestCase(tests.QMLStringAppTestCase):
165@@ -34,93 +32,73 @@
166
167 useDeprecatedToolbar: false
168
169- PageStack {
170- id: stack
171- Component.onCompleted: stack.push(page)
172-
173- Page {
174- title: "Test title"
175- id: page
176-
177- Flickable {
178- anchors.fill: parent
179- contentHeight: units.gu(120)
180- objectName: "header_test_flickable"
181-
182- Label {
183- id: label
184- objectName: "clicked_label"
185- anchors {
186- top: parent.top
187- horizontalCenter: parent.horizontalCenter
188- }
189- text: "No button clicked."
190- }
191-
192- Button {
193- objectName: "hide_actions_button"
194- anchors {
195- top: label.bottom
196- topMargin: units.gu(5)
197- horizontalCenter: parent.horizontalCenter
198- }
199- text: "Hide some actions"
200- onClicked: {
201- cancelAction.visible = false;
202- for (var i=0; i < 3; i++) {
203- buttonRepeater.itemAt(i).action.visible = false;
204- }
205- // only three of five visible actions left
206- }
207- }
208- Label {
209- id: endLabel
210- objectName: "end_label"
211- anchors {
212- bottom: parent.bottom
213- horizontalCenter: parent.horizontalCenter
214- }
215- text: "The end."
216- }
217- }
218-
219- tools: ToolbarItems {
220- back: ToolbarButton {
221- action: Action {
222- id: cancelAction
223- iconName: "cancel"
224- text: "cancel"
225- onTriggered: label.text = "Cancel button clicked."
226- }
227- }
228- Repeater {
229- id: buttonRepeater
230- model: 5
231- ToolbarButton {
232- action: Action {
233- objectName: "action" + index
234- text: "text " + index
235- iconName: "add"
236- onTriggered: {
237- label.text = "Button "+index+" clicked.";
238- }
239- }
240- }
241- }
242+ Page {
243+ title: "Test title"
244+
245+ Flickable {
246+ anchors.fill: parent
247+ contentHeight: units.gu(120)
248+ objectName: "header_test_flickable"
249+
250+ Label {
251+ id: label
252+ objectName: "clicked_label"
253+ anchors {
254+ top: parent.top
255+ horizontalCenter: parent.horizontalCenter
256+ }
257+ text: "No button clicked."
258+ }
259+
260+ Button {
261+ objectName: "hide_actions_button"
262+ anchors {
263+ top: label.bottom
264+ topMargin: units.gu(5)
265+ horizontalCenter: parent.horizontalCenter
266+ }
267+ text: "Hide some actions"
268+ onClicked: {
269+ cancelAction.visible = false;
270+ for (var i=0; i < 3; i++) {
271+ buttonRepeater.itemAt(i).action.visible = false;
272+ }
273+ // only three of five visible actions left
274+ }
275+ }
276+ Label {
277+ id: endLabel
278+ objectName: "end_label"
279+ anchors {
280+ bottom: parent.bottom
281+ horizontalCenter: parent.horizontalCenter
282+ }
283+ text: "The end."
284+ }
285+ }
286+
287+ tools: ToolbarItems {
288+ back: ToolbarButton {
289+ action: Action {
290+ id: cancelAction
291+ iconName: "cancel"
292+ text: "cancel"
293+ onTriggered: label.text = "Cancel button clicked."
294+ }
295+ }
296+ Repeater {
297+ id: buttonRepeater
298+ model: 5
299 ToolbarButton {
300 action: Action {
301- objectName: "pushStackAction"
302- text: "Push page"
303+ objectName: "action" + index
304+ text: "text " + index
305 iconName: "add"
306- onTriggered: stack.push(pushMe)
307+ onTriggered: label.text = "Button "+index+" clicked."
308 }
309 }
310 }
311 }
312- Page {
313- title: "Pushed page"
314- id: pushMe
315- }
316 }
317 }
318 """)
319@@ -147,13 +125,6 @@
320 self.header.click_action_button('action3')
321 self.assertEqual(self.label.text, 'Button 3 clicked.')
322
323- def test_click_header_overflow_action_closes_popover_bug1326963(self):
324- overflow_popover = self.main_view.select_single(
325- 'Popover',
326- objectName='actions_overflow_popover')
327- self.header.click_action_button('pushStackAction')
328- self.assertThat(overflow_popover.visible, Eventually(Equals(False)))
329-
330 def test_click_unexisting_header_action_button(self):
331 error = self.assertRaises(
332 ubuntuuitoolkit.ToolkitException, self.header.click_action_button,

Subscribers

People subscribed via source and target branches

to all changes: