Merge lp:~thomir-deactivatedaccount/ubuntu-weather-app/autopilot-1.4-porting into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Thomi Richards
Status: Merged
Approved by: Francis Ginther
Approved revision: 155
Merged at revision: 154
Proposed branch: lp:~thomir-deactivatedaccount/ubuntu-weather-app/autopilot-1.4-porting
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 170 lines (+53/-23)
5 files modified
debian/control (+1/-1)
tests/autopilot/ubuntu_weather_app/tests/__init__.py (+7/-4)
tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py (+3/-1)
tests/autopilot/ubuntu_weather_app/tests/test_mainview.py (+10/-7)
tests/autopilot/ubuntu_weather_app/tests/test_settings.py (+32/-10)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/ubuntu-weather-app/autopilot-1.4-porting
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Thomi Richards (community) Approve
Review via email: mp+194059@code.launchpad.net

This proposal supersedes a proposal from 2013-11-05.

Commit message

Port to autopilot 1.4.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote : Posted in a previous version of this proposal

It failed because "Couldn't load weather data". I'll retry the build.

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) :
review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-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 'debian/control'
2--- debian/control 2013-08-15 15:52:32 +0000
3+++ debian/control 2013-11-06 04:01:12 +0000
4@@ -24,7 +24,7 @@
5 Depends: ${misc:Depends},
6 python2.7,
7 ubuntu-weather-app (= ${source:Version}),
8- libautopilot-qt,
9+ libautopilot-qt (>= 1.4),
10 libqt5test5,
11 libqt5widgets5,
12 ubuntu-ui-toolkit-autopilot,
13
14=== modified file 'tests/autopilot/ubuntu_weather_app/tests/__init__.py'
15--- tests/autopilot/ubuntu_weather_app/tests/__init__.py 2013-10-07 18:25:25 +0000
16+++ tests/autopilot/ubuntu_weather_app/tests/__init__.py 2013-11-06 04:01:12 +0000
17@@ -99,15 +99,18 @@
18
19 class SheetMixin(object):
20 """A mixin to to give access to common sheet elements"""
21+
22 def _click_sheet_confirm(self):
23 """Clicks the confirm button"""
24- self.pointing_device.click_object(
25- self.main_window.select_many('Button')[1])
26+ button = self.main_window.select_single(
27+ 'Button', objectName='confirmButton')
28+ self.pointing_device.click_object(button)
29
30 def _click_sheet_cancel(self):
31 """Clicks the cancel button"""
32- self.pointing_device.click_object(
33- self.main_window.select_many('Button')[0])
34+ button = self.main_window.select_single(
35+ 'Button', objectName='cancelButton')
36+ self.pointing_device.click_object(button)
37
38
39 class LocationManagerMixin(object):
40
41=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py'
42--- tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2013-10-07 07:26:30 +0000
43+++ tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2013-11-06 04:01:12 +0000
44@@ -354,4 +354,6 @@
45 # count the tabs
46 tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab')
47 self.assertThat(lambda: number_of_locations, Eventually(Equals(len(tabObjects))))
48- self.assertThat(tabObjects[1].title, Eventually(Equals("Cairo")))
49+ self.assertThat(
50+ self.main_window.select_single('LocationTab', index=1).title,
51+ Eventually(Equals("Cairo")))
52
53=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_mainview.py'
54--- tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-10-08 08:10:05 +0000
55+++ tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-11-06 04:01:12 +0000
56@@ -41,17 +41,20 @@
57
58 # first tab should be visible after start
59 tabs = self.main_window.get_tabs()
60- tabObjects = self.main_window.select_many('LocationTab',objectName='LocationTab')
61+ first_tab = self.main_window.select_single(
62+ 'LocationTab', index=0)
63+ second_tab = self.main_window.select_single(
64+ 'LocationTab', index=1)
65 self.assertThat(tabs.selectedTabIndex, Eventually(Equals(0)))
66- self.assertThat(tabObjects[0].visible, Eventually(Equals(True)))
67- self.assertThat(tabObjects[1].visible, Eventually(Equals(False)))
68- self.assertThat(tabObjects[0].title, Eventually(Equals("Hamburg")))
69+ self.assertThat(first_tab.visible, Eventually(Equals(True)))
70+ self.assertThat(second_tab.visible, Eventually(Equals(False)))
71+ self.assertThat(first_tab.title, Eventually(Equals("Hamburg")))
72 # switch to next tab
73 self.main_window.switch_to_tab_by_index(1)
74 self.assertThat(tabs.selectedTabIndex, Eventually(Equals(1)))
75- self.assertThat(tabObjects[0].visible, Eventually(Equals(False)))
76- self.assertThat(tabObjects[1].visible, Eventually(Equals(True)))
77- self.assertThat(tabObjects[1].title, Eventually(Equals("London")))
78+ self.assertThat(first_tab.visible, Eventually(Equals(False)))
79+ self.assertThat(second_tab.visible, Eventually(Equals(True)))
80+ self.assertThat(second_tab.title, Eventually(Equals("London")))
81
82 def test_refresh_tabs(self):
83 # get the dates from the test data
84
85=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_settings.py'
86--- tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-10-04 07:54:01 +0000
87+++ tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-11-06 04:01:12 +0000
88@@ -38,18 +38,32 @@
89 def _check_units(self, units):
90 """Checks selected units by values from the first location tab"""
91 self.assertThat(lambda: self.main_window.select_many('QQuickText', objectName='CurrentTempText'), Eventually(Not(Is(None))))
92- current_temps = self.main_window.select_many('QQuickText', objectName='CurrentTempText')
93+ current_location_tab = self.main_window.select_single(
94+ 'LocationTab', visible=True)
95+ today_item = current_location_tab.select_single(
96+ 'QQuickItem', focus=True)
97+ today_temp = today_item.select_single(
98+ 'QQuickText', objectName='CurrentTempText')
99+ tomorrow_item = today_item.get_parent().get_children_by_type(
100+ 'QQuickItem', focus=False, z=1)
101+ tomorrow_temp = tomorrow_item[0].select_single(
102+ 'QQuickText', objectName='CurrentTempText')
103 if units == "imperial":
104- self.assertThat(current_temps[0].text, Eventually(Equals(u'57')))
105- self.assertThat(current_temps[1].text, Eventually(Equals(u'69')))
106+ self.assertThat(today_temp.text, Eventually(Equals(u'57')))
107+ self.assertThat(tomorrow_temp.text, Eventually(Equals(u'69')))
108 else:
109- self.assertThat(current_temps[0].text, Eventually(Equals(u'14')))
110- self.assertThat(current_temps[1].text, Eventually(Equals(u'21')))
111+ self.assertThat(today_temp.text, Eventually(Equals(u'14')))
112+ self.assertThat(tomorrow_temp.text, Eventually(Equals(u'21')))
113
114 def _check_wind_units(self, wind_units):
115 """Checks selected units by values from the first location tab"""
116 self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='WindSpeedValue')[0], Eventually(Not(Is(None))))
117- wind_component = self.main_window.select_many('WeatherDetailComponent', objectName='WindSpeedValue')[0]
118+ current_location_tab = self.main_window.select_single(
119+ 'LocationTab', visible=True)
120+ focused_item = current_location_tab.select_single(
121+ 'QQuickItem', focus=True)
122+ wind_component = focused_item.select_single(
123+ 'WeatherDetailComponent', objectName='WindSpeedValue')
124 self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailUnit'), Eventually(Not(Is(None))))
125 wind_unit = wind_component.select_single('QQuickText', objectName='WeatherDetailUnit')
126 self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailValue'), Eventually(Not(Is(None))))
127@@ -64,7 +78,12 @@
128 def _check_precipitation_units(self, pre_units):
129 """Checks selected units by values from the first location tab"""
130 self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='PrecipitationValue')[0], Eventually(Not(Is(None))))
131- component = self.main_window.select_many('WeatherDetailComponent', objectName='PrecipitationValue')[0]
132+ current_location_tab = self.main_window.select_single(
133+ 'LocationTab', visible=True)
134+ focused_item = current_location_tab.select_single(
135+ 'QQuickItem', focus=True)
136+ component = focused_item.select_single(
137+ 'WeatherDetailComponent', objectName='PrecipitationValue')
138 self.assertThat(lambda: component.select_many('QQuickText', objectName='WeatherDetailUnit'), Eventually(Not(Is(None))))
139 unit = component.select_single('QQuickText', objectName='WeatherDetailUnit')
140 self.assertThat(lambda: component.select_single('QQuickText', objectName='WeatherDetailValue'), Eventually(Not(Is(None))))
141@@ -117,7 +136,7 @@
142 # click celsius option
143 self._move_pointer_around()
144 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
145- metric_option = units_selector.select_many('ShapeItem')[1]
146+ metric_option = units_selector.select_single('Label', text='Celsius')
147 self.pointing_device.click_object(metric_option)
148
149 # confirm
150@@ -210,7 +229,8 @@
151 # click kmh option
152 self._move_pointer_around()
153 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
154- kmh_option = units_selector.select_many('ShapeItem')[1]
155+ kmh_option = units_selector.select_single(
156+ 'Label', text='Kilometers per hour')
157 self.pointing_device.click_object(kmh_option)
158
159 # confirm
160@@ -263,7 +283,9 @@
161 # click mm option
162 self._move_pointer_around()
163 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
164- mm_option = units_selector.select_many('ShapeItem')[1]
165+ # XXX select the option by it's object name or index, using the
166+ # emulator from the ubuntu-ui-toolkit.
167+ mm_option = units_selector.select_single('Label', text='Millimeters')
168 self.pointing_device.click_object(mm_option)
169
170 # confirm

Subscribers

People subscribed via source and target branches