on xenial help sign in
Merge non-mock stuff and going to add applicationmanager stuff
commit3c803555c9fd2ba3906c90ea995f1bf906fc5c05 authorChristopher Lee <chris.lee@canonical.com> dateWed 11 Sep 2013, 14:56 (13 years ago) parent1cb0f02
2 files changed+33−24
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+32−15 tests/autopilot/unity8/shell/tests/__init__.py+1−9
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+32−15
@@ -30,7 +30,7 @@ from autopilot.platform import model
3030
3131from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
3232
33−from testtools.matchers import Equals
33+from testtools.matchers import Equals, NotEquals
3434
3535
3636logger = logging.getLogger(__name__)
@@ -122,29 +122,40 @@ X-Ubuntu-Touch=true""")
122122 self.launch_unity()
123123 self.main_window.get_greeter().swipe()
124124
125− #import pdb; pdb.set_trace()
126−
127− test_qml = self._get_qml_script()
125+ test_qml = self._get_qml_script("TestApp")
128126 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+ )
130131
131− self.assertThat(main_window.title, Equals("Test App"))
132+ self.assertThat(main_window, NotEquals(None))
132133 self.assertThat(main_window.visible, Equals(True))
133134
134135 def test_can_launch_multiple_applications(self):
135136 """A second application launched must be usable."""
136137 self.launch_unity()
137138 self.main_window.get_greeter().swipe()
138− first_app = self._start_qml_script(self._get_qml_script("App 1"))
139− second_app = self._start_qml_script(self._get_qml_script("App 2"))
139+ first_app = self._start_qml_script(self._get_qml_script("App1"))
140+ second_app = self._start_qml_script(self._get_qml_script("App2"))
140141
141− first_main_window = first_app.select_single("Page")
142− second_main_window = second_app.select_single("Page")
142+ first_main_window = first_app.select_single(
143+ "QQuickRectangle",
144+ objectName="App1"
145+ )
146+ second_main_window = second_app.select_single(
147+ "QQuickRectangle",
148+ objectName="App2"
149+ )
143150
151+ import pdb; pdb.set_trace()
144152 self.assertThat(first_main_window.visible, Equals(False))
145153
146− self.assertThat(second_main_window.title, Equals("App 2"))
147154 self.assertThat(second_main_window.visible, Equals(True))
155+ self.assertThat(
156+ second_main_window.select_single("Text").text,
157+ Equals("App2")
158+ )
148159
149160 def test_app_moves_from_unfocused_to_focused(self):
150161 """An application that is in the unfocused state must be able to be
@@ -153,15 +164,21 @@ X-Ubuntu-Touch=true""")
153164 """
154165 self.launch_unity()
155166 self.main_window.get_greeter().swipe()
156− first_app = self._start_qml_script(self._get_qml_script("App 1"))
157− self._start_qml_script(self._get_qml_script("App 2"))
167+ first_app = self._start_qml_script(self._get_qml_script("App1"))
168+ self._start_qml_script(self._get_qml_script("App2"))
158169
159− first_main_window = first_app.select_single("Page")
170+ first_main_window = first_app.select_single(
171+ "QQuickRectangle",
172+ objectName="App1"
173+ )
160174
161175 self.swipe_from_right()
162176
163− self.assertThat(first_main_window.title, Equals("App 1"))
164177 self.assertThat(first_main_window.visible, Equals(True))
178+ self.assertThat(
179+ first_main_window.select_single("Text").text,
180+ Equals("App1")
181+ )
165182
166183 # interact with it . . .
167184 # self.assertThat(first_main_window.visible, Equals(True))
tests/autopilot/unity8/shell/tests/__init__.py+1−9
@@ -160,7 +160,6 @@ class UnityTestCase(AutopilotTestCase):
160160
161161 if self._lightdm_mock_type is None:
162162 self.patch_lightdm_mock()
163− #self._setup_extra_mock_environment_patch()
164163
165164 app_proxy = self.launch_test_application(
166165 binary_path,
@@ -181,10 +180,7 @@ class UnityTestCase(AutopilotTestCase):
181180 def patch_lightdm_mock(self, mock_type='single'):
182181 self._lightdm_mock_type = mock_type
183182 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)
187− )
183+ new_ld_library_path = self._get_lightdm_mock_path(mock_type)
188184 logger.info("New library path: %s", new_ld_library_path)
189185
190186 self.patch_environment('LD_LIBRARY_PATH', new_ld_library_path)
@@ -202,10 +198,6 @@ class UnityTestCase(AutopilotTestCase):
202198 )
203199 return lightdm_mock_path
204200
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−
209201 def _set_proxy(self, proxy):
210202 """Keep a copy of the proxy object, so we can use it to get common
211203 parts of the shell later on.