← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

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

 

Victor Thompson has proposed merging lp:~vthompson/ubuntu-weather-app/fix-1452494 into lp:ubuntu-weather-app/reboot with lp:~vthompson/ubuntu-weather-app/fix-1452499 as a prerequisite.

Commit message:
* Create autopilot test which changes the selected location

Requested reviews:
  Ubuntu Weather Developers (ubuntu-weather-dev)
Related bugs:
  Bug #1452494 in Ubuntu Weather App: "[reboot] Autopilot Testcase Needed: Switch locations via locations tab in bottom edge"
  https://bugs.launchpad.net/ubuntu-weather-app/+bug/1452494

For more details, see:
https://code.launchpad.net/~vthompson/ubuntu-weather-app/fix-1452494/+merge/267446

* Create autopilot test which changes the selected location
-- 
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~vthompson/ubuntu-weather-app/fix-1452494 into lp:ubuntu-weather-app/reboot.
=== modified file 'debian/changelog'
--- debian/changelog	2015-08-08 23:54:35 +0000
+++ debian/changelog	2015-08-08 23:54:35 +0000
@@ -12,6 +12,7 @@
   * Rename EmptyStateComponent to HomePageEmptyStateComponent
   * Add a LocationsPageEmptyStateComponent
   * Create autopilot test which removes a single location (LP: #1452499)
+  * Create autopilot test which changes the selected location (LP: #1452494)
 
   [ Andrew Hayzen ]
   * Add mocked locations for autopilot and add a test using the data

=== modified file 'tests/autopilot/ubuntu_weather_app/__init__.py'
--- tests/autopilot/ubuntu_weather_app/__init__.py	2015-08-08 23:54:35 +0000
+++ tests/autopilot/ubuntu_weather_app/__init__.py	2015-08-08 23:54:35 +0000
@@ -126,6 +126,10 @@
         return self.wait_select_single(
             "QQuickListView", objectName="locationPages").count
 
+    def get_selected_location_index(self):
+        return self.wait_select_single(
+            "QQuickListView", objectName="locationPages").currentIndex
+
 
 class LocationsPage(Page):
     """Autopilot helper for LocationsPage."""
@@ -135,6 +139,11 @@
     def click_add_location_action(self):
         self.main_view.get_header().click_action_button("addLocation")
 
+    @click_object
+    def click_location(self, index):
+        return self.select_single(WeatherListItem,
+                                  objectName="location" + str(index))
+
     def get_location(self, index):
         return self.select_single(WeatherListItem,
                                   objectName="location" + str(index))

=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py	2015-08-08 23:54:35 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py	2015-08-08 23:54:35 +0000
@@ -65,3 +65,19 @@
 
         # Check homepage is now visible
         self.assertThat(self.home_page.visible, Eventually(Equals(True)))
+
+    def test_changing_location(self):
+        """ tests changing the selected location """
+
+        # Get the current index for the selected location (0)
+        current_index = self.home_page.get_selected_location_index()
+
+        # Select the list item of the second location
+        self.locations_page.click_location(1)
+
+        # Check that the first location is not London
+        self.assertThat(self.home_page.get_selected_location_index(),
+                        Eventually(NotEquals(current_index)))
+
+        # Check homepage is now visible
+        self.assertThat(self.home_page.visible, Eventually(Equals(True)))


Follow ups