on xenial help sign in
Make use of helpers in all tests. (LP: #1260860). Fixes: https://bugs.launchpad.net/bugs/1260860.
209d012Christopher Lee
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+7−6
@@ -21,6 +21,7 @@
21
21
22from __future__ import absolute_import
22from __future__ import absolute_import
23
23
24+from unity8.process_helpers import unlock_unity
24from unity8.shell import disable_qml_mocking
25from unity8.shell import disable_qml_mocking
25from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
26from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
26
27
@@ -78,8 +79,8 @@ class ApplicationLifecycleTests(UnityTestCase):
78 @disable_qml_mocking
79 @disable_qml_mocking
79 def test_can_launch_application(self):
80 def test_can_launch_application(self):
80 """Must be able to launch an application."""
81 """Must be able to launch an application."""
81− self.launch_unity()
82+ unity_proxy = self.launch_unity()
82− self.main_window.get_greeter().swipe()
83+ unlock_unity(unity_proxy)
83
84
84 app = self._launch_app("messaging-app")
85 app = self._launch_app("messaging-app")
85
86
@@ -92,8 +93,8 @@ class ApplicationLifecycleTests(UnityTestCase):
92 @disable_qml_mocking
93 @disable_qml_mocking
93 def test_can_launch_multiple_applications(self):
94 def test_can_launch_multiple_applications(self):
94 """A second application launched must be focused."""
95 """A second application launched must be focused."""
95− self.launch_unity()
96+ unity_proxy = self.launch_unity()
96− self.main_window.get_greeter().swipe()
97+ unlock_unity(unity_proxy)
97
98
98 self._launch_app("messaging-app")
99 self._launch_app("messaging-app")
99 self.assertThat(
100 self.assertThat(
@@ -113,8 +114,8 @@ class ApplicationLifecycleTests(UnityTestCase):
113 brought back to the focused state.
114 brought back to the focused state.
114
115
115 """
116 """
116− self.launch_unity()
117+ unity_proxy = self.launch_unity()
117− self.main_window.get_greeter().swipe()
118+ unlock_unity(unity_proxy)
118
119
119 self._launch_app("messaging-app")
120 self._launch_app("messaging-app")
120 self.assertThat(
121 self.assertThat(
tests/autopilot/unity8/shell/tests/test_lock_screen.py+9−8
@@ -20,6 +20,7 @@
20
20
21from __future__ import absolute_import
21from __future__ import absolute_import
22
22
23+from unity8.process_helpers import unlock_unity
23from unity8.shell import with_lightdm_mock
24from unity8.shell import with_lightdm_mock
24from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
25from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
25
26
@@ -40,11 +41,11 @@ class TestLockscreen(UnityTestCase):
40 @with_lightdm_mock("single-pin")
41 @with_lightdm_mock("single-pin")
41 def test_can_unlock_pin_screen(self):
42 def test_can_unlock_pin_screen(self):
42 """Must be able to unlock the PIN entry lock screen."""
43 """Must be able to unlock the PIN entry lock screen."""
43− self.launch_unity()
44+ unity_proxy = self.launch_unity()
44 greeter = self.main_window.get_greeter()
45 greeter = self.main_window.get_greeter()
45
46
46 if greeter.narrowMode:
47 if greeter.narrowMode:
47− greeter.swipe()
48+ unlock_unity(unity_proxy)
48 lockscreen = self._wait_for_lockscreen()
49 lockscreen = self._wait_for_lockscreen()
49 self._enter_pincode("1234")
50 self._enter_pincode("1234")
50 self.assertThat(lockscreen.shown, Eventually(Equals(False)))
51 self.assertThat(lockscreen.shown, Eventually(Equals(False)))
@@ -55,11 +56,11 @@ class TestLockscreen(UnityTestCase):
55 @with_lightdm_mock("single-passphrase")
56 @with_lightdm_mock("single-passphrase")
56 def test_can_unlock_passphrase_screen(self):
57 def test_can_unlock_passphrase_screen(self):
57 """Must be able to unlock the passphrase entry screen."""
58 """Must be able to unlock the passphrase entry screen."""
58− self.launch_unity()
59+ unity_proxy = self.launch_unity()
59 greeter = self.main_window.get_greeter()
60 greeter = self.main_window.get_greeter()
60
61
61 if greeter.narrowMode:
62 if greeter.narrowMode:
62− greeter.swipe()
63+ unlock_unity(unity_proxy)
63 lockscreen = self._wait_for_lockscreen()
64 lockscreen = self._wait_for_lockscreen()
64 self._enter_pin_passphrase("password")
65 self._enter_pin_passphrase("password")
65 self.assertThat(lockscreen.shown, Eventually(Equals(False)))
66 self.assertThat(lockscreen.shown, Eventually(Equals(False)))
@@ -70,11 +71,11 @@ class TestLockscreen(UnityTestCase):
70 @with_lightdm_mock("single-pin")
71 @with_lightdm_mock("single-pin")
71 def test_pin_screen_wrong_code(self):
72 def test_pin_screen_wrong_code(self):
72 """Entering the wrong pin code must not dismiss the lock screen."""
73 """Entering the wrong pin code must not dismiss the lock screen."""
73− self.launch_unity()
74+ unity_proxy = self.launch_unity()
74 greeter = self.main_window.get_greeter()
75 greeter = self.main_window.get_greeter()
75
76
76 if greeter.narrowMode:
77 if greeter.narrowMode:
77− greeter.swipe()
78+ unlock_unity(unity_proxy)
78 lockscreen = self._wait_for_lockscreen()
79 lockscreen = self._wait_for_lockscreen()
79 self._enter_pincode("4321")
80 self._enter_pincode("4321")
80 pinentryField = self.main_window.get_pinentryField()
81 pinentryField = self.main_window.get_pinentryField()
@@ -89,11 +90,11 @@ class TestLockscreen(UnityTestCase):
89 @with_lightdm_mock("single-passphrase")
90 @with_lightdm_mock("single-passphrase")
90 def test_passphrase_screen_wrong_password(self):
91 def test_passphrase_screen_wrong_password(self):
91 """Entering the wrong password must not dismiss the lock screen."""
92 """Entering the wrong password must not dismiss the lock screen."""
92− self.launch_unity()
93+ unity_proxy = self.launch_unity()
93 greeter = self.main_window.get_greeter()
94 greeter = self.main_window.get_greeter()
94
95
95 if greeter.narrowMode:
96 if greeter.narrowMode:
96− greeter.swipe()
97+ unlock_unity(unity_proxy)
97 lockscreen = self._wait_for_lockscreen()
98 lockscreen = self._wait_for_lockscreen()
98 self._enter_pin_passphrase("foobar")
99 self._enter_pin_passphrase("foobar")
99 pinentryField = self.main_window.get_pinentryField()
100 pinentryField = self.main_window.get_pinentryField()