@@ -21,15 +21,21 @@
2121
2222from __future__ import absolute_import
2323
24−from unity8.process_helpers import unlock_unity
25−from unity8.shell import disable_qml_mocking
26−from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
24+import logging
25+import os
2726
2827from autopilot.matchers import Eventually
2928from autopilot.platform import model
3029from testtools.matchers import Equals, NotEquals
30+from ubuntuuitoolkit import (
31+ base,
32+ emulators as toolkit_emulators,
33+)
34+
35+from unity8.process_helpers import unlock_unity
36+from unity8.shell import disable_qml_mocking
37+from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
3138
32−import logging
3339
3440logger = logging.getLogger(__name__)
3541
@@ -72,18 +78,30 @@ class ApplicationLifecycleTests(UnityTestCase):
7278 app_type='qt'
7379 )
7480
81+ def launch_fake_app(self):
82+ qml_file_path, desktop_file_path = self.create_test_application()
83+ desktop_file_name = os.path.basename(desktop_file_path)
84+ application_name, _ = os.path.splitext(desktop_file_name)
85+ self.launch_test_application(
86+ base.get_qmlscene_launch_command(),
87+ qml_file_path,
88+ '--desktop_file_hint={0}'.format(
89+ desktop_file_path),
90+ emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase,
91+ app_type='qt')
92+ return application_name
93+
7594 @disable_qml_mocking
7695 def test_can_launch_application(self):
7796 """Must be able to launch an application."""
7897 unity_proxy = self.launch_unity()
7998 unlock_unity(unity_proxy)
8099
81− app = self._launch_app("messaging-app")
100+ application_name = self.launch_fake_app()
82101
83− self.assertThat(app, NotEquals(None))
84102 self.assertThat(
85103 self.main_window.get_current_focused_app_id(),
86− Eventually(Equals("messaging-app"))
104+ Eventually(Equals(application_name))
87105 )
88106
89107 @disable_qml_mocking