Nicholas Skaggs has proposed merging lp:~nskaggs/reminders-app/fix-ap-tests into lp:reminders-app.
Commit message: Adds support for running autopilot tests with SDK out of tree builds Fix reminders.tests.test_reminders.RemindersTestCaseWithoutAccount tests Requested reviews: Ubuntu Notes app developers (notes-app-dev) For more details, see: https://code.launchpad.net/~nskaggs/reminders-app/fix-ap-tests/+merge/286422 Adds support for running autopilot tests with SDK out of tree builds Fix reminders.tests.test_reminders.RemindersTestCaseWithoutAccount tests -- Your team Ubuntu Notes app developers is requested to review the proposed merge of lp:~nskaggs/reminders-app/fix-ap-tests into lp:reminders-app.
=== modified file 'tests/autopilot/reminders/__init__.py' --- tests/autopilot/reminders/__init__.py 2014-11-25 16:36:33 +0000 +++ tests/autopilot/reminders/__init__.py 2016-02-17 22:23:49 +0000 @@ -41,7 +41,20 @@ def __init__(self, app_proxy): self.app = app_proxy - self.main_view = self.app.select_single(MainView) + # Use only objectName due to bug 1350532 + self.main_view = self.app.wait_select_single(objectName="mainView") + + + @property + def no_account_dialog(self): + try: + self._no_account_dialog = self.app.wait_select_single( + objectName='noAccountDialog') + except dbus.StateNotFoundError: + raise RemindersAppException( + 'The No Account dialog is not present') + else: + return self._no_account_dialog def open_notebooks(self): """Open the Notebooks page. @@ -61,19 +74,7 @@ def __init__(self, *args): super(MainView, self).__init__(*args) self.visible.wait_for(True) - try: - self._no_account_dialog = self.select_single( - objectName='noAccountDialog') - except dbus.StateNotFoundError: - self._no_account_dialog = None - @property - def no_account_dialog(self): - if self._no_account_dialog is None: - raise RemindersAppException( - 'The No Account dialog is not present') - else: - return self._no_account_dialog class NoAccountDialog(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): @@ -108,7 +109,8 @@ super(_Page, self).__init__(*args) # XXX we need a better way to keep reference to the main view. # --elopio - 2014-02-26 - self.main_view = self.get_root_instance().select_single(MainView) + self.main_view = \ + self.get_root_instance().wait_select_single(objectName="mainView") class PulldownListView(ubuntuuitoolkit.QQuickListView): === modified file 'tests/autopilot/reminders/tests/__init__.py' --- tests/autopilot/reminders/tests/__init__.py 2014-11-13 10:30:34 +0000 +++ tests/autopilot/reminders/tests/__init__.py 2016-02-17 22:23:49 +0000 @@ -41,11 +41,16 @@ """ - local_location = os.path.dirname(os.path.dirname(os.getcwd())) + local_build_location = os.path.dirname(os.path.dirname(os.getcwd())) + sdk_build_location = os.path.join(os.path.dirname(local_build_location), + os.path.basename(local_build_location) + '-build') - local_location_qml = os.path.join( - local_location, 'src/app/qml/reminders.qml') - local_location_binary = os.path.join(local_location, 'src/app/reminders') + local_build_location_qml = os.path.join( + local_build_location, 'src/app/qml/reminders.qml') + local_build_location_binary = os.path.join(local_build_location, 'src/app/reminders') + sdk_build_location_qml = os.path.join( + sdk_build_location, 'src/app/qml/reminders.qml') + sdk_build_location_binary = os.path.join(sdk_build_location, 'src/app/reminders') installed_location_binary = '/usr/bin/reminders' installed_location_qml = '/usr/share/reminders/qml/reminders.qml' @@ -63,9 +68,12 @@ subprocess.call(['pkill', '-9', 'signond']) def get_launcher_method_and_type(self): - if os.path.exists(self.local_location_binary): + if os.path.exists(self.local_build_location_binary): launcher = self.launch_test_local test_type = 'local' + elif os.path.exists(self.sdk_build_location_binary): + launcher = self.launch_test_sdk + test_type = 'sdk' elif os.path.exists(self.installed_location_binary): launcher = self.launch_test_installed test_type = 'deb' @@ -78,9 +86,20 @@ def launch_test_local(self): self.useFixture(fixtures.EnvironmentVariable( 'QML2_IMPORT_PATH', - newvalue=os.path.join(self.local_location, 'src/plugin'))) - return self.launch_test_application( - self.local_location_binary, + newvalue=os.path.join(self.local_build_location, 'src/plugin'))) + return self.launch_test_application( + self.local_build_location_binary, + '-s', + app_type='qt', + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) + + @autopilot_logging.log_action(logger.info) + def launch_test_sdk(self): + self.useFixture(fixtures.EnvironmentVariable( + 'QML2_IMPORT_PATH', + newvalue=os.path.join(self.sdk_build_location_binary, 'src/plugin'))) + return self.launch_test_application( + self.sdk_build_location_binary, '-s', app_type='qt', emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) === modified file 'tests/autopilot/reminders/tests/test_reminders.py' --- tests/autopilot/reminders/tests/test_reminders.py 2014-12-17 11:10:50 +0000 +++ tests/autopilot/reminders/tests/test_reminders.py 2016-02-17 22:23:49 +0000 @@ -38,7 +38,7 @@ def test_open_application_without_account(self): """Test that the No account dialog is visible.""" - self.assertTrue(self.app.main_view.no_account_dialog.visible) + self.assertTrue(self.app.no_account_dialog.visible) def test_go_to_account_settings(self): """Test that the Go to account settings button calls url-dispatcher.""" @@ -48,7 +48,7 @@ url_dispatcher = fixture_setup.FakeURLDispatcher() self.useFixture(url_dispatcher) - self.app.main_view.no_account_dialog.open_account_settings() + self.app.no_account_dialog.open_account_settings() def get_last_dispatch_url_call_parameter(): # Workaround for http://pad.lv/1312384 @@ -66,7 +66,7 @@ def setUp(self): super(RemindersTestCaseWithAccount, self).setUp() - no_account_dialog = self.app.main_view.no_account_dialog + no_account_dialog = self.app.no_account_dialog self.add_evernote_account() logger.info('Waiting for the Evernote account to be created.') no_account_dialog.wait_until_destroyed()
-- Mailing list: https://launchpad.net/~ubuntu-touch-coreapps-reviewers Post to : ubuntu-touch-coreapps-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~ubuntu-touch-coreapps-reviewers More help : https://help.launchpad.net/ListHelp