Merge lp:~sil2100/unity/autopilot_misc_changes into lp:unity

Proposed by Łukasz Zemczak
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3327
Proposed branch: lp:~sil2100/unity/autopilot_misc_changes
Merge into: lp:unity
Diff against target: 30 lines (+5/-3)
1 file modified
tests/autopilot/unity/tests/test_hud.py (+5/-3)
To merge this branch: bzr merge lp:~sil2100/unity/autopilot_misc_changes
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Mathieu Trudel-Lapierre Approve
Review via email: mp+164452@code.launchpad.net

Commit message

Fix two HUD failures related to HUD slow action activation

Description of the change

- Problem:

Some of the HUD autopilot tests are failing because the HUD takes too long to activate entries. See LP: #1180903.

- Fix:

First of all, in the undo test, we need to wait a bit after activating the "Undo" HUD entry before saving. Since activation takes a while and the test checks the file contents, we need to make sure that the undo action takes place before Ctrl+s is pressed.
The other fix uses Eventually() to check if the application has quit, as it might take a bit for the action to take place.

- Tests:

N/A

To post a comment you must log in.
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Approve. Makes sense to me, will go well with the other timing changes I've proposed.

review: Approve
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

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
=== modified file 'tests/autopilot/unity/tests/test_hud.py'
--- tests/autopilot/unity/tests/test_hud.py 2013-05-02 00:22:30 +0000
+++ tests/autopilot/unity/tests/test_hud.py 2013-05-17 16:37:36 +0000
@@ -212,14 +212,15 @@
212212
213 self.keyboard.type("undo")213 self.keyboard.type("undo")
214 hud_query_check = lambda: self.unity.hud.selected_hud_button.label_no_formatting214 hud_query_check = lambda: self.unity.hud.selected_hud_button.label_no_formatting
215 # XXX: with the new HUD, command and description is separated by '\u2002' and
216 # not a regular space ' '. Is that correct? (LP: #1172237)
217 self.assertThat(hud_query_check,215 self.assertThat(hud_query_check,
218 Eventually(Equals(u'Undo\u2002(Edit)')))216 Eventually(Equals(u'Undo\u2002(Edit)')))
219 self.keyboard.press_and_release('Return')217 self.keyboard.press_and_release('Return')
220 self.assertThat(self.unity.hud.visible, Eventually(Equals(False)))218 self.assertThat(self.unity.hud.visible, Eventually(Equals(False)))
221219
222 self.assertProperty(gedit_win, is_focused=True)220 self.assertProperty(gedit_win, is_focused=True)
221 # XXX: Because of LP: #1180903, we need to give HUD some time after activating
222 # any entry, because it takes some time
223 sleep(1.5)
223 self.keyboard.press_and_release("Ctrl+s")224 self.keyboard.press_and_release("Ctrl+s")
224 self.assertThat(lambda: exists(file_path), Eventually(Equals(True)))225 self.assertThat(lambda: exists(file_path), Eventually(Equals(True)))
225226
@@ -330,7 +331,8 @@
330331
331 self.keyboard.press_and_release("Enter")332 self.keyboard.press_and_release("Enter")
332333
333 self.assertFalse(self.process_manager.app_is_running("Text Editor"))334 is_running = lambda: self.process_manager.app_is_running("Text Editor")
335 self.assertThat(is_running, Eventually(Equals(False)))
334336
335 self.assertThat(self.unity.hud.visible, Eventually(Equals(False)))337 self.assertThat(self.unity.hud.visible, Eventually(Equals(False)))
336338