on xenial help sign in
don't use wait_select single everywhere.
commita7e3e9c25626b77fcbe688e992bb0799981bc6e4 authorchris.gagnon <chris.gagnon@canonical.com> dateFri 1 Nov 2013, 09:59 (13 years ago) parent3bc7001
7 files changed+61−44
tests/autopilot/unity8/shell/emulators/dash.py+1−2 tests/autopilot/unity8/shell/emulators/greeter.py+1−2 tests/autopilot/unity8/shell/emulators/hud.py+8−5 tests/autopilot/unity8/shell/emulators/launcher.py+1−1 tests/autopilot/unity8/shell/emulators/main_window.py+15−17 tests/autopilot/unity8/shell/tests/__init__.py+26−15 tests/autopilot/unity8/shell/tests/test_notifications.py+9−2
tests/autopilot/unity8/shell/emulators/dash.py+1−2
@@ -48,5 +48,4 @@ class Dash(UnityEmulatorBase):
4848 objectName='dashContentList'
4949 )
5050 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):
4040 self.created.wait_for(False)
4141
4242 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):
4141 swipe_coords = self.get_button_swipe_coords(window, hud_show_button)
4242
4343 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
44− self._drag(swipe_coords.start_x,
45− swipe_coords.start_y,
46− swipe_coords.start_x,
47− swipe_coords.end_y)
44+ self._drag(
45+ swipe_coords.start_x,
46+ swipe_coords.start_y,
47+ swipe_coords.start_x,
48+ swipe_coords.end_y
49+ )
4850 try:
4951 hud_show_button.opacity.wait_for(1.0)
5052 self.touch.release()
@@ -79,6 +81,7 @@ class Hud(UnityEmulatorBase, DragMixin):
7981 end_x = start_x
8082 start_y = main_view.y + (main_view.height - 3)
8183 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+ )
8386
8487 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):
2929 """Swipes open the launcher."""
3030 touch = Touch.create()
3131
32− view = self.get_root_instance().wait_select_single('QQuickView')
32+ view = self.get_root_instance().select_single('QQuickView')
3333 start_x = view.x + 1
3434 start_y = view.y + view.height / 2
3535 stop_x = start_x + self.panelWidth + 1
tests/autopilot/unity8/shell/emulators/main_window.py+15−17
@@ -32,7 +32,7 @@ class MainWindow(object):
3232
3333 def get_qml_view(self):
3434 """Get the main QML view"""
35− return self.app.wait_select_single("QQuickView")
35+ return self.app.select_single("QQuickView")
3636
3737 def get_greeter(self):
3838 return self.app.select_single(Greeter)
@@ -44,54 +44,52 @@ class MainWindow(object):
4444 )
4545
4646 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")
4948
5049 def get_login_list(self):
51− return self.app.wait_select_single("LoginList")
50+ return self.app.select_single("LoginList")
5251
5352 def get_hud(self):
54− return self.app.wait_select_single(Hud)
53+ return self.app.select_single(Hud)
5554
5655 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")
5957
6058 def get_hud_show_button(self):
61− return self.app.wait_select_single("HudButton")
59+ return self.app.select_single("HudButton")
6260
6361 def get_hud_edge_drag_area(self):
64− return self.app.wait_select_single(objectName="hudDragArea")
62+ return self.app.select_single(objectName="hudDragArea")
6563
6664 def get_dash(self):
67− return self.app.wait_select_single(Dash)
65+ return self.app.select_single(Dash)
6866
6967 def get_dash_home_applications_grid(self):
70− return self.app.wait_select_single(
68+ return self.app.select_single(
7169 "ApplicationsFilterGrid",
7270 objectName="dashHomeApplicationsGrid"
7371 )
7472
7573 def get_bottombar(self):
76− return self.app.wait_select_single("Bottombar")
74+ return self.app.select_single("Bottombar")
7775
7876 def get_launcher(self):
79− return self.app.wait_select_single(Launcher)
77+ return self.app.select_single(Launcher)
8078
8179 def get_pinPadLoader(self):
82− return self.app.wait_select_single(
80+ return self.app.select_single(
8381 "QQuickLoader",
8482 objectName="pinPadLoader"
8583 )
8684
8785 def get_pinPadButton(self, buttonId):
88− return self.app.wait_select_single(
86+ return self.app.select_single(
8987 "PinPadButton",
9088 objectName="pinPadButton%i" % buttonId
9189 )
9290
9391 def get_lockscreen(self):
94− return self.app.wait_select_single("Lockscreen")
92+ return self.app.select_single("Lockscreen")
9593
9694 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):
125125
126126 # Hide Unity launcher
127127 self._unityshell_schema = Gio.Settings.new_with_path(
128− UNITYSHELL_GSETTINGS_SCHEMA, UNITYSHELL_GSETTINGS_PATH)
128+ UNITYSHELL_GSETTINGS_SCHEMA,
129+ UNITYSHELL_GSETTINGS_PATH,
130+ )
129131 self._launcher_hide_mode = self._unityshell_schema.get_int(
130− UNITYSHELL_LAUNCHER_KEY)
132+ UNITYSHELL_LAUNCHER_KEY,
133+ )
131134 self._unityshell_schema.set_int(
132− UNITYSHELL_LAUNCHER_KEY, UNITYSHELL_LAUNCHER_MODE)
135+ UNITYSHELL_LAUNCHER_KEY,
136+ UNITYSHELL_LAUNCHER_MODE,
137+ )
133138 self.addCleanup(self._reset_launcher)
134139
135140 self._proxy = None
@@ -151,7 +156,9 @@ class UnityTestCase(AutopilotTestCase):
151156 def _reset_launcher(self):
152157 """Reset Unity launcher hide mode"""
153158 self._unityshell_schema.set_int(
154− UNITYSHELL_LAUNCHER_KEY, self._launcher_hide_mode)
159+ UNITYSHELL_LAUNCHER_KEY,
160+ self._launcher_hide_mode,
161+ )
155162
156163 def _setup_display_details(self):
157164 scale_divisor = self._determine_geometry()
@@ -233,7 +240,9 @@ class UnityTestCase(AutopilotTestCase):
233240 logger.info("Resetting upstart env %s to %s", key, value)
234241 if value is None:
235242 subprocess.call(
236− ["/sbin/initctl", "unset-env", key], stderr=subprocess.STDOUT)
243+ ["/sbin/initctl", "unset-env", key],
244+ stderr=subprocess.STDOUT,
245+ )
237246 else:
238247 subprocess.call([
239248 "/sbin/initctl",
@@ -276,7 +285,7 @@ class UnityTestCase(AutopilotTestCase):
276285
277286 app_proxy = self._launch_unity_with_upstart(
278287 binary_path,
279− self.unity_geometry_args
288+ self.unity_geometry_args,
280289 )
281290
282291 self._set_proxy(app_proxy)
@@ -295,14 +304,16 @@ class UnityTestCase(AutopilotTestCase):
295304 binary_arg = "BINARY=%s" % binary_path
296305 extra_args = "ARGS=%s" % " ".join(args)
297306
298− output = subprocess.check_output([
299− "/sbin/initctl",
300− "start",
301− "unity8",
302− binary_arg,
303− extra_args
304− ] + ["%s=%s" % (k, v) for k, v in self._environment.iteritems()],
305− stderr=subprocess.STDOUT)
307+ output = subprocess.check_output(
308+ [
309+ "/sbin/initctl",
310+ "start",
311+ "unity8",
312+ binary_arg,
313+ extra_args,
314+ ] + ["%s=%s" % (k, v) for k, v in self._environment.iteritems()],
315+ stderr=subprocess.STDOUT,
316+ )
306317
307318 self.addCleanup(self._cleanup_launching_upstart_unity)
308319
@@ -387,7 +398,7 @@ class UnityTestCase(AutopilotTestCase):
387398 self.assertThat(home_scope.isCurrent, Eventually(Equals(True)))
388399
389400 def get_dash(self):
390− dash = self._proxy.select_single(Dash)
401+ dash = self._proxy.wait_select_single(Dash)
391402 return dash
392403
393404 @property
tests/autopilot/unity8/shell/tests/test_notifications.py+9−2
@@ -63,7 +63,7 @@ class NotificationsBase(UnityTestCase):
6363
6464 def _get_notifications_list(self):
6565 main_view = self.main_window.get_qml_view()
66− return main_view.wait_select_single(
66+ return main_view.select_single(
6767 "QQuickListView",
6868 objectName='notificationList'
6969 )
@@ -365,7 +365,14 @@ class EphemeralNotificationsTests(NotificationsBase):
365365
366366 notification = lambda: notify_list.wait_select_single(
367367 '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+ )
369376
370377 def test_icon_summary(self):
371378 """Notification must display the expected summary and secondary