Merge lp:~ahayzen/ubuntu-weather-app/fix-1492321-autopilot-tests into lp:ubuntu-weather-app

Proposed by Andrew Hayzen
Status: Merged
Approved by: Victor Thompson
Approved revision: 116
Merged at revision: 114
Proposed branch: lp:~ahayzen/ubuntu-weather-app/fix-1492321-autopilot-tests
Merge into: lp:ubuntu-weather-app
Diff against target: 171 lines (+52/-13)
4 files modified
app/components/DayDelegateExtraInfo.qml (+7/-0)
debian/changelog (+1/-0)
tests/autopilot/ubuntu_weather_app/__init__.py (+37/-9)
tests/autopilot/ubuntu_weather_app/tests/test_settings_page.py (+7/-4)
To merge this branch: bzr merge lp:~ahayzen/ubuntu-weather-app/fix-1492321-autopilot-tests
Reviewer Review Type Date Requested Status
Victor Thompson Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+270224@code.launchpad.net

Commit message

* Fix for wind test failing and some selects not waiting for visible=True

Description of the change

* Fix for wind test failing and some selects not waiting for visible=True

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
115. By Andrew Hayzen

* Remove mention of MusicPage and Albums :-)

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

One inline comment to fix. Otherwise this fix looks good. Thanks!

review: Needs Fixing
116. By Andrew Hayzen

* Rename extra_day_delegate to day_delegate_extra_info

Revision history for this message
Victor Thompson (vthompson) wrote :

lgtm!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/components/DayDelegateExtraInfo.qml'
--- app/components/DayDelegateExtraInfo.qml 2015-08-26 20:35:22 +0000
+++ app/components/DayDelegateExtraInfo.qml 2015-09-04 22:56:41 +0000
@@ -25,8 +25,14 @@
25 anchors {25 anchors {
26 centerIn: parent26 centerIn: parent
27 }27 }
28 objectName: "dayDelegateExtraInfo"
28 spacing: units.gu(2)29 spacing: units.gu(2)
2930
31 // Hack for autopilot otherwise DayDelegateExtraInfo appears as Column
32 // due to bug 1341671 it is required that there is a property so that
33 // qml doesn't optimise using the parent type
34 property bool bug1341671workaround: true
35
30 // FIXME: extended-infomation_* aren't actually on device36 // FIXME: extended-infomation_* aren't actually on device
3137
32 // Overview text38 // Overview text
@@ -51,6 +57,7 @@
51 id: windForecast57 id: windForecast
52 forecast: i18n.tr("Winds")58 forecast: i18n.tr("Winds")
53 imageSource: "../graphics/extended-information_wind.svg"59 imageSource: "../graphics/extended-information_wind.svg"
60 objectName: "windForecast"
54 value: modelData.wind61 value: modelData.wind
55 }62 }
5663
5764
=== modified file 'debian/changelog'
--- debian/changelog 2015-08-28 21:54:22 +0000
+++ debian/changelog 2015-09-04 22:56:41 +0000
@@ -42,6 +42,7 @@
42 * Split day delegate extra info into a separate component that is loaded on demand42 * Split day delegate extra info into a separate component that is loaded on demand
43 * Use ListView per Location Pane so that scrolling vertically only affect the currently focused pane43 * Use ListView per Location Pane so that scrolling vertically only affect the currently focused pane
44 * Add autopilot tests which check that data is migrated correctly (LP: #1485262)44 * Add autopilot tests which check that data is migrated correctly (LP: #1485262)
45 * Fix for wind test failing and some selects not waiting for visible=True (LP: #1492321)
4546
46 [ Carla Sella ]47 [ Carla Sella ]
47 * Create autopilot test which shows the day delegate (LP: #1452491)48 * Create autopilot test which shows the day delegate (LP: #1452491)
4849
=== modified file 'tests/autopilot/ubuntu_weather_app/__init__.py'
--- tests/autopilot/ubuntu_weather_app/__init__.py 2015-08-26 20:35:22 +0000
+++ tests/autopilot/ubuntu_weather_app/__init__.py 2015-09-04 22:56:41 +0000
@@ -20,7 +20,9 @@
20def click_object(func):20def click_object(func):
21 """Wrapper which clicks the returned object"""21 """Wrapper which clicks the returned object"""
22 def func_wrapper(self, *args, **kwargs):22 def func_wrapper(self, *args, **kwargs):
23 return self.pointing_device.click_object(func(self, *args, **kwargs))23 item = func(self, *args, **kwargs)
24 self.pointing_device.click_object(item)
25 return item
2426
25 return func_wrapper27 return func_wrapper
2628
@@ -48,7 +50,7 @@
48 LocationsPage, objectName="locationsPage")50 LocationsPage, objectName="locationsPage")
4951
50 def get_settings_page(self):52 def get_settings_page(self):
51 return self.main_view.wait_select_single(SettingsPage)53 return self.main_view.wait_select_single(SettingsPage, visible=True)
5254
5355
54class Page(UbuntuUIToolkitCustomProxyObjectBase):56class Page(UbuntuUIToolkitCustomProxyObjectBase):
@@ -129,6 +131,27 @@
129 self.searching.wait_for(False)131 self.searching.wait_for(False)
130132
131133
134class DayDelegate(UbuntuUIToolkitCustomProxyObjectBase):
135 @click_object
136 def click_self(self):
137 return self
138
139 def get_extra_info(self):
140 """Expand the delegate and get the extra info"""
141 self.click_self()
142
143 return self.wait_select_single(DayDelegateExtraInfo,
144 objectName="dayDelegateExtraInfo",
145 visible=True)
146
147
148class DayDelegateExtraInfo(UbuntuUIToolkitCustomProxyObjectBase):
149 @property
150 def wind(self):
151 return self.select_single("ForecastDetailsDelegate",
152 objectName="windForecast").value
153
154
132class HomePage(PageWithBottomEdge):155class HomePage(PageWithBottomEdge):
133 """Autopilot helper for HomePage."""156 """Autopilot helper for HomePage."""
134 def __init__(self, *args, **kwargs):157 def __init__(self, *args, **kwargs):
@@ -148,7 +171,7 @@
148 listview = self.wait_select_single(171 listview = self.wait_select_single(
149 "LocationPane", objectName="locationListView" + str(location))172 "LocationPane", objectName="locationListView" + str(location))
150 return listview.wait_select_single(173 return listview.wait_select_single(
151 "DayDelegate", objectName="dayDelegate" + str(day))174 DayDelegate, objectName="dayDelegate" + str(day))
152175
153 @click_object176 @click_object
154 def click_daydelegate(self, day_delegate):177 def click_daydelegate(self, day_delegate):
@@ -212,21 +235,26 @@
212 return self.select_single("StandardListItem", title=listitem_title)235 return self.select_single("StandardListItem", title=listitem_title)
213236
214 def get_units_page(self):237 def get_units_page(self):
215 return self.main_view.wait_select_single(UnitsPage)238 return self.main_view.wait_select_single(UnitsPage, visible=True)
216239
217240
218class UnitsPage(Page):241class UnitsPage(Page):
219 """Autopilot helper for UnitsPage."""242 """Autopilot helper for UnitsPage."""
220 @click_object243 @click_object
244 def click_not_selected_listitem(self, unit_name):
245 return self.get_expanded_listitem(unit_name, "False")
246
247 @click_object
248 def click_units_listitem(self, listitem):
249 return self.select_single("ExpandableListItem", objectName=listitem)
250
221 def expand_units_listitem(self, listitem):251 def expand_units_listitem(self, listitem):
222 return self.select_single("ExpandableListItem", objectName=listitem)252 item = self.click_units_listitem(listitem)
253 item.expanded.wait_for(True)
254 return item
223255
224 def get_expanded_listitem(self, listitem, showIcon):256 def get_expanded_listitem(self, listitem, showIcon):
225 listitemSetting = self.select_single(257 listitemSetting = self.select_single(
226 "ExpandableListItem", objectName=listitem)258 "ExpandableListItem", objectName=listitem)
227 return listitemSetting.select_single(259 return listitemSetting.select_single(
228 "StandardListItem", showIcon=showIcon)260 "StandardListItem", showIcon=showIcon)
229
230 @click_object
231 def click_not_selected_listitem(self, unit_name):
232 return self.get_expanded_listitem(unit_name, "False")
233261
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_settings_page.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_settings_page.py 2015-08-24 16:56:55 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_settings_page.py 2015-09-04 22:56:41 +0000
@@ -27,7 +27,6 @@
27 super(TestSettingsPage, self).setUp()27 super(TestSettingsPage, self).setUp()
2828
29 self.home_page = self.app.get_home_page()29 self.home_page = self.app.get_home_page()
30 self.home_page.click_settings_button()
3130
32 def test_switch_temperature_units(self):31 def test_switch_temperature_units(self):
33 """ tests switching temperature units in Units page """32 """ tests switching temperature units in Units page """
@@ -56,13 +55,17 @@
56 previous_unit = self._change_listitem_unit(unit_name)55 previous_unit = self._change_listitem_unit(unit_name)
5756
58 day_delegate = self.home_page.get_daydelegate(0, 0)57 day_delegate = self.home_page.get_daydelegate(0, 0)
59 wind_unit = day_delegate.wind.split(" ", 1)58 day_delegate_extra_info = day_delegate.get_extra_info()
59 wind_unit = day_delegate_extra_info.wind.split(" ", 1)
6060
61 self.assertThat(wind_unit[0].endswith(previous_unit), Equals(False))61 self.assertThat(wind_unit[0].endswith(previous_unit), Equals(False))
6262
63 def _change_listitem_unit(self, unit_name):63 def _change_listitem_unit(self, unit_name):
64 """ Common actions to change listitem unit for temperature and wind64 """ Common actions to change listitem unit for temperature and wind
65 speed tests """65 speed tests """
66
67 self.home_page.click_settings_button()
68
66 settings_page = self.app.get_settings_page()69 settings_page = self.app.get_settings_page()
67 settings_page.click_settings_page_listitem("Units")70 settings_page.click_settings_page_listitem("Units")
6871
@@ -87,5 +90,5 @@
87 if low_unit == high_unit:90 if low_unit == high_unit:
88 return high_unit91 return high_unit
89 elif unit_name == "windSetting":92 elif unit_name == "windSetting":
90 wind_unit = day_delegate.wind.split(" ", 1)[0][-3:]93 day_delegate_extra_info = day_delegate.get_extra_info()
91 return wind_unit94 return day_delegate_extra_info.wind.split(" ", 1)[0][-3:]

Subscribers

People subscribed via source and target branches

to all changes: