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

Proposed by Andrew Hayzen on 2015-09-04
Status: Merged
Approved by: Victor Thompson on 2015-09-04
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 2015-09-04 Approve on 2015-09-04
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-09-04
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.
115. By Andrew Hayzen on 2015-09-04

* Remove mention of MusicPage and Albums :-)

Victor Thompson (vthompson) wrote :

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

review: Needs Fixing
116. By Andrew Hayzen on 2015-09-04

* Rename extra_day_delegate to day_delegate_extra_info

Victor Thompson (vthompson) wrote :

lgtm!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/components/DayDelegateExtraInfo.qml'
2--- app/components/DayDelegateExtraInfo.qml 2015-08-26 20:35:22 +0000
3+++ app/components/DayDelegateExtraInfo.qml 2015-09-04 22:56:41 +0000
4@@ -25,8 +25,14 @@
5 anchors {
6 centerIn: parent
7 }
8+ objectName: "dayDelegateExtraInfo"
9 spacing: units.gu(2)
10
11+ // Hack for autopilot otherwise DayDelegateExtraInfo appears as Column
12+ // due to bug 1341671 it is required that there is a property so that
13+ // qml doesn't optimise using the parent type
14+ property bool bug1341671workaround: true
15+
16 // FIXME: extended-infomation_* aren't actually on device
17
18 // Overview text
19@@ -51,6 +57,7 @@
20 id: windForecast
21 forecast: i18n.tr("Winds")
22 imageSource: "../graphics/extended-information_wind.svg"
23+ objectName: "windForecast"
24 value: modelData.wind
25 }
26
27
28=== modified file 'debian/changelog'
29--- debian/changelog 2015-08-28 21:54:22 +0000
30+++ debian/changelog 2015-09-04 22:56:41 +0000
31@@ -42,6 +42,7 @@
32 * Split day delegate extra info into a separate component that is loaded on demand
33 * Use ListView per Location Pane so that scrolling vertically only affect the currently focused pane
34 * Add autopilot tests which check that data is migrated correctly (LP: #1485262)
35+ * Fix for wind test failing and some selects not waiting for visible=True (LP: #1492321)
36
37 [ Carla Sella ]
38 * Create autopilot test which shows the day delegate (LP: #1452491)
39
40=== modified file 'tests/autopilot/ubuntu_weather_app/__init__.py'
41--- tests/autopilot/ubuntu_weather_app/__init__.py 2015-08-26 20:35:22 +0000
42+++ tests/autopilot/ubuntu_weather_app/__init__.py 2015-09-04 22:56:41 +0000
43@@ -20,7 +20,9 @@
44 def click_object(func):
45 """Wrapper which clicks the returned object"""
46 def func_wrapper(self, *args, **kwargs):
47- return self.pointing_device.click_object(func(self, *args, **kwargs))
48+ item = func(self, *args, **kwargs)
49+ self.pointing_device.click_object(item)
50+ return item
51
52 return func_wrapper
53
54@@ -48,7 +50,7 @@
55 LocationsPage, objectName="locationsPage")
56
57 def get_settings_page(self):
58- return self.main_view.wait_select_single(SettingsPage)
59+ return self.main_view.wait_select_single(SettingsPage, visible=True)
60
61
62 class Page(UbuntuUIToolkitCustomProxyObjectBase):
63@@ -129,6 +131,27 @@
64 self.searching.wait_for(False)
65
66
67+class DayDelegate(UbuntuUIToolkitCustomProxyObjectBase):
68+ @click_object
69+ def click_self(self):
70+ return self
71+
72+ def get_extra_info(self):
73+ """Expand the delegate and get the extra info"""
74+ self.click_self()
75+
76+ return self.wait_select_single(DayDelegateExtraInfo,
77+ objectName="dayDelegateExtraInfo",
78+ visible=True)
79+
80+
81+class DayDelegateExtraInfo(UbuntuUIToolkitCustomProxyObjectBase):
82+ @property
83+ def wind(self):
84+ return self.select_single("ForecastDetailsDelegate",
85+ objectName="windForecast").value
86+
87+
88 class HomePage(PageWithBottomEdge):
89 """Autopilot helper for HomePage."""
90 def __init__(self, *args, **kwargs):
91@@ -148,7 +171,7 @@
92 listview = self.wait_select_single(
93 "LocationPane", objectName="locationListView" + str(location))
94 return listview.wait_select_single(
95- "DayDelegate", objectName="dayDelegate" + str(day))
96+ DayDelegate, objectName="dayDelegate" + str(day))
97
98 @click_object
99 def click_daydelegate(self, day_delegate):
100@@ -212,21 +235,26 @@
101 return self.select_single("StandardListItem", title=listitem_title)
102
103 def get_units_page(self):
104- return self.main_view.wait_select_single(UnitsPage)
105+ return self.main_view.wait_select_single(UnitsPage, visible=True)
106
107
108 class UnitsPage(Page):
109 """Autopilot helper for UnitsPage."""
110 @click_object
111+ def click_not_selected_listitem(self, unit_name):
112+ return self.get_expanded_listitem(unit_name, "False")
113+
114+ @click_object
115+ def click_units_listitem(self, listitem):
116+ return self.select_single("ExpandableListItem", objectName=listitem)
117+
118 def expand_units_listitem(self, listitem):
119- return self.select_single("ExpandableListItem", objectName=listitem)
120+ item = self.click_units_listitem(listitem)
121+ item.expanded.wait_for(True)
122+ return item
123
124 def get_expanded_listitem(self, listitem, showIcon):
125 listitemSetting = self.select_single(
126 "ExpandableListItem", objectName=listitem)
127 return listitemSetting.select_single(
128 "StandardListItem", showIcon=showIcon)
129-
130- @click_object
131- def click_not_selected_listitem(self, unit_name):
132- return self.get_expanded_listitem(unit_name, "False")
133
134=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_settings_page.py'
135--- tests/autopilot/ubuntu_weather_app/tests/test_settings_page.py 2015-08-24 16:56:55 +0000
136+++ tests/autopilot/ubuntu_weather_app/tests/test_settings_page.py 2015-09-04 22:56:41 +0000
137@@ -27,7 +27,6 @@
138 super(TestSettingsPage, self).setUp()
139
140 self.home_page = self.app.get_home_page()
141- self.home_page.click_settings_button()
142
143 def test_switch_temperature_units(self):
144 """ tests switching temperature units in Units page """
145@@ -56,13 +55,17 @@
146 previous_unit = self._change_listitem_unit(unit_name)
147
148 day_delegate = self.home_page.get_daydelegate(0, 0)
149- wind_unit = day_delegate.wind.split(" ", 1)
150+ day_delegate_extra_info = day_delegate.get_extra_info()
151+ wind_unit = day_delegate_extra_info.wind.split(" ", 1)
152
153 self.assertThat(wind_unit[0].endswith(previous_unit), Equals(False))
154
155 def _change_listitem_unit(self, unit_name):
156 """ Common actions to change listitem unit for temperature and wind
157 speed tests """
158+
159+ self.home_page.click_settings_button()
160+
161 settings_page = self.app.get_settings_page()
162 settings_page.click_settings_page_listitem("Units")
163
164@@ -87,5 +90,5 @@
165 if low_unit == high_unit:
166 return high_unit
167 elif unit_name == "windSetting":
168- wind_unit = day_delegate.wind.split(" ", 1)[0][-3:]
169- return wind_unit
170+ day_delegate_extra_info = day_delegate.get_extra_info()
171+ return day_delegate_extra_info.wind.split(" ", 1)[0][-3:]

Subscribers

People subscribed via source and target branches

to all changes: