Merge lp:~vthompson/ubuntu-weather-app/fix-1452494 into lp:ubuntu-weather-app

Proposed by Victor Thompson on 2015-08-08
Status: Merged
Approved by: Andrew Hayzen on 2015-08-17
Approved revision: 95
Merged at revision: 96
Proposed branch: lp:~vthompson/ubuntu-weather-app/fix-1452494
Merge into: lp:ubuntu-weather-app
Prerequisite: lp:~vthompson/ubuntu-weather-app/fix-1452499
Diff against target: 90 lines (+39/-3)
4 files modified
app/ui/LocationsPage.qml (+5/-1)
debian/changelog (+3/-0)
tests/autopilot/ubuntu_weather_app/__init__.py (+12/-2)
tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py (+19/-0)
To merge this branch: bzr merge lp:~vthompson/ubuntu-weather-app/fix-1452494
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-08-17
Andrew Hayzen 2015-08-08 Approve on 2015-08-17
Review via email: mp+267446@code.launchpad.net

Commit message

* Create autopilot test which changes the selected location
* When location detection is off, make sure the correct location can be selected

Description of the change

* Create autopilot test which changes the selected location
* When location detection is off, make sure the correct location can be selected

To post a comment you must log in.
Andrew Hayzen (ahayzen) wrote :

One inline comment so far...

review: Needs Fixing
Andrew Hayzen (ahayzen) wrote :

One inline comment to stop repetition of code, otherwise all passing and fixes the bug :-)

review: Needs Fixing
Victor Thompson (vthompson) wrote :

I pushed a fix, but even trunk has 2 failing tests... probably due to OWM servers not working again? Please retest.

Andrew Hayzen (ahayzen) wrote :

LGTM, one of the failing tests I found was due to bug 1485657 which I've created a patch for.

review: Approve
95. By Victor Thompson on 2015-08-17

Merge and resolve conflicts.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/ui/LocationsPage.qml'
--- app/ui/LocationsPage.qml 2015-08-07 00:16:54 +0000
+++ app/ui/LocationsPage.qml 2015-08-17 18:47:09 +0000
@@ -162,7 +162,11 @@
162 reorderable: true162 reorderable: true
163163
164 onItemClicked: {164 onItemClicked: {
165 settings.current = index + 1;165 if (settings.addedCurrentLocation && settings.detectCurrentLocation) {
166 settings.current = index + 1;
167 } else {
168 settings.current = index;
169 }
166170
167 pageStack.pop()171 pageStack.pop()
168 }172 }
169173
=== modified file 'debian/changelog'
--- debian/changelog 2015-08-14 00:11:12 +0000
+++ debian/changelog 2015-08-17 18:47:09 +0000
@@ -18,6 +18,9 @@
18 * Make the tests grab the top of the minimized tooltip to avoid resizing the18 * Make the tests grab the top of the minimized tooltip to avoid resizing the
19 app19 app
20 * Create autopilot test for no locations found from search (LP: #1452501)20 * Create autopilot test for no locations found from search (LP: #1452501)
21 * Create autopilot test which changes the selected location (LP: #1452494)
22 * When location detection is off, make sure the correct location can be
23 selected (LP: #1482936)
2124
22 [ Andrew Hayzen ]25 [ Andrew Hayzen ]
23 * Add mocked locations for autopilot and add a test using the data26 * Add mocked locations for autopilot and add a test using the data
2427
=== modified file 'tests/autopilot/ubuntu_weather_app/__init__.py'
--- tests/autopilot/ubuntu_weather_app/__init__.py 2015-08-14 00:11:12 +0000
+++ tests/autopilot/ubuntu_weather_app/__init__.py 2015-08-17 18:47:09 +0000
@@ -131,9 +131,15 @@
131 def __init__(self, *args, **kwargs):131 def __init__(self, *args, **kwargs):
132 super(HomePage, self).__init__(*args, **kwargs)132 super(HomePage, self).__init__(*args, **kwargs)
133133
134 def get_location_pages(self):
135 return self.wait_select_single(
136 "QQuickListView", objectName="locationPages")
137
134 def get_location_count(self):138 def get_location_count(self):
135 return self.wait_select_single(139 return self.get_location_pages().count
136 "QQuickListView", objectName="locationPages").count140
141 def get_selected_location_index(self):
142 return self.get_location_pages().currentIndex
137143
138 def get_daydelegate(self, weekdaycolumn, day):144 def get_daydelegate(self, weekdaycolumn, day):
139 weekdaycolumn = self.wait_select_single(145 weekdaycolumn = self.wait_select_single(
@@ -154,6 +160,10 @@
154 def click_add_location_action(self):160 def click_add_location_action(self):
155 self.main_view.get_header().click_action_button("addLocation")161 self.main_view.get_header().click_action_button("addLocation")
156162
163 @click_object
164 def click_location(self, index):
165 return self.get_location(index)
166
157 def get_location(self, index):167 def get_location(self, index):
158 return self.select_single(WeatherListItem,168 return self.select_single(WeatherListItem,
159 objectName="location" + str(index))169 objectName="location" + str(index))
160170
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py 2015-08-09 01:44:36 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py 2015-08-17 18:47:09 +0000
@@ -65,3 +65,22 @@
6565
66 # Check homepage is now visible66 # Check homepage is now visible
67 self.assertThat(self.home_page.visible, Eventually(Equals(True)))67 self.assertThat(self.home_page.visible, Eventually(Equals(True)))
68
69 def test_changing_location(self):
70 """ tests changing the selected location """
71
72 # Get the current index for the selected location
73 current_index = self.home_page.get_selected_location_index()
74
75 # Set the index of the location to be selected
76 new_index = current_index + 1
77
78 # Select the list item of the second location
79 self.locations_page.click_location(new_index)
80
81 # Check that the selected location is now the intended location
82 self.assertThat(self.home_page.get_selected_location_index(),
83 Eventually(Equals(new_index)))
84
85 # Check homepage is now visible
86 self.assertThat(self.home_page.visible, Eventually(Equals(True)))

Subscribers

People subscribed via source and target branches

to all changes: