Merge lp:~elopio/ubuntu-ui-toolkit/closeActionsPopover-test_modules into lp:ubuntu-ui-toolkit/staging
- closeActionsPopover-test_modules
- Merge into staging
Status: | Merged |
---|---|
Approved by: | Tim Peeters |
Approved revision: | 1102 |
Merged at revision: | 1123 |
Proposed branch: | lp:~elopio/ubuntu-ui-toolkit/closeActionsPopover-test_modules |
Merge into: | lp:ubuntu-ui-toolkit/staging |
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Tim Peeters | Approve | ||
Review via email: mp+223078@code.launchpad.net |
This proposal supersedes a proposal from 2014-06-10.
Commit message
Moved the regression autopilot test for the actions popover to the components module.
Description of the change
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1101
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Tim Peeters (tpeeters) wrote : | # |
please merge staging
Tim Peeters (tpeeters) : | # |
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
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-27 12:16:47 +0000 | |||
5 | @@ -0,0 +1,24 @@ | |||
6 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
7 | 2 | # | ||
8 | 3 | # Copyright (C) 2014 Canonical Ltd. | ||
9 | 4 | # | ||
10 | 5 | # This program is free software; you can redistribute it and/or modify | ||
11 | 6 | # it under the terms of the GNU Lesser General Public License as published by | ||
12 | 7 | # the Free Software Foundation; version 3. | ||
13 | 8 | # | ||
14 | 9 | # This program is distributed in the hope that it will be useful, | ||
15 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | 12 | # GNU Lesser General Public License for more details. | ||
18 | 13 | # | ||
19 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
20 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
21 | 16 | |||
22 | 17 | """Tests for the Ubuntu UI Toolkit components.""" | ||
23 | 18 | |||
24 | 19 | |||
25 | 20 | # Note that the feedback loop that you get from testing QML components with | ||
26 | 21 | # Autopilot is bigger than what you would get by doing it with QtTest. | ||
27 | 22 | # So, the QML components need to be tested first in isolation at a lower level | ||
28 | 23 | # with QtTest, leaving Autopilot to test complex user interactions or user | ||
29 | 24 | # stories. | ||
30 | 0 | 25 | ||
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-27 12:16:47 +0000 | |||
34 | @@ -0,0 +1,64 @@ | |||
35 | 1 | /* | ||
36 | 2 | * Copyright 2014 Canonical Ltd. | ||
37 | 3 | * | ||
38 | 4 | * This program is free software; you can redistribute it and/or modify | ||
39 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
40 | 6 | * the Free Software Foundation; version 3. | ||
41 | 7 | * | ||
42 | 8 | * This program is distributed in the hope that it will be useful, | ||
43 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
44 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
45 | 11 | * GNU Lesser General Public License for more details. | ||
46 | 12 | * | ||
47 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
48 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
49 | 15 | */ | ||
50 | 16 | |||
51 | 17 | import QtQuick 2.0 | ||
52 | 18 | import Ubuntu.Components 1.1 | ||
53 | 19 | |||
54 | 20 | MainView { | ||
55 | 21 | width: units.gu(48) | ||
56 | 22 | height: units.gu(60) | ||
57 | 23 | |||
58 | 24 | useDeprecatedToolbar: false | ||
59 | 25 | |||
60 | 26 | PageStack { | ||
61 | 27 | id: stack | ||
62 | 28 | Component.onCompleted: stack.push(page) | ||
63 | 29 | |||
64 | 30 | Page { | ||
65 | 31 | title: "Test title" | ||
66 | 32 | id: page | ||
67 | 33 | |||
68 | 34 | tools: ToolbarItems { | ||
69 | 35 | |||
70 | 36 | Repeater { | ||
71 | 37 | id: buttonRepeater | ||
72 | 38 | model: 5 | ||
73 | 39 | ToolbarButton { | ||
74 | 40 | action: Action { | ||
75 | 41 | objectName: "action" + index | ||
76 | 42 | text: "text " + index | ||
77 | 43 | iconName: "add" | ||
78 | 44 | } | ||
79 | 45 | } | ||
80 | 46 | } | ||
81 | 47 | |||
82 | 48 | ToolbarButton { | ||
83 | 49 | action: Action { | ||
84 | 50 | objectName: "pushStackAction" | ||
85 | 51 | text: "Push page" | ||
86 | 52 | iconName: "add" | ||
87 | 53 | onTriggered: stack.push(pushMe) | ||
88 | 54 | } | ||
89 | 55 | } | ||
90 | 56 | } | ||
91 | 57 | } | ||
92 | 58 | |||
93 | 59 | Page { | ||
94 | 60 | title: "Pushed page" | ||
95 | 61 | id: pushMe | ||
96 | 62 | } | ||
97 | 63 | } | ||
98 | 64 | } | ||
99 | 0 | 65 | ||
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-27 12:16:47 +0000 | |||
103 | @@ -0,0 +1,48 @@ | |||
104 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
105 | 2 | # | ||
106 | 3 | # Copyright (C) 2014 Canonical Ltd. | ||
107 | 4 | # | ||
108 | 5 | # This program is free software; you can redistribute it and/or modify | ||
109 | 6 | # it under the terms of the GNU Lesser General Public License as published by | ||
110 | 7 | # the Free Software Foundation; version 3. | ||
111 | 8 | # | ||
112 | 9 | # This program is distributed in the hope that it will be useful, | ||
113 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
114 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
115 | 12 | # GNU Lesser General Public License for more details. | ||
116 | 13 | # | ||
117 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
118 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
119 | 16 | |||
120 | 17 | """Tests for the Ubuntu UI Toolkit Header component.""" | ||
121 | 18 | |||
122 | 19 | import os | ||
123 | 20 | |||
124 | 21 | from autopilot.matchers import Eventually | ||
125 | 22 | from testtools.matchers import Equals | ||
126 | 23 | |||
127 | 24 | from ubuntuuitoolkit import tests | ||
128 | 25 | |||
129 | 26 | |||
130 | 27 | class HeaderTestCase(tests.QMLFileAppTestCase): | ||
131 | 28 | |||
132 | 29 | path = os.path.abspath(__file__) | ||
133 | 30 | dir_path = os.path.dirname(path) | ||
134 | 31 | test_qml_file_path = os.path.join( | ||
135 | 32 | dir_path, 'test_header.HeaderTestCase.qml') | ||
136 | 33 | |||
137 | 34 | def setUp(self): | ||
138 | 35 | super(HeaderTestCase, self).setUp() | ||
139 | 36 | self.header = self.main_view.get_header() | ||
140 | 37 | |||
141 | 38 | def test_click_header_overflow_action_must_close_popover(self): | ||
142 | 39 | """Test that clicking an action from the popover must close it. | ||
143 | 40 | |||
144 | 41 | Regression test for http://pad.lv/1326963 | ||
145 | 42 | |||
146 | 43 | """ | ||
147 | 44 | overflow_popover = self.main_view.select_single( | ||
148 | 45 | 'Popover', | ||
149 | 46 | objectName='actions_overflow_popover') | ||
150 | 47 | self.header.click_action_button('pushStackAction') | ||
151 | 48 | self.assertThat(overflow_popover.visible, Eventually(Equals(False))) | ||
152 | 0 | 49 | ||
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-16 12:07:41 +0000 | |||
155 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-06-27 12:16:47 +0000 | |||
156 | @@ -22,8 +22,6 @@ | |||
157 | 22 | 22 | ||
158 | 23 | import ubuntuuitoolkit | 23 | import ubuntuuitoolkit |
159 | 24 | from ubuntuuitoolkit import tests | 24 | from ubuntuuitoolkit import tests |
160 | 25 | from testtools.matchers import Equals | ||
161 | 26 | from autopilot.matchers import Eventually | ||
162 | 27 | 25 | ||
163 | 28 | 26 | ||
164 | 29 | class HeaderTestCase(tests.QMLStringAppTestCase): | 27 | class HeaderTestCase(tests.QMLStringAppTestCase): |
165 | @@ -38,93 +36,73 @@ | |||
166 | 38 | 36 | ||
167 | 39 | useDeprecatedToolbar: false | 37 | useDeprecatedToolbar: false |
168 | 40 | 38 | ||
242 | 41 | PageStack { | 39 | Page { |
243 | 42 | id: stack | 40 | title: "Test title" |
244 | 43 | Component.onCompleted: stack.push(page) | 41 | |
245 | 44 | 42 | Flickable { | |
246 | 45 | Page { | 43 | anchors.fill: parent |
247 | 46 | title: "Test title" | 44 | contentHeight: units.gu(120) |
248 | 47 | id: page | 45 | objectName: "header_test_flickable" |
249 | 48 | 46 | ||
250 | 49 | Flickable { | 47 | Label { |
251 | 50 | anchors.fill: parent | 48 | id: label |
252 | 51 | contentHeight: units.gu(120) | 49 | objectName: "clicked_label" |
253 | 52 | objectName: "header_test_flickable" | 50 | anchors { |
254 | 53 | 51 | top: parent.top | |
255 | 54 | Label { | 52 | horizontalCenter: parent.horizontalCenter |
256 | 55 | id: label | 53 | } |
257 | 56 | objectName: "clicked_label" | 54 | text: "No button clicked." |
258 | 57 | anchors { | 55 | } |
259 | 58 | top: parent.top | 56 | |
260 | 59 | horizontalCenter: parent.horizontalCenter | 57 | Button { |
261 | 60 | } | 58 | objectName: "hide_actions_button" |
262 | 61 | text: "No button clicked." | 59 | anchors { |
263 | 62 | } | 60 | top: label.bottom |
264 | 63 | 61 | topMargin: units.gu(5) | |
265 | 64 | Button { | 62 | horizontalCenter: parent.horizontalCenter |
266 | 65 | objectName: "hide_actions_button" | 63 | } |
267 | 66 | anchors { | 64 | text: "Hide some actions" |
268 | 67 | top: label.bottom | 65 | onClicked: { |
269 | 68 | topMargin: units.gu(5) | 66 | cancelAction.visible = false; |
270 | 69 | horizontalCenter: parent.horizontalCenter | 67 | for (var i=0; i < 3; i++) { |
271 | 70 | } | 68 | buttonRepeater.itemAt(i).action.visible = false; |
272 | 71 | text: "Hide some actions" | 69 | } |
273 | 72 | onClicked: { | 70 | // only three of five visible actions left |
274 | 73 | cancelAction.visible = false; | 71 | } |
275 | 74 | for (var i=0; i < 3; i++) { | 72 | } |
276 | 75 | buttonRepeater.itemAt(i).action.visible = false; | 73 | Label { |
277 | 76 | } | 74 | id: endLabel |
278 | 77 | // only three of five visible actions left | 75 | objectName: "end_label" |
279 | 78 | } | 76 | anchors { |
280 | 79 | } | 77 | bottom: parent.bottom |
281 | 80 | Label { | 78 | horizontalCenter: parent.horizontalCenter |
282 | 81 | id: endLabel | 79 | } |
283 | 82 | objectName: "end_label" | 80 | text: "The end." |
284 | 83 | anchors { | 81 | } |
285 | 84 | bottom: parent.bottom | 82 | } |
286 | 85 | horizontalCenter: parent.horizontalCenter | 83 | |
287 | 86 | } | 84 | tools: ToolbarItems { |
288 | 87 | text: "The end." | 85 | back: ToolbarButton { |
289 | 88 | } | 86 | action: Action { |
290 | 89 | } | 87 | id: cancelAction |
291 | 90 | 88 | iconName: "cancel" | |
292 | 91 | tools: ToolbarItems { | 89 | text: "cancel" |
293 | 92 | back: ToolbarButton { | 90 | onTriggered: label.text = "Cancel button clicked." |
294 | 93 | action: Action { | 91 | } |
295 | 94 | id: cancelAction | 92 | } |
296 | 95 | iconName: "cancel" | 93 | Repeater { |
297 | 96 | text: "cancel" | 94 | id: buttonRepeater |
298 | 97 | onTriggered: label.text = "Cancel button clicked." | 95 | model: 5 |
226 | 98 | } | ||
227 | 99 | } | ||
228 | 100 | Repeater { | ||
229 | 101 | id: buttonRepeater | ||
230 | 102 | model: 5 | ||
231 | 103 | ToolbarButton { | ||
232 | 104 | action: Action { | ||
233 | 105 | objectName: "action" + index | ||
234 | 106 | text: "text " + index | ||
235 | 107 | iconName: "add" | ||
236 | 108 | onTriggered: { | ||
237 | 109 | label.text = "Button "+index+" clicked."; | ||
238 | 110 | } | ||
239 | 111 | } | ||
240 | 112 | } | ||
241 | 113 | } | ||
299 | 114 | ToolbarButton { | 96 | ToolbarButton { |
300 | 115 | action: Action { | 97 | action: Action { |
303 | 116 | objectName: "pushStackAction" | 98 | objectName: "action" + index |
304 | 117 | text: "Push page" | 99 | text: "text " + index |
305 | 118 | iconName: "add" | 100 | iconName: "add" |
307 | 119 | onTriggered: stack.push(pushMe) | 101 | onTriggered: label.text = "Button "+index+" clicked." |
308 | 120 | } | 102 | } |
309 | 121 | } | 103 | } |
310 | 122 | } | 104 | } |
311 | 123 | } | 105 | } |
312 | 124 | Page { | ||
313 | 125 | title: "Pushed page" | ||
314 | 126 | id: pushMe | ||
315 | 127 | } | ||
316 | 128 | } | 106 | } |
317 | 129 | } | 107 | } |
318 | 130 | """) | 108 | """) |
319 | @@ -151,13 +129,6 @@ | |||
320 | 151 | self.header.click_action_button('action3') | 129 | self.header.click_action_button('action3') |
321 | 152 | self.assertEqual(self.label.text, 'Button 3 clicked.') | 130 | self.assertEqual(self.label.text, 'Button 3 clicked.') |
322 | 153 | 131 | ||
323 | 154 | def test_click_header_overflow_action_closes_popover_bug1326963(self): | ||
324 | 155 | overflow_popover = self.main_view.select_single( | ||
325 | 156 | 'Popover', | ||
326 | 157 | objectName='actions_overflow_popover') | ||
327 | 158 | self.header.click_action_button('pushStackAction') | ||
328 | 159 | self.assertThat(overflow_popover.visible, Eventually(Equals(False))) | ||
329 | 160 | |||
330 | 161 | def test_click_unexisting_header_action_button(self): | 132 | def test_click_unexisting_header_action_button(self): |
331 | 162 | error = self.assertRaises( | 133 | error = self.assertRaises( |
332 | 163 | ubuntuuitoolkit.ToolkitException, self.header.click_action_button, | 134 | ubuntuuitoolkit.ToolkitException, self.header.click_action_button, |
the branch to merge this into already went into our staging. Please resubmit