Merge lp:~nskaggs/reminders-app/fix-ap-tests into lp:reminders-app

Proposed by Nicholas Skaggs
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 538
Merged at revision: 537
Proposed branch: lp:~nskaggs/reminders-app/fix-ap-tests
Merge into: lp:reminders-app
Diff against target: 149 lines (+46/-25)
3 files modified
tests/autopilot/reminders/__init__.py (+16/-14)
tests/autopilot/reminders/tests/__init__.py (+27/-8)
tests/autopilot/reminders/tests/test_reminders.py (+3/-3)
To merge this branch: bzr merge lp:~nskaggs/reminders-app/fix-ap-tests
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve
Ubuntu Notes app developers Pending
Review via email: mp+286422@code.launchpad.net

Commit message

Adds support for running autopilot tests with SDK out of tree builds
Fix reminders.tests.test_reminders.RemindersTestCaseWithoutAccount tests

Description of the change

Adds support for running autopilot tests with SDK out of tree builds
Fix reminders.tests.test_reminders.RemindersTestCaseWithoutAccount tests

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/reminders/__init__.py'
2--- tests/autopilot/reminders/__init__.py 2014-11-25 16:36:33 +0000
3+++ tests/autopilot/reminders/__init__.py 2016-02-17 22:23:49 +0000
4@@ -41,7 +41,20 @@
5
6 def __init__(self, app_proxy):
7 self.app = app_proxy
8- self.main_view = self.app.select_single(MainView)
9+ # Use only objectName due to bug 1350532
10+ self.main_view = self.app.wait_select_single(objectName="mainView")
11+
12+
13+ @property
14+ def no_account_dialog(self):
15+ try:
16+ self._no_account_dialog = self.app.wait_select_single(
17+ objectName='noAccountDialog')
18+ except dbus.StateNotFoundError:
19+ raise RemindersAppException(
20+ 'The No Account dialog is not present')
21+ else:
22+ return self._no_account_dialog
23
24 def open_notebooks(self):
25 """Open the Notebooks page.
26@@ -61,19 +74,7 @@
27 def __init__(self, *args):
28 super(MainView, self).__init__(*args)
29 self.visible.wait_for(True)
30- try:
31- self._no_account_dialog = self.select_single(
32- objectName='noAccountDialog')
33- except dbus.StateNotFoundError:
34- self._no_account_dialog = None
35
36- @property
37- def no_account_dialog(self):
38- if self._no_account_dialog is None:
39- raise RemindersAppException(
40- 'The No Account dialog is not present')
41- else:
42- return self._no_account_dialog
43
44
45 class NoAccountDialog(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
46@@ -108,7 +109,8 @@
47 super(_Page, self).__init__(*args)
48 # XXX we need a better way to keep reference to the main view.
49 # --elopio - 2014-02-26
50- self.main_view = self.get_root_instance().select_single(MainView)
51+ self.main_view = \
52+ self.get_root_instance().wait_select_single(objectName="mainView")
53
54
55 class PulldownListView(ubuntuuitoolkit.QQuickListView):
56
57=== modified file 'tests/autopilot/reminders/tests/__init__.py'
58--- tests/autopilot/reminders/tests/__init__.py 2014-11-13 10:30:34 +0000
59+++ tests/autopilot/reminders/tests/__init__.py 2016-02-17 22:23:49 +0000
60@@ -41,11 +41,16 @@
61
62 """
63
64- local_location = os.path.dirname(os.path.dirname(os.getcwd()))
65+ local_build_location = os.path.dirname(os.path.dirname(os.getcwd()))
66+ sdk_build_location = os.path.join(os.path.dirname(local_build_location),
67+ os.path.basename(local_build_location) + '-build')
68
69- local_location_qml = os.path.join(
70- local_location, 'src/app/qml/reminders.qml')
71- local_location_binary = os.path.join(local_location, 'src/app/reminders')
72+ local_build_location_qml = os.path.join(
73+ local_build_location, 'src/app/qml/reminders.qml')
74+ local_build_location_binary = os.path.join(local_build_location, 'src/app/reminders')
75+ sdk_build_location_qml = os.path.join(
76+ sdk_build_location, 'src/app/qml/reminders.qml')
77+ sdk_build_location_binary = os.path.join(sdk_build_location, 'src/app/reminders')
78 installed_location_binary = '/usr/bin/reminders'
79 installed_location_qml = '/usr/share/reminders/qml/reminders.qml'
80
81@@ -63,9 +68,12 @@
82 subprocess.call(['pkill', '-9', 'signond'])
83
84 def get_launcher_method_and_type(self):
85- if os.path.exists(self.local_location_binary):
86+ if os.path.exists(self.local_build_location_binary):
87 launcher = self.launch_test_local
88 test_type = 'local'
89+ elif os.path.exists(self.sdk_build_location_binary):
90+ launcher = self.launch_test_sdk
91+ test_type = 'sdk'
92 elif os.path.exists(self.installed_location_binary):
93 launcher = self.launch_test_installed
94 test_type = 'deb'
95@@ -78,9 +86,20 @@
96 def launch_test_local(self):
97 self.useFixture(fixtures.EnvironmentVariable(
98 'QML2_IMPORT_PATH',
99- newvalue=os.path.join(self.local_location, 'src/plugin')))
100- return self.launch_test_application(
101- self.local_location_binary,
102+ newvalue=os.path.join(self.local_build_location, 'src/plugin')))
103+ return self.launch_test_application(
104+ self.local_build_location_binary,
105+ '-s',
106+ app_type='qt',
107+ emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
108+
109+ @autopilot_logging.log_action(logger.info)
110+ def launch_test_sdk(self):
111+ self.useFixture(fixtures.EnvironmentVariable(
112+ 'QML2_IMPORT_PATH',
113+ newvalue=os.path.join(self.sdk_build_location_binary, 'src/plugin')))
114+ return self.launch_test_application(
115+ self.sdk_build_location_binary,
116 '-s',
117 app_type='qt',
118 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
119
120=== modified file 'tests/autopilot/reminders/tests/test_reminders.py'
121--- tests/autopilot/reminders/tests/test_reminders.py 2014-12-17 11:10:50 +0000
122+++ tests/autopilot/reminders/tests/test_reminders.py 2016-02-17 22:23:49 +0000
123@@ -38,7 +38,7 @@
124
125 def test_open_application_without_account(self):
126 """Test that the No account dialog is visible."""
127- self.assertTrue(self.app.main_view.no_account_dialog.visible)
128+ self.assertTrue(self.app.no_account_dialog.visible)
129
130 def test_go_to_account_settings(self):
131 """Test that the Go to account settings button calls url-dispatcher."""
132@@ -48,7 +48,7 @@
133 url_dispatcher = fixture_setup.FakeURLDispatcher()
134 self.useFixture(url_dispatcher)
135
136- self.app.main_view.no_account_dialog.open_account_settings()
137+ self.app.no_account_dialog.open_account_settings()
138
139 def get_last_dispatch_url_call_parameter():
140 # Workaround for http://pad.lv/1312384
141@@ -66,7 +66,7 @@
142
143 def setUp(self):
144 super(RemindersTestCaseWithAccount, self).setUp()
145- no_account_dialog = self.app.main_view.no_account_dialog
146+ no_account_dialog = self.app.no_account_dialog
147 self.add_evernote_account()
148 logger.info('Waiting for the Evernote account to be created.')
149 no_account_dialog.wait_until_destroyed()

Subscribers

People subscribed via source and target branches