on xenial help sign in
Moved more common things to the base test case.
c453c87Leo Arias
tests/autopilot/unity8/application_lifecycle/tests/__init__.py+7
@@ -21,11 +21,18 @@ from autopilot.matchers import Eventually
21from testtools.matchers import Equals
21from testtools.matchers import Equals
22from ubuntuuitoolkit import fixture_setup
22from ubuntuuitoolkit import fixture_setup
23
23
24+from unity8 import process_helpers
24from unity8.shell import tests
25from unity8.shell import tests
25
26
26
27
27class ApplicationLifeCycleTestCase(tests.UnityTestCase):
28class ApplicationLifeCycleTestCase(tests.UnityTestCase):
28
29
30+ def setUp(self):
31+ self._qml_mock_enabled = False
32+ self._data_dirs_mock_enabled = False
33+ unity_proxy = self.launch_unity()
34+ process_helpers.unlock_unity(unity_proxy)
35+
29 def create_test_application(self):
36 def create_test_application(self):
30 fake_application = fixture_setup.FakeApplication()
37 fake_application = fixture_setup.FakeApplication()
31 self.useFixture(fake_application)
38 self.useFixture(fake_application)
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+2−9
@@ -31,7 +31,6 @@ from ubuntuuitoolkit import (
31)
31)
32
32
33from unity8.application_lifecycle import tests
33from unity8.application_lifecycle import tests
34−from unity8.process_helpers import unlock_unity
35from unity8.shell import disable_qml_mocking
34from unity8.shell import disable_qml_mocking
36from unity8.shell.tests import _get_device_emulation_scenarios
35from unity8.shell.tests import _get_device_emulation_scenarios
37
36
@@ -44,12 +43,9 @@ class ApplicationLifecycleTests(tests.ApplicationLifeCycleTestCase):
44 scenarios = _get_device_emulation_scenarios()
43 scenarios = _get_device_emulation_scenarios()
45
44
46 def setUp(self):
45 def setUp(self):
46+ if model() == 'Desktop':
47+ self.skipTest('Test cannot be run on the desktop.')
47 super(ApplicationLifecycleTests, self).setUp()
48 super(ApplicationLifecycleTests, self).setUp()
48− if model() == "Desktop":
49− self.skipTest("Test cannot be run on the desktop.")
50−
51− unity_proxy = self.launch_unity()
52− unlock_unity(unity_proxy)
53
49
54 def swipe_screen_from_right(self):
50 def swipe_screen_from_right(self):
55 width = self.main_window.width
51 width = self.main_window.width
@@ -75,13 +71,11 @@ class ApplicationLifecycleTests(tests.ApplicationLifeCycleTestCase):
75 app_type='qt')
71 app_type='qt')
76 return application_name
72 return application_name
77
73
78− @disable_qml_mocking
79 def test_can_launch_application(self):
74 def test_can_launch_application(self):
80 """Must be able to launch an application."""
75 """Must be able to launch an application."""
81 application_name = self.launch_fake_app()
76 application_name = self.launch_fake_app()
82 self.assert_current_focused_application(application_name)
77 self.assert_current_focused_application(application_name)
83
78
84− @disable_qml_mocking
85 def test_can_launch_multiple_applications(self):
79 def test_can_launch_multiple_applications(self):
86 """A second application launched must be focused."""
80 """A second application launched must be focused."""
87 application1_name = self.launch_fake_app()
81 application1_name = self.launch_fake_app()
@@ -91,7 +85,6 @@ class ApplicationLifecycleTests(tests.ApplicationLifeCycleTestCase):
91 self.assertFalse(application1_name == application2_name)
85 self.assertFalse(application1_name == application2_name)
92 self.assert_current_focused_application(application2_name)
86 self.assert_current_focused_application(application2_name)
93
87
94− @disable_qml_mocking
95 def test_app_moves_from_unfocused_to_focused(self):
88 def test_app_moves_from_unfocused_to_focused(self):
96 """An application that is in the unfocused state must be able to be
89 """An application that is in the unfocused state must be able to be
97 brought back to the focused state.
90 brought back to the focused state.
tests/autopilot/unity8/application_lifecycle/tests/test_url_dispatcher.py−5
@@ -23,7 +23,6 @@ import os
23
23
24from autopilot import platform
24from autopilot import platform
25
25
26−from unity8 import process_helpers
27from unity8.application_lifecycle import tests
26from unity8.application_lifecycle import tests
28
27
29
28
@@ -35,10 +34,6 @@ class URLDispatcherTestCase(tests.ApplicationLifeCycleTestCase):
35 if platform.model() == 'Desktop':
34 if platform.model() == 'Desktop':
36 self.skipTest("URL dispatcher doesn't work on the desktop.")
35 self.skipTest("URL dispatcher doesn't work on the desktop.")
37 super(URLDispatcherTestCase, self).setUp()
36 super(URLDispatcherTestCase, self).setUp()
38− self._qml_mock_enabled = False
39− self._data_dirs_mock_enabled = False
40− unity_proxy = self.launch_unity()
41− process_helpers.unlock_unity(unity_proxy)
42
37
43 def test_swipe_out_application_started_by_url_dispatcher(self):
38 def test_swipe_out_application_started_by_url_dispatcher(self):
44 _, desktop_file_path = self.create_test_application()
39 _, desktop_file_path = self.create_test_application()