Merge lp:~unity-team/unity/hud-tests-to-wait into lp:unity

Proposed by Brandon Schaefer on 2012-04-18
Status: Merged
Approved by: Thomi Richards on 2012-04-19
Approved revision: 2254
Merged at revision: 2311
Proposed branch: lp:~unity-team/unity/hud-tests-to-wait
Merge into: lp:unity
Diff against target: 115 lines (+7/-55)
2 files modified
tests/autopilot/autopilot/tests/test_dash.py (+4/-50)
tests/autopilot/autopilot/tests/test_hud.py (+3/-5)
To merge this branch: bzr merge lp:~unity-team/unity/hud-tests-to-wait
Reviewer Review Type Date Requested Status
Thomi Richards (community) 2012-04-18 Approve on 2012-04-19
Review via email: mp+102440@code.launchpad.net

Commit Message

Hud autopilot tests use the new Eventually autopilot matcher to reduce the number of test failures due to timing issues.

Description of the Change

Fixed 2 ap test failing from this branch:
https://code.launchpad.net/~thomir/unity/hud-tests-to-wait_for-feature/+merge/102436

Made the HUD tests use the wait_for feature. This fixes several tests that failed intermittently due to timing issues (even on my machine). In some places Unity exports properties as arrays. The only way to use wait_for with an array is to use MatchesListwise with a dummy matcher. This is important, since without this hack the tests sometimes fail.

To post a comment you must log in.
Thomi Richards (thomir) wrote :

+1

review: Approve
Unity Merger (unity-merger) wrote :

No commit message specified.

Unity Merger (unity-merger) wrote :

Attempt to merge into lp:unity failed due to conflicts:

text conflict in tests/autopilot/autopilot/tests/test_hud.py

Thomi Richards (thomir) wrote :

+2

review: Approve
Unity Merger (unity-merger) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Thomi Richards (thomir) wrote :

+3

review: Approve
2254. By Thomi Richards on 2012-04-19

Merged trunk, resolved conflicts.

Thomi Richards (thomir) wrote :

+4

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/autopilot/tests/test_dash.py'
2--- tests/autopilot/autopilot/tests/test_dash.py 2012-04-18 23:02:10 +0000
3+++ tests/autopilot/autopilot/tests/test_dash.py 2012-04-19 02:30:26 +0000
4@@ -178,26 +178,6 @@
5 # Make sure that the category is highlighted.
6 self.assertTrue(category.header_is_highlighted)
7
8- def test_maintain_highlight(self):
9- # Get the geometry of that category header.
10- self.skipTest('Not implemented at all. Broken out of another test but not reworked')
11- mouse = Mouse()
12-
13- x = category.header_x
14- y = category.header_y
15- w = category.header_width
16- h = category.header_height
17-
18- # Move the mouse close the view, and press down.
19- mouse.move(x + w + 10,
20- y + h / 2,
21- True)
22- sleep(1)
23- self.keyboard.press_and_release("Down")
24- lens = self.dash.get_current_lens()
25- category = lens.get_focused_category()
26- self.assertEqual(category, None)
27-
28 def test_control_tab_lens_cycle(self):
29 """This test makes sure that Ctrl+Tab cycles lenses."""
30 self.dash.ensure_visible()
31@@ -262,7 +242,9 @@
32 """This test that Alt+F1 is disabled when the dash is opened."""
33 self.dash.ensure_visible()
34
35- self.keybinding("launcher/keynav")
36+ launcher = self.launcher.get_launcher_for_monitor(0)
37+ launcher.key_nav_start()
38+
39 self.assertThat(self.launcher.key_nav_is_active, Equals(False))
40
41
42@@ -421,7 +403,6 @@
43 activate_filter(True)
44 self.addCleanup(activate_filter)
45
46- sleep(1)
47 results_category = lens.get_category_by_name("Installed")
48 results = results_category.get_results()
49 self.assertIsNot(results, old_results)
50@@ -466,6 +447,7 @@
51 self.mouse.move(app_icon.x + (app_icon.width / 2),
52 app_icon.y + (app_icon.height / 2))
53 self.mouse.click()
54+
55 self.assertThat(self.lensbar.active_lens, Eventually(Equals('applications.lens')))
56
57
58@@ -506,31 +488,3 @@
59
60 self.assertThat(self.dash.visible, Eventually(Equals(True)))
61
62-class DashRestoreFocus(DashTestCase):
63- """Tests that the dash restores focus on exit."""
64- def setUp(self):
65- super(DashRestoreFocus,self).setUp()
66-
67- def test_dash_restores_window_focus(self):
68- """Make sure the dash restores the last focused window."""
69- calc = self.start_app("Calculator")
70- [calc_win] = calc.get_windows()
71- self.assertTrue(calc_win.is_focused)
72-
73- self.dash.ensure_visible()
74- self.dash.ensure_hidden()
75-
76- self.assertTrue(calc_win.is_focused)
77-
78- def test_hud_to_dash_restores_window_focus(self):
79- """Make sure the hud->dash restores the last focused window."""
80- calc = self.start_app("Calculator")
81- [calc_win] = calc.get_windows()
82- self.assertTrue(calc_win.is_focused)
83-
84- self.keybinding("hud/reveal")
85- self.dash.ensure_visible()
86- self.dash.ensure_hidden()
87-
88- self.assertTrue(calc_win.is_focused)
89-
90
91=== modified file 'tests/autopilot/autopilot/tests/test_hud.py'
92--- tests/autopilot/autopilot/tests/test_hud.py 2012-04-18 22:47:44 +0000
93+++ tests/autopilot/autopilot/tests/test_hud.py 2012-04-19 02:30:26 +0000
94@@ -192,8 +192,7 @@
95 """Pressing Alt+F1 when the HUD is open must not start keyboard navigation mode."""
96 self.hud.ensure_visible()
97
98- launcher = self.launcher.get_launcher_for_monitor(0)
99- launcher.key_nav_start()
100+ self.keybinding("launcher/keynav")
101 # we need a sleep here to ensure that the launcher has had time to start
102 # keynav before we check the key_nav_is_active attribute.
103 #
104@@ -208,9 +207,8 @@
105 self.hud.ensure_visible()
106 self.dash.ensure_visible()
107 self.addCleanup(self.dash.ensure_hidden)
108-
109- launcher = self.launcher.get_launcher_for_monitor(0)
110- launcher.key_nav_start()
111+
112+ self.keybinding("launcher/keynav")
113 self.assertThat(self.launcher.key_nav_is_active, Equals(False))
114
115 def test_hud_to_dash_has_key_focus(self):