on xenial help sign in
Fix autopilot tests
commitd6a3d71d26cfbe956b8f7c86736c79e346f92f0f authorMichael Terry <michael.terry@canonical.com> dateWed 7 May 2014, 09:16 (12 years ago) parent1f6dfc3
3 files changed+18−5
tests/autopilot/unity8/application_lifecycle/tests/test_greeter.py+16 tests/autopilot/unity8/shell/tests/test_emulators.py−2 tests/autopilot/unity8/shell/tests/test_notifications.py+2−3
tests/autopilot/unity8/application_lifecycle/tests/test_greeter.py+16
@@ -42,8 +42,24 @@ class GreeterApplicationLifecycleTests(tests.ApplicationLifeCycleTestCase):
4242 if model() == 'Desktop':
4343 self.skipTest('Test cannot be run on the desktop.')
4444 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)
4555 self.launch_greeter()
4656
57+ def _start_dispatcher(self):
58+ subprocess.call(
59+ ["/sbin/initctl", "start", "url-dispatcher"],
60+ stderr=subprocess.STDOUT
61+ )
62+
4763 @with_lightdm_mock("single")
4864 def test_greeter_hides_on_url_dispatcher(self):
4965 """Greeter should hide when an app is opened"""
tests/autopilot/unity8/shell/tests/test_emulators.py−2
@@ -34,7 +34,6 @@ except ImportError:
3434
3535from testtools.matchers import Contains, HasLength
3636
37−from unity8 import process_helpers
3837from unity8.shell import emulators, fixture_setup, tests
3938from unity8.shell.emulators import dash as dash_emulators
4039
@@ -46,7 +45,6 @@ class MainWindowTestCase(tests.UnityTestCase):
4645 def setUp(self):
4746 super(MainWindowTestCase, self).setUp()
4847 unity_proxy = self.launch_unity()
49− process_helpers.unlock_unity(unity_proxy)
5048
5149 def test_search(self):
5250 self.main_window.search('Test')
tests/autopilot/unity8/shell/tests/test_notifications.py+2−3
@@ -211,7 +211,6 @@ class InteractiveNotificationBase(NotificationsBase):
211211 def test_modal_sd_without_greeter (self):
212212 """A snap-decision on a phone should block input to shell beneath it when there's no greeter."""
213213 unity_proxy = self.launch_unity()
214− unlock_unity(unity_proxy)
215214
216215 summary = "Incoming file"
217216 body = "Frank would like to send you the file: essay.pdf"
@@ -252,7 +251,7 @@ class InteractiveNotificationBase(NotificationsBase):
252251
253252 def test_modal_sd_with_greeter (self):
254253 """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()
256255
257256 summary = "Incoming file"
258257 body = "Frank would like to send you the file: essay.pdf"
@@ -278,8 +277,8 @@ class InteractiveNotificationBase(NotificationsBase):
278277
279278 # verify that we can swipe away the greeter (interact with the "shell")
280279 time.sleep(1)
281− self.main_window.show_dash_swiping()
282280 greeter = self.main_window.get_greeter()
281+ greeter.swipe()
283282 self.assertThat(greeter.shown, Eventually(Equals(False)))
284283
285284 # verify and interact with the triggered snap-decision notification