on xenial help sign in
don't use wait_select single everywhere.
a7e3e9cchris.gagnon
tests/autopilot/unity8/shell/emulators/dash.py+1−2
@@ -48,5 +48,4 @@ class Dash(UnityEmulatorBase):
48 objectName='dashContentList'
48 objectName='dashContentList'
49 )
49 )
50 scope_id = "%s.scope" % scope_name
50 scope_id = "%s.scope" % scope_name
51− return dash_content.wait_select_single(
52− 'QQuickLoader', scopeId=scope_id)
51+ return dash_content.select_single('QQuickLoader', scopeId=scope_id)
tests/autopilot/unity8/shell/emulators/greeter.py+1−2
@@ -40,5 +40,4 @@ class Greeter(UnityEmulatorBase):
40 self.created.wait_for(False)
40 self.created.wait_for(False)
41
41
42 def get_prompt(self):
42 def get_prompt(self):
43− return self.wait_select_single(
44− "TextField", objectName="passwordInput")
43+ return self.select_single("TextField", objectName="passwordInput")
tests/autopilot/unity8/shell/emulators/hud.py+8−5
@@ -41,10 +41,12 @@ class Hud(UnityEmulatorBase, DragMixin):
41 swipe_coords = self.get_button_swipe_coords(window, hud_show_button)
41 swipe_coords = self.get_button_swipe_coords(window, hud_show_button)
42
42
43 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
43 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
44+ self._drag(
44− self._drag(swipe_coords.start_x,
45+ swipe_coords.start_x,
45− swipe_coords.start_y,
46+ swipe_coords.start_y,
46− swipe_coords.start_x,
47+ swipe_coords.start_x,
47− swipe_coords.end_y)
48+ swipe_coords.end_y
49+ )
48 try:
50 try:
49 hud_show_button.opacity.wait_for(1.0)
51 hud_show_button.opacity.wait_for(1.0)
50 self.touch.release()
52 self.touch.release()
@@ -79,6 +81,7 @@ class Hud(UnityEmulatorBase, DragMixin):
79 end_x = start_x
81 end_x = start_x
80 start_y = main_view.y + (main_view.height - 3)
82 start_y = main_view.y + (main_view.height - 3)
81 end_y = main_view.y + int(
83 end_y = main_view.y + int(
82− hud_show_button.y + (hud_show_button.height/2))
84+ hud_show_button.y + (hud_show_button.height/2)
85+ )
83
86
84 return SwipeCoords(start_x, end_x, start_y, end_y)
87 return SwipeCoords(start_x, end_x, start_y, end_y)
tests/autopilot/unity8/shell/emulators/launcher.py+1−1
@@ -29,7 +29,7 @@ class Launcher(UnityEmulatorBase):
29 """Swipes open the launcher."""
29 """Swipes open the launcher."""
30 touch = Touch.create()
30 touch = Touch.create()
31
31
32− view = self.get_root_instance().wait_select_single('QQuickView')
32+ view = self.get_root_instance().select_single('QQuickView')
33 start_x = view.x + 1
33 start_x = view.x + 1
34 start_y = view.y + view.height / 2
34 start_y = view.y + view.height / 2
35 stop_x = start_x + self.panelWidth + 1
35 stop_x = start_x + self.panelWidth + 1
tests/autopilot/unity8/shell/emulators/main_window.py+15−17
@@ -32,7 +32,7 @@ class MainWindow(object):
32
32
33 def get_qml_view(self):
33 def get_qml_view(self):
34 """Get the main QML view"""
34 """Get the main QML view"""
35− return self.app.wait_select_single("QQuickView")
35+ return self.app.select_single("QQuickView")
36
36
37 def get_greeter(self):
37 def get_greeter(self):
38 return self.app.select_single(Greeter)
38 return self.app.select_single(Greeter)
@@ -44,54 +44,52 @@ class MainWindow(object):
44 )
44 )
45
45
46 def get_login_loader(self):
46 def get_login_loader(self):
47− return self.app.wait_select_single(
48− "QQuickLoader", objectName="loginLoader")
47+ return self.app.select_single("QQuickLoader", objectName="loginLoader")
49
48
50 def get_login_list(self):
49 def get_login_list(self):
51− return self.app.wait_select_single("LoginList")
50+ return self.app.select_single("LoginList")
52
51
53 def get_hud(self):
52 def get_hud(self):
54− return self.app.wait_select_single(Hud)
53+ return self.app.select_single(Hud)
55
54
56 def get_hud_showable(self):
55 def get_hud_showable(self):
57− return self.app.wait_select_single(
58− "Showable", objectName="hudShowable")
56+ return self.app.select_single("Showable", objectName="hudShowable")
59
57
60 def get_hud_show_button(self):
58 def get_hud_show_button(self):
61− return self.app.wait_select_single("HudButton")
59+ return self.app.select_single("HudButton")
62
60
63 def get_hud_edge_drag_area(self):
61 def get_hud_edge_drag_area(self):
64− return self.app.wait_select_single(objectName="hudDragArea")
62+ return self.app.select_single(objectName="hudDragArea")
65
63
66 def get_dash(self):
64 def get_dash(self):
67− return self.app.wait_select_single(Dash)
65+ return self.app.select_single(Dash)
68
66
69 def get_dash_home_applications_grid(self):
67 def get_dash_home_applications_grid(self):
70− return self.app.wait_select_single(
68+ return self.app.select_single(
71 "ApplicationsFilterGrid",
69 "ApplicationsFilterGrid",
72 objectName="dashHomeApplicationsGrid"
70 objectName="dashHomeApplicationsGrid"
73 )
71 )
74
72
75 def get_bottombar(self):
73 def get_bottombar(self):
76− return self.app.wait_select_single("Bottombar")
74+ return self.app.select_single("Bottombar")
77
75
78 def get_launcher(self):
76 def get_launcher(self):
79− return self.app.wait_select_single(Launcher)
77+ return self.app.select_single(Launcher)
80
78
81 def get_pinPadLoader(self):
79 def get_pinPadLoader(self):
82− return self.app.wait_select_single(
80+ return self.app.select_single(
83 "QQuickLoader",
81 "QQuickLoader",
84 objectName="pinPadLoader"
82 objectName="pinPadLoader"
85 )
83 )
86
84
87 def get_pinPadButton(self, buttonId):
85 def get_pinPadButton(self, buttonId):
88− return self.app.wait_select_single(
86+ return self.app.select_single(
89 "PinPadButton",
87 "PinPadButton",
90 objectName="pinPadButton%i" % buttonId
88 objectName="pinPadButton%i" % buttonId
91 )
89 )
92
90
93 def get_lockscreen(self):
91 def get_lockscreen(self):
94− return self.app.wait_select_single("Lockscreen")
92+ return self.app.select_single("Lockscreen")
95
93
96 def get_pinentryField(self):
94 def get_pinentryField(self):
97− return self.app.wait_select_single(objectName="pinentryField")
95+ return self.app.select_single(objectName="pinentryField")
tests/autopilot/unity8/shell/tests/__init__.py+26−15
@@ -125,11 +125,16 @@ class UnityTestCase(AutopilotTestCase):
125
125
126 # Hide Unity launcher
126 # Hide Unity launcher
127 self._unityshell_schema = Gio.Settings.new_with_path(
127 self._unityshell_schema = Gio.Settings.new_with_path(
128− UNITYSHELL_GSETTINGS_SCHEMA, UNITYSHELL_GSETTINGS_PATH)
128+ UNITYSHELL_GSETTINGS_SCHEMA,
129+ UNITYSHELL_GSETTINGS_PATH,
130+ )
129 self._launcher_hide_mode = self._unityshell_schema.get_int(
131 self._launcher_hide_mode = self._unityshell_schema.get_int(
130− UNITYSHELL_LAUNCHER_KEY)
132+ UNITYSHELL_LAUNCHER_KEY,
133+ )
131 self._unityshell_schema.set_int(
134 self._unityshell_schema.set_int(
135+ UNITYSHELL_LAUNCHER_KEY,
132− UNITYSHELL_LAUNCHER_KEY, UNITYSHELL_LAUNCHER_MODE)
136+ UNITYSHELL_LAUNCHER_MODE,
137+ )
133 self.addCleanup(self._reset_launcher)
138 self.addCleanup(self._reset_launcher)
134
139
135 self._proxy = None
140 self._proxy = None
@@ -151,7 +156,9 @@ class UnityTestCase(AutopilotTestCase):
151 def _reset_launcher(self):
156 def _reset_launcher(self):
152 """Reset Unity launcher hide mode"""
157 """Reset Unity launcher hide mode"""
153 self._unityshell_schema.set_int(
158 self._unityshell_schema.set_int(
154− UNITYSHELL_LAUNCHER_KEY, self._launcher_hide_mode)
159+ UNITYSHELL_LAUNCHER_KEY,
160+ self._launcher_hide_mode,
161+ )
155
162
156 def _setup_display_details(self):
163 def _setup_display_details(self):
157 scale_divisor = self._determine_geometry()
164 scale_divisor = self._determine_geometry()
@@ -233,7 +240,9 @@ class UnityTestCase(AutopilotTestCase):
233 logger.info("Resetting upstart env %s to %s", key, value)
240 logger.info("Resetting upstart env %s to %s", key, value)
234 if value is None:
241 if value is None:
235 subprocess.call(
242 subprocess.call(
236− ["/sbin/initctl", "unset-env", key], stderr=subprocess.STDOUT)
243+ ["/sbin/initctl", "unset-env", key],
244+ stderr=subprocess.STDOUT,
245+ )
237 else:
246 else:
238 subprocess.call([
247 subprocess.call([
239 "/sbin/initctl",
248 "/sbin/initctl",
@@ -276,7 +285,7 @@ class UnityTestCase(AutopilotTestCase):
276
285
277 app_proxy = self._launch_unity_with_upstart(
286 app_proxy = self._launch_unity_with_upstart(
278 binary_path,
287 binary_path,
279− self.unity_geometry_args
288+ self.unity_geometry_args,
280 )
289 )
281
290
282 self._set_proxy(app_proxy)
291 self._set_proxy(app_proxy)
@@ -295,14 +304,16 @@ class UnityTestCase(AutopilotTestCase):
295 binary_arg = "BINARY=%s" % binary_path
304 binary_arg = "BINARY=%s" % binary_path
296 extra_args = "ARGS=%s" % " ".join(args)
305 extra_args = "ARGS=%s" % " ".join(args)
297
306
298− output = subprocess.check_output([
307+ output = subprocess.check_output(
308+ [
299− "/sbin/initctl",
309+ "/sbin/initctl",
300− "start",
310+ "start",
301− "unity8",
311+ "unity8",
302− binary_arg,
312+ binary_arg,
303− extra_args
313+ extra_args,
304− ] + ["%s=%s" % (k, v) for k, v in self._environment.iteritems()],
314+ ] + ["%s=%s" % (k, v) for k, v in self._environment.iteritems()],
305− stderr=subprocess.STDOUT)
315+ stderr=subprocess.STDOUT,
316+ )
306
317
307 self.addCleanup(self._cleanup_launching_upstart_unity)
318 self.addCleanup(self._cleanup_launching_upstart_unity)
308
319
@@ -387,7 +398,7 @@ class UnityTestCase(AutopilotTestCase):
387 self.assertThat(home_scope.isCurrent, Eventually(Equals(True)))
398 self.assertThat(home_scope.isCurrent, Eventually(Equals(True)))
388
399
389 def get_dash(self):
400 def get_dash(self):
390− dash = self._proxy.select_single(Dash)
401+ dash = self._proxy.wait_select_single(Dash)
391 return dash
402 return dash
392
403
393 @property
404 @property
tests/autopilot/unity8/shell/tests/test_notifications.py+9−2
@@ -63,7 +63,7 @@ class NotificationsBase(UnityTestCase):
63
63
64 def _get_notifications_list(self):
64 def _get_notifications_list(self):
65 main_view = self.main_window.get_qml_view()
65 main_view = self.main_window.get_qml_view()
66− return main_view.wait_select_single(
66+ return main_view.select_single(
67 "QQuickListView",
67 "QQuickListView",
68 objectName='notificationList'
68 objectName='notificationList'
69 )
69 )
@@ -365,7 +365,14 @@ class EphemeralNotificationsTests(NotificationsBase):
365
365
366 notification = lambda: notify_list.wait_select_single(
366 notification = lambda: notify_list.wait_select_single(
367 'Notification', objectName='notification1')
367 'Notification', objectName='notification1')
368− self._assert_notification(notification(), summary, body, True, True, 1.0)
368+ self._assert_notification(
369+ notification(),
370+ summary,
371+ body,
372+ True,
373+ True,
374+ 1.0,
375+ )
369
376
370 def test_icon_summary(self):
377 def test_icon_summary(self):
371 """Notification must display the expected summary and secondary
378 """Notification must display the expected summary and secondary