on xenial help sign in
Should finally fix autopilot tests...
37532e6Andrea Cimitan
tests/autopilot/unity8/shell/emulators/dash.py+15−6
@@ -18,17 +18,22 @@
18#
18#
19
19
20from unity8.shell.emulators import UnityEmulatorBase
20from unity8.shell.emulators import UnityEmulatorBase
21−
21+from time import sleep
22
22
23class Dash(UnityEmulatorBase):
23class Dash(UnityEmulatorBase):
24
24
25 """An emulator that understands the Dash."""
25 """An emulator that understands the Dash."""
26
26
27 def get_home_applications_grid(self):
27 def get_home_applications_grid(self):
28+ for i in range(1,10):
28− return self.get_scope('home').select_single(
29+ get_grid = self.get_scope('home').select_single(
29− "GenericFilterGrid",
30+ "GenericFilterGrid",
30− objectName="applications.scope"
31+ objectName="applications.scope"
31− )
32+ )
33+ if get_grid != None:
34+ break
35+ sleep(1)
36+ return get_grid
32
37
33 def get_application_icon(self, text):
38 def get_application_icon(self, text):
34 """Returns a 'Tile' icon that has the text 'text' from the application
39 """Returns a 'Tile' icon that has the text 'text' from the application
@@ -40,7 +45,11 @@ class Dash(UnityEmulatorBase):
40
45
41 """
46 """
42 app_grid = self.get_home_applications_grid()
47 app_grid = self.get_home_applications_grid()
48+ for i in range(1,10):
43− resp_grid = app_grid.select_single('ResponsiveGridView')
49+ resp_grid = app_grid.select_single('ResponsiveGridView')
50+ if resp_grid != None:
51+ break
52+ sleep(1)
44 return resp_grid.select_single('Tile', text=text)
53 return resp_grid.select_single('Tile', text=text)
45
54
46 def get_scope(self, scope_name='home'):
55 def get_scope(self, scope_name='home'):
tests/autopilot/unity8/shell/tests/test_hud.py+3−1
@@ -123,6 +123,7 @@ class TestHud(UnityTestCase):
123 hud = self.main_window.get_hud()
123 hud = self.main_window.get_hud()
124
124
125 self._launch_test_app_from_app_screen()
125 self._launch_test_app_from_app_screen()
126+
126 hud.show()
127 hud.show()
127
128
128 x, y = hud.get_close_button_coords()
129 x, y = hud.get_close_button_coords()
@@ -136,10 +137,11 @@ class TestHud(UnityTestCase):
136 """
137 """
137 self.launch_unity()
138 self.launch_unity()
138 self.main_window.get_greeter().swipe()
139 self.main_window.get_greeter().swipe()
139− hud = self.main_window.get_hud()
140 window = self.main_window.get_qml_view()
140 window = self.main_window.get_qml_view()
141+ hud = self.main_window.get_hud()
141
142
142 self._launch_test_app_from_app_screen()
143 self._launch_test_app_from_app_screen()
144+
143 hud.show()
145 hud.show()
144
146
145 start_x, start_y = hud.get_close_button_coords()
147 start_x, start_y = hud.get_close_button_coords()