on xenial help sign in
Fix autopilot tests
d6a3d71Michael Terry
tests/autopilot/unity8/application_lifecycle/tests/test_greeter.py+16
@@ -42,8 +42,24 @@ class GreeterApplicationLifecycleTests(tests.ApplicationLifeCycleTestCase):
42 if model() == 'Desktop':
42 if model() == 'Desktop':
43 self.skipTest('Test cannot be run on the desktop.')
43 self.skipTest('Test cannot be run on the desktop.')
44 super(GreeterApplicationLifecycleTests, self).setUp()
44 super(GreeterApplicationLifecycleTests, self).setUp()
45+ # Kill user's url-dispatcher daemon, because we want to own its dbus
46+ # name during these tests.
47+ try:
48+ subprocess.check_output(
49+ ["/sbin/initctl", "stop", "url-dispatcher"],
50+ stderr=subprocess.STDOUT
51+ )
52+ except subprocess.CalledProcessError:
53+ logger.warning("Appears url-dispatcher was already stopped!")
54+ self.addCleanup(self._start_dispatcher)
45 self.launch_greeter()
55 self.launch_greeter()
46
56
57+ def _start_dispatcher(self):
58+ subprocess.call(
59+ ["/sbin/initctl", "start", "url-dispatcher"],
60+ stderr=subprocess.STDOUT
61+ )
62+
47 @with_lightdm_mock("single")
63 @with_lightdm_mock("single")
48 def test_greeter_hides_on_url_dispatcher(self):
64 def test_greeter_hides_on_url_dispatcher(self):
49 """Greeter should hide when an app is opened"""
65 """Greeter should hide when an app is opened"""
tests/autopilot/unity8/shell/tests/test_emulators.py−2
@@ -34,7 +34,6 @@ except ImportError:
34
34
35from testtools.matchers import Contains, HasLength
35from testtools.matchers import Contains, HasLength
36
36
37−from unity8 import process_helpers
38from unity8.shell import emulators, fixture_setup, tests
37from unity8.shell import emulators, fixture_setup, tests
39from unity8.shell.emulators import dash as dash_emulators
38from unity8.shell.emulators import dash as dash_emulators
40
39
@@ -46,7 +45,6 @@ class MainWindowTestCase(tests.UnityTestCase):
46 def setUp(self):
45 def setUp(self):
47 super(MainWindowTestCase, self).setUp()
46 super(MainWindowTestCase, self).setUp()
48 unity_proxy = self.launch_unity()
47 unity_proxy = self.launch_unity()
49− process_helpers.unlock_unity(unity_proxy)
50
48
51 def test_search(self):
49 def test_search(self):
52 self.main_window.search('Test')
50 self.main_window.search('Test')
tests/autopilot/unity8/shell/tests/test_notifications.py+2−3
@@ -211,7 +211,6 @@ class InteractiveNotificationBase(NotificationsBase):
211 def test_modal_sd_without_greeter (self):
211 def test_modal_sd_without_greeter (self):
212 """A snap-decision on a phone should block input to shell beneath it when there's no greeter."""
212 """A snap-decision on a phone should block input to shell beneath it when there's no greeter."""
213 unity_proxy = self.launch_unity()
213 unity_proxy = self.launch_unity()
214− unlock_unity(unity_proxy)
215
214
216 summary = "Incoming file"
215 summary = "Incoming file"
217 body = "Frank would like to send you the file: essay.pdf"
216 body = "Frank would like to send you the file: essay.pdf"
@@ -252,7 +251,7 @@ class InteractiveNotificationBase(NotificationsBase):
252
251
253 def test_modal_sd_with_greeter (self):
252 def test_modal_sd_with_greeter (self):
254 """A snap-decision on a phone should not block input to the greeter beneath it."""
253 """A snap-decision on a phone should not block input to the greeter beneath it."""
255− unity_proxy = self.launch_unity()
254+ unity_proxy = self.launch_greeter()
256
255
257 summary = "Incoming file"
256 summary = "Incoming file"
258 body = "Frank would like to send you the file: essay.pdf"
257 body = "Frank would like to send you the file: essay.pdf"
@@ -278,8 +277,8 @@ class InteractiveNotificationBase(NotificationsBase):
278
277
279 # verify that we can swipe away the greeter (interact with the "shell")
278 # verify that we can swipe away the greeter (interact with the "shell")
280 time.sleep(1)
279 time.sleep(1)
281− self.main_window.show_dash_swiping()
282 greeter = self.main_window.get_greeter()
280 greeter = self.main_window.get_greeter()
281+ greeter.swipe()
283 self.assertThat(greeter.shown, Eventually(Equals(False)))
282 self.assertThat(greeter.shown, Eventually(Equals(False)))
284
283
285 # verify and interact with the triggered snap-decision notification
284 # verify and interact with the triggered snap-decision notification