on xenial help sign in
Merge non-mock stuff and going to add applicationmanager stuff
3c80355Christopher Lee
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+32−15
@@ -30,7 +30,7 @@ from autopilot.platform import model
30
30
31from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
31from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
32
32
33−from testtools.matchers import Equals
33+from testtools.matchers import Equals, NotEquals
34
34
35
35
36logger = logging.getLogger(__name__)
36logger = logging.getLogger(__name__)
@@ -122,29 +122,40 @@ X-Ubuntu-Touch=true""")
122 self.launch_unity()
122 self.launch_unity()
123 self.main_window.get_greeter().swipe()
123 self.main_window.get_greeter().swipe()
124
124
125− #import pdb; pdb.set_trace()
126−
127− test_qml = self._get_qml_script()
125+ test_qml = self._get_qml_script("TestApp")
128 app = self._start_qml_script(test_qml)
126 app = self._start_qml_script(test_qml)
129− main_window = app.select_single("Page")
127+ main_window = app.select_single(
128+ "QQuickRectangle",
129+ objectName="TestApp"
130+ )
130
131
131− self.assertThat(main_window.title, Equals("Test App"))
132+ self.assertThat(main_window, NotEquals(None))
132 self.assertThat(main_window.visible, Equals(True))
133 self.assertThat(main_window.visible, Equals(True))
133
134
134 def test_can_launch_multiple_applications(self):
135 def test_can_launch_multiple_applications(self):
135 """A second application launched must be usable."""
136 """A second application launched must be usable."""
136 self.launch_unity()
137 self.launch_unity()
137 self.main_window.get_greeter().swipe()
138 self.main_window.get_greeter().swipe()
138− first_app = self._start_qml_script(self._get_qml_script("App 1"))
139+ first_app = self._start_qml_script(self._get_qml_script("App1"))
139− second_app = self._start_qml_script(self._get_qml_script("App 2"))
140+ second_app = self._start_qml_script(self._get_qml_script("App2"))
140
141
141− first_main_window = first_app.select_single("Page")
142+ first_main_window = first_app.select_single(
143+ "QQuickRectangle",
144+ objectName="App1"
145+ )
142− second_main_window = second_app.select_single("Page")
146+ second_main_window = second_app.select_single(
147+ "QQuickRectangle",
148+ objectName="App2"
149+ )
143
150
151+ import pdb; pdb.set_trace()
144 self.assertThat(first_main_window.visible, Equals(False))
152 self.assertThat(first_main_window.visible, Equals(False))
145
153
146− self.assertThat(second_main_window.title, Equals("App 2"))
147 self.assertThat(second_main_window.visible, Equals(True))
154 self.assertThat(second_main_window.visible, Equals(True))
155+ self.assertThat(
156+ second_main_window.select_single("Text").text,
157+ Equals("App2")
158+ )
148
159
149 def test_app_moves_from_unfocused_to_focused(self):
160 def test_app_moves_from_unfocused_to_focused(self):
150 """An application that is in the unfocused state must be able to be
161 """An application that is in the unfocused state must be able to be
@@ -153,15 +164,21 @@ X-Ubuntu-Touch=true""")
153 """
164 """
154 self.launch_unity()
165 self.launch_unity()
155 self.main_window.get_greeter().swipe()
166 self.main_window.get_greeter().swipe()
156− first_app = self._start_qml_script(self._get_qml_script("App 1"))
167+ first_app = self._start_qml_script(self._get_qml_script("App1"))
157− self._start_qml_script(self._get_qml_script("App 2"))
168+ self._start_qml_script(self._get_qml_script("App2"))
158
169
159− first_main_window = first_app.select_single("Page")
170+ first_main_window = first_app.select_single(
171+ "QQuickRectangle",
172+ objectName="App1"
173+ )
160
174
161 self.swipe_from_right()
175 self.swipe_from_right()
162
176
163− self.assertThat(first_main_window.title, Equals("App 1"))
164 self.assertThat(first_main_window.visible, Equals(True))
177 self.assertThat(first_main_window.visible, Equals(True))
178+ self.assertThat(
179+ first_main_window.select_single("Text").text,
180+ Equals("App1")
181+ )
165
182
166 # interact with it . . .
183 # interact with it . . .
167 # self.assertThat(first_main_window.visible, Equals(True))
184 # self.assertThat(first_main_window.visible, Equals(True))
tests/autopilot/unity8/shell/tests/__init__.py+1−9
@@ -160,7 +160,6 @@ class UnityTestCase(AutopilotTestCase):
160
160
161 if self._lightdm_mock_type is None:
161 if self._lightdm_mock_type is None:
162 self.patch_lightdm_mock()
162 self.patch_lightdm_mock()
163− #self._setup_extra_mock_environment_patch()
164
163
165 app_proxy = self.launch_test_application(
164 app_proxy = self.launch_test_application(
166 binary_path,
165 binary_path,
@@ -181,10 +180,7 @@ class UnityTestCase(AutopilotTestCase):
181 def patch_lightdm_mock(self, mock_type='single'):
180 def patch_lightdm_mock(self, mock_type='single'):
182 self._lightdm_mock_type = mock_type
181 self._lightdm_mock_type = mock_type
183 logger.info("Setting up LightDM mock type '%s'", mock_type)
182 logger.info("Setting up LightDM mock type '%s'", mock_type)
184− new_ld_library_path = "%s:%s" % (
185− get_default_extra_mock_libraries(),
186− self._get_lightdm_mock_path(mock_type)
183+ new_ld_library_path = self._get_lightdm_mock_path(mock_type)
187− )
188 logger.info("New library path: %s", new_ld_library_path)
184 logger.info("New library path: %s", new_ld_library_path)
189
185
190 self.patch_environment('LD_LIBRARY_PATH', new_ld_library_path)
186 self.patch_environment('LD_LIBRARY_PATH', new_ld_library_path)
@@ -202,10 +198,6 @@ class UnityTestCase(AutopilotTestCase):
202 )
198 )
203 return lightdm_mock_path
199 return lightdm_mock_path
204
200
205− def _setup_extra_mock_environment_patch(self):
206− mocks_library_path = get_mocks_library_path()
207− self.patch_environment('QML2_IMPORT_PATH', mocks_library_path)
208−
209 def _set_proxy(self, proxy):
201 def _set_proxy(self, proxy):
210 """Keep a copy of the proxy object, so we can use it to get common
202 """Keep a copy of the proxy object, so we can use it to get common
211 parts of the shell later on.
203 parts of the shell later on.