on xenial help sign in
Try to make test more robust
commit388cba7dd67d362085623903037c6920b447219e authorMichael Terry <michael.terry@canonical.com> dateTue 8 Apr 2014, 14:25 (13 years ago) parent2247059
2 files changed+3−2
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+1−1 tests/autopilot/unity8/process_helpers.py+2−1
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+1−1
@@ -170,6 +170,7 @@ class ApplicationLifecycleTests(UnityTestCase):
170170 def test_greeter_hides_on_app_focus(self):
171171 """Greeter should hide when an app is re-focused"""
172172 unity_proxy = self.launch_unity()
173+ greeter = self.main_window.get_greeter()
173174 unlock_unity(unity_proxy)
174175
175176 self._launch_app("messaging-app")
@@ -185,7 +186,6 @@ class ApplicationLifecycleTests(UnityTestCase):
185186 )
186187
187188 lock_unity()
188− greeter = self.main_window.get_greeter()
189189 self.assertThat(greeter.created, Eventually(Equals(True)))
190190
191191 self._launch_app("messaging-app")
tests/autopilot/unity8/process_helpers.py+2−1
@@ -90,13 +90,14 @@ def unlock_unity(unity_proxy_obj=None):
9090
9191
9292def lock_unity():
93− import evdev
93+ import evdev, time
9494 uinput = evdev.UInput(name='unity8-autopilot-power-button',
9595 devnode='/dev/autopilot-uinput')
9696 # One press and release to turn screen off (locking unity)
9797 uinput.write(evdev.ecodes.EV_KEY, evdev.ecodes.KEY_POWER, 1)
9898 uinput.write(evdev.ecodes.EV_KEY, evdev.ecodes.KEY_POWER, 0)
9999 uinput.syn()
100+ time.sleep(1)
100101 # And another press and release to turn screen back on
101102 uinput.write(evdev.ecodes.EV_KEY, evdev.ecodes.KEY_POWER, 1)
102103 uinput.write(evdev.ecodes.EV_KEY, evdev.ecodes.KEY_POWER, 0)