Merge lp:~om26er/webbrowser-app/improve_chrome_reveal_logic into lp:webbrowser-app
- improve_chrome_reveal_logic
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Olivier Tilloy |
Approved revision: | 258 |
Merged at revision: | 252 |
Proposed branch: | lp:~om26er/webbrowser-app/improve_chrome_reveal_logic |
Merge into: | lp:webbrowser-app |
Diff against target: |
302 lines (+39/-66) 8 files modified
tests/autopilot/webbrowser_app/tests/__init__.py (+17/-22) tests/autopilot/webbrowser_app/tests/test_addressbar_selection.py (+5/-10) tests/autopilot/webbrowser_app/tests/test_addressbar_states.py (+2/-4) tests/autopilot/webbrowser_app/tests/test_backforward.py (+1/-2) tests/autopilot/webbrowser_app/tests/test_history.py (+1/-2) tests/autopilot/webbrowser_app/tests/test_progressbar.py (+4/-8) tests/autopilot/webbrowser_app/tests/test_tabs.py (+8/-16) tests/autopilot/webbrowser_app/tests/test_toolbar.py (+1/-2) |
To merge this branch: | bzr merge lp:~om26er/webbrowser-app/improve_chrome_reveal_logic |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Olivier Tilloy | Approve | ||
Review via email: mp+177593@code.launchpad.net |
Commit message
Autopilot tests: introduce a simpler logic to reveal the chrome
Description of the change
Autopilot tests: introduce a simpler logic to reveal the chrome
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:253
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Omer Akram (om26er) wrote : | # |
> 33 + self.assertThat
> 34 + self.assertThat
>
> Instead of duplicating code, hide_chrome() should call
> assert_
Done.
Olivier Tilloy (osomon) wrote : | # |
15 + tx = x + (w / 2)
16 + ty = y + (h - h / 8)
Please enclose the value assignments for tx and ty in calls to int() to ensure the resulting values are integers, otherwise autopilot might choke.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:255
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
Omer Akram (om26er) wrote : | # |
> 15 + tx = x + (w / 2)
> 16 + ty = y + (h - h / 8)
>
> Please enclose the value assignments for tx and ty in calls to int() to ensure
> the resulting values are integers, otherwise autopilot might choke.
I have fixed that and also now using click_object() all over
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:258
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Olivier Tilloy (osomon) wrote : | # |
Looks good now, thanks!
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'tests/autopilot/webbrowser_app/tests/__init__.py' |
2 | --- tests/autopilot/webbrowser_app/tests/__init__.py 2013-07-25 17:27:29 +0000 |
3 | +++ tests/autopilot/webbrowser_app/tests/__init__.py 2013-07-30 15:02:27 +0000 |
4 | @@ -122,39 +122,35 @@ |
5 | |
6 | def reveal_chrome(self): |
7 | panel = self.main_window.get_panel() |
8 | - distance = self.main_window.get_chrome().height |
9 | - x, y, w, h = self.main_window.get_current_webview().globalRect |
10 | - x_line = int(x + w * 0.5) |
11 | - start_y = int(y + h - 1) |
12 | - stop_y = int(start_y - distance) |
13 | - self.pointing_device.drag(x_line, start_y, x_line, stop_y) |
14 | + x, y, w, h = panel.globalRect |
15 | + tx = int(x + (w / 2)) |
16 | + ty = int(y + (h - h / 8)) |
17 | + self.pointing_device.drag(tx, ty, tx, ty - h) |
18 | + self.assertThat(panel.animating, Eventually(Equals(False))) |
19 | self.assertThat(panel.state, Eventually(Equals("spread"))) |
20 | |
21 | def hide_chrome(self): |
22 | - height = self.main_window.get_chrome().height |
23 | - view = self.main_window.get_qml_view() |
24 | - x_line = int(view.x + view.width * 0.5) |
25 | - start_y = int(self.main_window.get_chrome().globalRect[1] + 1) |
26 | - stop_y = int(start_y + height - 2) |
27 | - self.pointing_device.drag(x_line, start_y, x_line, stop_y) |
28 | + panel = self.main_window.get_panel() |
29 | + x, y, w, h = panel.globalRect |
30 | + tx = int(x + (w / 2)) |
31 | + ty = int(y + (h / 8)) |
32 | + self.pointing_device.drag(tx, ty, tx, ty + h) |
33 | + self.assert_chrome_eventually_hidden() |
34 | |
35 | def assert_chrome_eventually_hidden(self): |
36 | - view = self.main_window.get_qml_view() |
37 | - chrome = self.main_window.get_chrome() |
38 | - self.assertThat(lambda: chrome.globalRect[1], |
39 | - Eventually(Equals(view.y + view.height))) |
40 | + panel = self.main_window.get_panel() |
41 | + self.assertThat(panel.animating, Eventually(Equals(False))) |
42 | + self.assertThat(panel.state, Eventually(Equals(""))) |
43 | |
44 | def ensure_chrome_is_hidden(self): |
45 | webview = self.main_window.get_current_webview() |
46 | - self.pointing_device.move_to_object(webview) |
47 | - self.pointing_device.click() |
48 | + self.pointing_device.click_object(webview) |
49 | self.assert_chrome_eventually_hidden() |
50 | self.assert_osk_eventually_hidden() |
51 | |
52 | def focus_address_bar(self): |
53 | address_bar = self.main_window.get_address_bar() |
54 | - self.pointing_device.move_to_object(address_bar) |
55 | - self.pointing_device.click() |
56 | + self.pointing_device.click_object(address_bar) |
57 | self.assertThat(address_bar.activeFocus, Eventually(Equals(True))) |
58 | self.assert_osk_eventually_shown() |
59 | |
60 | @@ -162,8 +158,7 @@ |
61 | self.focus_address_bar() |
62 | self.assert_osk_eventually_shown() |
63 | clear_button = self.main_window.get_address_bar_clear_button() |
64 | - self.pointing_device.move_to_object(clear_button) |
65 | - self.pointing_device.click() |
66 | + self.pointing_device.click_object(clear_button) |
67 | text_field = self.main_window.get_address_bar_text_field() |
68 | self.assertThat(text_field.text, Eventually(Equals(""))) |
69 | |
70 | |
71 | === modified file 'tests/autopilot/webbrowser_app/tests/test_addressbar_selection.py' |
72 | --- tests/autopilot/webbrowser_app/tests/test_addressbar_selection.py 2013-07-20 13:10:42 +0000 |
73 | +++ tests/autopilot/webbrowser_app/tests/test_addressbar_selection.py 2013-07-30 15:02:27 +0000 |
74 | @@ -24,8 +24,7 @@ |
75 | self.assert_chrome_eventually_hidden() |
76 | self.reveal_chrome() |
77 | address_bar = self.main_window.get_address_bar() |
78 | - self.pointing_device.move_to_object(address_bar) |
79 | - self.pointing_device.click() |
80 | + self.pointing_device.click_object(address_bar) |
81 | text_field = self.main_window.get_address_bar_text_field() |
82 | self.assertThat(text_field.selectedText, |
83 | Eventually(Equals(text_field.text))) |
84 | @@ -34,8 +33,7 @@ |
85 | self.assert_chrome_eventually_hidden() |
86 | self.reveal_chrome() |
87 | action_button = self.main_window.get_address_bar_action_button() |
88 | - self.pointing_device.move_to_object(action_button) |
89 | - self.pointing_device.click() |
90 | + self.pointing_device.click_object(action_button) |
91 | text_field = self.main_window.get_address_bar_text_field() |
92 | self.assertThat(text_field.selectedText, Eventually(Equals(""))) |
93 | |
94 | @@ -43,13 +41,11 @@ |
95 | self.assert_chrome_eventually_hidden() |
96 | self.reveal_chrome() |
97 | address_bar = self.main_window.get_address_bar() |
98 | - self.pointing_device.move_to_object(address_bar) |
99 | - self.pointing_device.click() |
100 | + self.pointing_device.click_object(address_bar) |
101 | # avoid double click |
102 | time.sleep(1) |
103 | self.assert_osk_eventually_shown() |
104 | - self.pointing_device.move_to_object(address_bar) |
105 | - self.pointing_device.click() |
106 | + self.pointing_device.click_object(address_bar) |
107 | text_field = self.main_window.get_address_bar_text_field() |
108 | self.assertThat(text_field.selectedText, Eventually(Equals(''))) |
109 | self.assertThat(text_field.cursorPosition, Eventually(GreaterThan(0))) |
110 | @@ -58,8 +54,7 @@ |
111 | self.assert_chrome_eventually_hidden() |
112 | self.reveal_chrome() |
113 | address_bar = self.main_window.get_address_bar() |
114 | - self.pointing_device.move_to_object(address_bar) |
115 | - self.pointing_device.click() |
116 | + self.pointing_device.click_object(address_bar) |
117 | self.pointing_device.click() |
118 | text_field = self.main_window.get_address_bar_text_field() |
119 | self.assertThat(lambda: len(text_field.selectedText), |
120 | |
121 | === modified file 'tests/autopilot/webbrowser_app/tests/test_addressbar_states.py' |
122 | --- tests/autopilot/webbrowser_app/tests/test_addressbar_states.py 2013-07-20 13:58:20 +0000 |
123 | +++ tests/autopilot/webbrowser_app/tests/test_addressbar_states.py 2013-07-30 15:02:27 +0000 |
124 | @@ -39,16 +39,14 @@ |
125 | self.assertThat(address_bar.state, Eventually(Equals("loading"))) |
126 | self.ensure_chrome_is_hidden() |
127 | self.reveal_chrome() |
128 | - self.pointing_device.move_to_object(action_button) |
129 | - self.pointing_device.click() |
130 | + self.pointing_device.click_object(action_button) |
131 | self.assertThat(address_bar.state, Eventually(Equals(""))) |
132 | |
133 | def test_state_editing(self): |
134 | address_bar = self.main_window.get_address_bar() |
135 | self.assert_chrome_eventually_hidden() |
136 | self.reveal_chrome() |
137 | - self.pointing_device.move_to_object(address_bar) |
138 | - self.pointing_device.click() |
139 | + self.pointing_device.click_object(address_bar) |
140 | self.assertThat(address_bar.state, Eventually(Equals("editing"))) |
141 | self.keyboard.press_and_release("Enter") |
142 | self.assertThat(address_bar.state, Eventually(Equals(""))) |
143 | |
144 | === modified file 'tests/autopilot/webbrowser_app/tests/test_backforward.py' |
145 | --- tests/autopilot/webbrowser_app/tests/test_backforward.py 2013-05-14 15:14:11 +0000 |
146 | +++ tests/autopilot/webbrowser_app/tests/test_backforward.py 2013-07-30 15:02:27 +0000 |
147 | @@ -25,8 +25,7 @@ |
148 | self.ensure_chrome_is_hidden() |
149 | self.reveal_chrome() |
150 | back_button = self.main_window.get_back_button() |
151 | - self.pointing_device.move_to_object(back_button) |
152 | - self.pointing_device.click() |
153 | + self.pointing_device.click_object(back_button) |
154 | |
155 | def test_homepage_no_history(self): |
156 | back_button = self.main_window.get_back_button() |
157 | |
158 | === modified file 'tests/autopilot/webbrowser_app/tests/test_history.py' |
159 | --- tests/autopilot/webbrowser_app/tests/test_history.py 2013-07-21 21:43:34 +0000 |
160 | +++ tests/autopilot/webbrowser_app/tests/test_history.py 2013-07-30 15:02:27 +0000 |
161 | @@ -146,8 +146,7 @@ |
162 | highlight = '<b><font color="#dd4814">Ubuntu</font></b>' |
163 | url = "http://en.wikipedia.org/wiki/%s_(operating_system)" % highlight |
164 | self.assertThat(entry.subText, Contains(url)) |
165 | - self.pointing_device.move_to_object(entry) |
166 | - self.pointing_device.click() |
167 | + self.pointing_device.click_object(entry) |
168 | webview = self.main_window.get_current_webview() |
169 | url = "wikipedia.org/wiki/Ubuntu_(operating_system)" |
170 | self.assertThat(webview.url, Eventually(Contains(url))) |
171 | |
172 | === modified file 'tests/autopilot/webbrowser_app/tests/test_progressbar.py' |
173 | --- tests/autopilot/webbrowser_app/tests/test_progressbar.py 2013-07-05 10:56:21 +0000 |
174 | +++ tests/autopilot/webbrowser_app/tests/test_progressbar.py 2013-07-30 15:02:27 +0000 |
175 | @@ -62,8 +62,7 @@ |
176 | self.assert_page_eventually_loaded(url) |
177 | self.assert_chrome_eventually_hidden() |
178 | webview = self.main_window.get_current_webview() |
179 | - self.pointing_device.move_to_object(webview) |
180 | - self.pointing_device.click() |
181 | + self.pointing_device.click_object(webview) |
182 | self.assert_chrome_eventually_shown() |
183 | |
184 | def test_hide_chrome_while_loading(self): |
185 | @@ -74,8 +73,7 @@ |
186 | self.go_to_url(url) |
187 | self.assert_chrome_eventually_shown() |
188 | webview = self.main_window.get_current_webview() |
189 | - self.pointing_device.move_to_object(webview) |
190 | - self.pointing_device.click() |
191 | + self.pointing_device.click_object(webview) |
192 | self.assert_chrome_eventually_hidden() |
193 | self.assert_page_eventually_loaded(url) |
194 | self.assert_chrome_eventually_hidden() |
195 | @@ -91,11 +89,9 @@ |
196 | address_bar = self.main_window.get_address_bar() |
197 | self.assertThat(address_bar.state, Eventually(Equals("loading"))) |
198 | action_button = self.main_window.get_address_bar_action_button() |
199 | - self.pointing_device.move_to_object(action_button) |
200 | - self.pointing_device.click() |
201 | + self.pointing_device.click_object(action_button) |
202 | self.assertThat(address_bar.state, Eventually(Equals(""))) |
203 | self.assert_chrome_eventually_shown() |
204 | webview = self.main_window.get_current_webview() |
205 | - self.pointing_device.move_to_object(webview) |
206 | - self.pointing_device.click() |
207 | + self.pointing_device.click_object(webview) |
208 | self.assert_chrome_eventually_hidden() |
209 | |
210 | === modified file 'tests/autopilot/webbrowser_app/tests/test_tabs.py' |
211 | --- tests/autopilot/webbrowser_app/tests/test_tabs.py 2013-07-29 11:57:06 +0000 |
212 | +++ tests/autopilot/webbrowser_app/tests/test_tabs.py 2013-07-30 15:02:27 +0000 |
213 | @@ -23,8 +23,7 @@ |
214 | self.ensure_chrome_is_hidden() |
215 | self.reveal_chrome() |
216 | tabs_button = self.main_window.get_activity_button() |
217 | - self.pointing_device.move_to_object(tabs_button) |
218 | - self.pointing_device.click() |
219 | + self.pointing_device.click_object(tabs_button) |
220 | activity_view = self.main_window.get_activity_view() |
221 | self.assertThat(activity_view.visible, Eventually(Equals(True))) |
222 | |
223 | @@ -37,8 +36,7 @@ |
224 | # always be the case if there is a large number of tabs open. However |
225 | # this should be good enough for our tests that never open more than |
226 | # two tabs. |
227 | - self.pointing_device.move_to_object(newtab_delegate) |
228 | - self.pointing_device.click() |
229 | + self.pointing_device.click_object(newtab_delegate) |
230 | self.assertThat(view.count, Eventually(Equals(count + 1))) |
231 | activity_view = self.main_window.get_activity_view() |
232 | self.assertThat(activity_view.visible, Eventually(Equals(False))) |
233 | @@ -78,8 +76,7 @@ |
234 | self.ensure_activity_view_visible() |
235 | self.assert_chrome_eventually_hidden() |
236 | self.reveal_chrome() |
237 | - self.pointing_device.move_to_object(tabs_button) |
238 | - self.pointing_device.click() |
239 | + self.pointing_device.click_object(tabs_button) |
240 | self.assertThat(activity_view.visible, Eventually(Equals(False))) |
241 | |
242 | def test_open_new_tab(self): |
243 | @@ -103,8 +100,7 @@ |
244 | tabs = self.main_window.get_tabslist_view_delegates() |
245 | self.assertThat(len(tabs), Equals(2)) |
246 | self.assertThat(view.currentIndex, Equals(1)) |
247 | - self.pointing_device.move_to_object(tabs[0]) |
248 | - self.pointing_device.click() |
249 | + self.pointing_device.click_object(tabs[0]) |
250 | self.assertThat(view.currentIndex, Eventually(Equals(0))) |
251 | self.assert_current_url(self.url) |
252 | activity_view = self.main_window.get_activity_view() |
253 | @@ -112,8 +108,7 @@ |
254 | self.assert_chrome_eventually_hidden() |
255 | |
256 | self.ensure_activity_view_visible() |
257 | - self.pointing_device.move_to_object(tabs[1]) |
258 | - self.pointing_device.click() |
259 | + self.pointing_device.click_object(tabs[1]) |
260 | self.assertThat(view.currentIndex, Eventually(Equals(1))) |
261 | self.assert_current_url(url) |
262 | self.assertThat(activity_view.visible, Eventually(Equals(False))) |
263 | @@ -159,8 +154,7 @@ |
264 | self.go_to_url(url) |
265 | self.assert_page_eventually_loaded(url) |
266 | webview = self.main_window.get_current_webview() |
267 | - self.pointing_device.move_to_object(webview) |
268 | - self.pointing_device.click() |
269 | + self.pointing_device.click_object(webview) |
270 | view = self.main_window.get_tabslist_view() |
271 | self.assertThat(view.count, Eventually(Equals(2))) |
272 | self.assertThat(view.currentIndex, Eventually(Equals(1))) |
273 | @@ -171,8 +165,7 @@ |
274 | self.go_to_url(url) |
275 | self.assert_page_eventually_loaded(url) |
276 | webview = self.main_window.get_current_webview() |
277 | - self.pointing_device.move_to_object(webview) |
278 | - self.pointing_device.click() |
279 | + self.pointing_device.click_object(webview) |
280 | view = self.main_window.get_tabslist_view() |
281 | self.assertThat(view.count, Eventually(Equals(2))) |
282 | self.assertThat(view.currentIndex, Eventually(Equals(1))) |
283 | @@ -187,6 +180,5 @@ |
284 | self.assertThat(error.visible, Eventually(Equals(True))) |
285 | self.ensure_activity_view_visible() |
286 | tabs = self.main_window.get_tabslist_view_delegates() |
287 | - self.pointing_device.move_to_object(tabs[0]) |
288 | - self.pointing_device.click() |
289 | + self.pointing_device.click_object(tabs[0]) |
290 | self.assertThat(error.visible, Eventually(Equals(False))) |
291 | |
292 | === modified file 'tests/autopilot/webbrowser_app/tests/test_toolbar.py' |
293 | --- tests/autopilot/webbrowser_app/tests/test_toolbar.py 2013-06-05 15:59:45 +0000 |
294 | +++ tests/autopilot/webbrowser_app/tests/test_toolbar.py 2013-07-30 15:02:27 +0000 |
295 | @@ -30,6 +30,5 @@ |
296 | webview = self.main_window.get_current_webview() |
297 | self.ensure_chrome_is_hidden() |
298 | self.reveal_chrome() |
299 | - self.pointing_device.move_to_object(webview) |
300 | - self.pointing_device.click() |
301 | + self.pointing_device.click_object(webview) |
302 | self.assert_chrome_eventually_hidden() |
33 + self.assertThat (panel. animating, Eventually( Equals( False)) ) (panel. state, Eventually( Equals( "")))
34 + self.assertThat
Instead of duplicating code, hide_chrome() should call assert_ chrome_ eventually_ hidden( ).