Merge lp:~elopio/ubuntu-weather-app/autopilot-1.4 into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Leo Arias
Status: Superseded
Proposed branch: lp:~elopio/ubuntu-weather-app/autopilot-1.4
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Prerequisite: lp:~elopio/ubuntu-weather-app/fix1248296-button_objectName
Diff against target: 143 lines (+46/-19)
4 files modified
debian/control (+1/-1)
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:~elopio/ubuntu-weather-app/autopilot-1.4
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Ubuntu Weather Developers Pending
Review via email: mp+194036@code.launchpad.net

This proposal has been superseded by a proposal from 2013-11-06.

Commit message

Update tests for 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 :
review: Needs Fixing (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote :

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

Unmerged revisions

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-05 23:29:27 +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/test_locationmanager.py'
15--- tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2013-10-07 07:26:30 +0000
16+++ tests/autopilot/ubuntu_weather_app/tests/test_locationmanager.py 2013-11-05 23:29:27 +0000
17@@ -354,4 +354,6 @@
18 # count the tabs
19 tabObjects = self.main_window.select_many('LocationTab', objectName='LocationTab')
20 self.assertThat(lambda: number_of_locations, Eventually(Equals(len(tabObjects))))
21- self.assertThat(tabObjects[1].title, Eventually(Equals("Cairo")))
22+ self.assertThat(
23+ self.main_window.select_single('LocationTab', index=1).title,
24+ Eventually(Equals("Cairo")))
25
26=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_mainview.py'
27--- tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-10-08 08:10:05 +0000
28+++ tests/autopilot/ubuntu_weather_app/tests/test_mainview.py 2013-11-05 23:29:27 +0000
29@@ -41,17 +41,20 @@
30
31 # first tab should be visible after start
32 tabs = self.main_window.get_tabs()
33- tabObjects = self.main_window.select_many('LocationTab',objectName='LocationTab')
34+ first_tab = self.main_window.select_single(
35+ 'LocationTab', index=0)
36+ second_tab = self.main_window.select_single(
37+ 'LocationTab', index=1)
38 self.assertThat(tabs.selectedTabIndex, Eventually(Equals(0)))
39- self.assertThat(tabObjects[0].visible, Eventually(Equals(True)))
40- self.assertThat(tabObjects[1].visible, Eventually(Equals(False)))
41- self.assertThat(tabObjects[0].title, Eventually(Equals("Hamburg")))
42+ self.assertThat(first_tab.visible, Eventually(Equals(True)))
43+ self.assertThat(second_tab.visible, Eventually(Equals(False)))
44+ self.assertThat(first_tab.title, Eventually(Equals("Hamburg")))
45 # switch to next tab
46 self.main_window.switch_to_tab_by_index(1)
47 self.assertThat(tabs.selectedTabIndex, Eventually(Equals(1)))
48- self.assertThat(tabObjects[0].visible, Eventually(Equals(False)))
49- self.assertThat(tabObjects[1].visible, Eventually(Equals(True)))
50- self.assertThat(tabObjects[1].title, Eventually(Equals("London")))
51+ self.assertThat(first_tab.visible, Eventually(Equals(False)))
52+ self.assertThat(second_tab.visible, Eventually(Equals(True)))
53+ self.assertThat(second_tab.title, Eventually(Equals("London")))
54
55 def test_refresh_tabs(self):
56 # get the dates from the test data
57
58=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_settings.py'
59--- tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-10-04 07:54:01 +0000
60+++ tests/autopilot/ubuntu_weather_app/tests/test_settings.py 2013-11-05 23:29:27 +0000
61@@ -38,18 +38,32 @@
62 def _check_units(self, units):
63 """Checks selected units by values from the first location tab"""
64 self.assertThat(lambda: self.main_window.select_many('QQuickText', objectName='CurrentTempText'), Eventually(Not(Is(None))))
65- current_temps = self.main_window.select_many('QQuickText', objectName='CurrentTempText')
66+ current_location_tab = self.main_window.select_single(
67+ 'LocationTab', visible=True)
68+ today_item = current_location_tab.select_single(
69+ 'QQuickItem', focus=True)
70+ today_temp = today_item.select_single(
71+ 'QQuickText', objectName='CurrentTempText')
72+ tomorrow_item = today_item.get_parent().get_children_by_type(
73+ 'QQuickItem', focus=False, z=1)
74+ tomorrow_temp = tomorrow_item[0].select_single(
75+ 'QQuickText', objectName='CurrentTempText')
76 if units == "imperial":
77- self.assertThat(current_temps[0].text, Eventually(Equals(u'57')))
78- self.assertThat(current_temps[1].text, Eventually(Equals(u'69')))
79+ self.assertThat(today_temp.text, Eventually(Equals(u'57')))
80+ self.assertThat(tomorrow_temp.text, Eventually(Equals(u'69')))
81 else:
82- self.assertThat(current_temps[0].text, Eventually(Equals(u'14')))
83- self.assertThat(current_temps[1].text, Eventually(Equals(u'21')))
84+ self.assertThat(today_temp.text, Eventually(Equals(u'14')))
85+ self.assertThat(tomorrow_temp.text, Eventually(Equals(u'21')))
86
87 def _check_wind_units(self, wind_units):
88 """Checks selected units by values from the first location tab"""
89 self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='WindSpeedValue')[0], Eventually(Not(Is(None))))
90- wind_component = self.main_window.select_many('WeatherDetailComponent', objectName='WindSpeedValue')[0]
91+ current_location_tab = self.main_window.select_single(
92+ 'LocationTab', visible=True)
93+ focused_item = current_location_tab.select_single(
94+ 'QQuickItem', focus=True)
95+ wind_component = focused_item.select_single(
96+ 'WeatherDetailComponent', objectName='WindSpeedValue')
97 self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailUnit'), Eventually(Not(Is(None))))
98 wind_unit = wind_component.select_single('QQuickText', objectName='WeatherDetailUnit')
99 self.assertThat(lambda: wind_component.select_single('QQuickText', objectName='WeatherDetailValue'), Eventually(Not(Is(None))))
100@@ -64,7 +78,12 @@
101 def _check_precipitation_units(self, pre_units):
102 """Checks selected units by values from the first location tab"""
103 self.assertThat(lambda: self.main_window.select_many('WeatherDetailComponent', objectName='PrecipitationValue')[0], Eventually(Not(Is(None))))
104- component = self.main_window.select_many('WeatherDetailComponent', objectName='PrecipitationValue')[0]
105+ current_location_tab = self.main_window.select_single(
106+ 'LocationTab', visible=True)
107+ focused_item = current_location_tab.select_single(
108+ 'QQuickItem', focus=True)
109+ component = focused_item.select_single(
110+ 'WeatherDetailComponent', objectName='PrecipitationValue')
111 self.assertThat(lambda: component.select_many('QQuickText', objectName='WeatherDetailUnit'), Eventually(Not(Is(None))))
112 unit = component.select_single('QQuickText', objectName='WeatherDetailUnit')
113 self.assertThat(lambda: component.select_single('QQuickText', objectName='WeatherDetailValue'), Eventually(Not(Is(None))))
114@@ -117,7 +136,7 @@
115 # click celsius option
116 self._move_pointer_around()
117 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
118- metric_option = units_selector.select_many('ShapeItem')[1]
119+ metric_option = units_selector.select_single('Label', text='Celsius')
120 self.pointing_device.click_object(metric_option)
121
122 # confirm
123@@ -210,7 +229,8 @@
124 # click kmh option
125 self._move_pointer_around()
126 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
127- kmh_option = units_selector.select_many('ShapeItem')[1]
128+ kmh_option = units_selector.select_single(
129+ 'Label', text='Kilometers per hour')
130 self.pointing_device.click_object(kmh_option)
131
132 # confirm
133@@ -263,7 +283,9 @@
134 # click mm option
135 self._move_pointer_around()
136 self.assertThat(lambda: units_selector.select_many('ShapeItem')[1], Eventually(Not(Is(None))))
137- mm_option = units_selector.select_many('ShapeItem')[1]
138+ # XXX select the option by it's object name or index, using the
139+ # emulator from the ubuntu-ui-toolkit.
140+ mm_option = units_selector.select_single('Label', text='Millimeters')
141 self.pointing_device.click_object(mm_option)
142
143 # confirm

Subscribers

People subscribed via source and target branches