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
1=== modified file 'app/ui/LocationsPage.qml'
2--- app/ui/LocationsPage.qml 2015-08-07 00:16:54 +0000
3+++ app/ui/LocationsPage.qml 2015-08-17 18:47:09 +0000
4@@ -162,7 +162,11 @@
5 reorderable: true
6
7 onItemClicked: {
8- settings.current = index + 1;
9+ if (settings.addedCurrentLocation && settings.detectCurrentLocation) {
10+ settings.current = index + 1;
11+ } else {
12+ settings.current = index;
13+ }
14
15 pageStack.pop()
16 }
17
18=== modified file 'debian/changelog'
19--- debian/changelog 2015-08-14 00:11:12 +0000
20+++ debian/changelog 2015-08-17 18:47:09 +0000
21@@ -18,6 +18,9 @@
22 * Make the tests grab the top of the minimized tooltip to avoid resizing the
23 app
24 * Create autopilot test for no locations found from search (LP: #1452501)
25+ * Create autopilot test which changes the selected location (LP: #1452494)
26+ * When location detection is off, make sure the correct location can be
27+ selected (LP: #1482936)
28
29 [ Andrew Hayzen ]
30 * Add mocked locations for autopilot and add a test using the data
31
32=== modified file 'tests/autopilot/ubuntu_weather_app/__init__.py'
33--- tests/autopilot/ubuntu_weather_app/__init__.py 2015-08-14 00:11:12 +0000
34+++ tests/autopilot/ubuntu_weather_app/__init__.py 2015-08-17 18:47:09 +0000
35@@ -131,9 +131,15 @@
36 def __init__(self, *args, **kwargs):
37 super(HomePage, self).__init__(*args, **kwargs)
38
39+ def get_location_pages(self):
40+ return self.wait_select_single(
41+ "QQuickListView", objectName="locationPages")
42+
43 def get_location_count(self):
44- return self.wait_select_single(
45- "QQuickListView", objectName="locationPages").count
46+ return self.get_location_pages().count
47+
48+ def get_selected_location_index(self):
49+ return self.get_location_pages().currentIndex
50
51 def get_daydelegate(self, weekdaycolumn, day):
52 weekdaycolumn = self.wait_select_single(
53@@ -154,6 +160,10 @@
54 def click_add_location_action(self):
55 self.main_view.get_header().click_action_button("addLocation")
56
57+ @click_object
58+ def click_location(self, index):
59+ return self.get_location(index)
60+
61 def get_location(self, index):
62 return self.select_single(WeatherListItem,
63 objectName="location" + str(index))
64
65=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py'
66--- tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py 2015-08-09 01:44:36 +0000
67+++ tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py 2015-08-17 18:47:09 +0000
68@@ -65,3 +65,22 @@
69
70 # Check homepage is now visible
71 self.assertThat(self.home_page.visible, Eventually(Equals(True)))
72+
73+ def test_changing_location(self):
74+ """ tests changing the selected location """
75+
76+ # Get the current index for the selected location
77+ current_index = self.home_page.get_selected_location_index()
78+
79+ # Set the index of the location to be selected
80+ new_index = current_index + 1
81+
82+ # Select the list item of the second location
83+ self.locations_page.click_location(new_index)
84+
85+ # Check that the selected location is now the intended location
86+ self.assertThat(self.home_page.get_selected_location_index(),
87+ Eventually(Equals(new_index)))
88+
89+ # Check homepage is now visible
90+ self.assertThat(self.home_page.visible, Eventually(Equals(True)))

Subscribers

People subscribed via source and target branches

to all changes: