← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~fazerlicourice/ubuntu-weather-app/autopilot-test-switch-locations into lp:ubuntu-weather-app

 

You have been requested to review the proposed merge of lp:~fazerlicourice/ubuntu-weather-app/autopilot-test-switch-locations into lp:ubuntu-weather-app.

For more details, see:
https://code.launchpad.net/~fazerlicourice/ubuntu-weather-app/autopilot-test-switch-locations/+merge/282988

Created a test that swipes between the location tabs on the homepage and checks that they change correctly.

-- 
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~fazerlicourice/ubuntu-weather-app/autopilot-test-switch-locations into lp:ubuntu-weather-app.
=== modified file 'AUTHORS'
--- AUTHORS	2015-08-09 15:32:22 +0000
+++ AUTHORS	2016-01-20 01:59:10 +0000
@@ -3,8 +3,9 @@
 In addition, numerous translations, bug reports and other non-code contributions have been made which are equally valued.
 
 Andrew Hayzen <ahayzen@xxxxxxxxx>
+Carla Sella <carla.sella@xxxxxxxxx>
 Daniel Holbach <daniel.holbach@xxxxxxxxxxxxx>
 Martin Borho <martin@xxxxxxxxx>
 Nekhelesh Ramananthan <krnekhelesh@xxxxxxxxx>
+Vamshi Balanaga <vamrocks602@xxxxxxxxx>
 Victor Thompson <victor.thompson@xxxxxxxxx>
-Carla Sella <carla.sella@xxxxxxxxx>

=== modified file 'app/components/HeaderRow.qml'
--- app/components/HeaderRow.qml	2015-11-02 21:28:34 +0000
+++ app/components/HeaderRow.qml	2016-01-20 01:59:10 +0000
@@ -28,6 +28,7 @@
     width: parent.width
 
     Label {
+        objectName: 'headerLabel'
         id: locationNameLabel
         color: UbuntuColors.darkGrey
         elide: Text.ElideRight

=== modified file 'app/ui/LocationPane.qml'
--- app/ui/LocationPane.qml	2015-11-02 21:28:34 +0000
+++ app/ui/LocationPane.qml	2016-01-20 01:59:10 +0000
@@ -68,6 +68,7 @@
         }
 
         HeaderRow {
+            objectName: 'headerRow'
             id: headerRow
             locationName: mainPageWeekdayListView.name
         }

=== modified file 'debian/changelog'
--- debian/changelog	2015-12-17 02:29:07 +0000
+++ debian/changelog	2016-01-20 01:59:10 +0000
@@ -6,6 +6,9 @@
   [ Girish Rawat ]
   * Added new READMEs
 
+  [ Vamshi Balanaga ]
+  * Added test to swipe between location tabs on home page (LP: #1452492)
+
  -- Andrew Hayzen <ahayzen@xxxxxxxxx>  Thu, 03 Dec 2015 15:20:49 +0000
 
 ubuntu-weather-app (3.1ubuntu1) vivid; urgency=medium

=== modified file 'tests/autopilot/ubuntu_weather_app/__init__.py'
--- tests/autopilot/ubuntu_weather_app/__init__.py	2015-11-03 00:38:48 +0000
+++ tests/autopilot/ubuntu_weather_app/__init__.py	2016-01-20 01:59:10 +0000
@@ -27,7 +27,6 @@
 
     return func_wrapper
 
-
 #
 # Base helpers
 #
@@ -201,6 +200,19 @@
     def get_selected_location_pane(self):
         return self.get_location_pane(self.get_selected_location_index())
 
+    def swipe_left(self):
+
+        # Define the start and stop locations of the left swipe
+        start_x = (self.globalRect.x +
+                   (self.globalRect.width * 0.9))
+        stop_x = (self.globalRect.x +
+                  (self.globalRect.width * 0.1))
+        start_y = stop_y = (self.globalRect.y +
+                            (self.globalRect.height * 0.5))
+        rate = 5
+
+        self.pointing_device.drag(start_x, start_y, stop_x, stop_y, rate)
+
 
 class HomeTempInfo(UbuntuUIToolkitCustomProxyObjectBase):
     pass
@@ -221,6 +233,11 @@
 
         return self.get_settings_button()
 
+    def get_name(self):
+        return self.wait_select_single(
+            "HeaderRow", objectName='headerRow').wait_select_single(
+                "UCLabel", objectName='headerLabel').text
+
     def get_day_delegate(self, day):
         return self.wait_select_single(
             "DayDelegate", objectName="dayDelegate" + str(day))

=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_home_page.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_home_page.py	2015-10-22 12:49:35 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_home_page.py	2016-01-20 01:59:10 +0000
@@ -83,3 +83,19 @@
         # Check that the state and height of the HomeTempInfo have changed
         self.assertThat(home_temp_info.state, Eventually(Equals("expanded")))
         self.assertEqual(home_temp_info.height, home_temp_info.expandedHeight)
+
+    def test_swiping_locations(self):
+        """tests swiping between the location tabs"""
+
+        # Check that starts at the first (index = 0) location tab
+        self.assertThat(self.home_page.get_selected_location_index(),
+                        Equals(0))
+
+        # Swipe to the left to switch Location tabs
+        self.home_page.swipe_left()
+
+        # Check that the selected location is now the intended location
+        self.assertThat(self.home_page.get_selected_location_index(),
+                        Eventually(Equals(1)))
+        self.assertThat(self.home_page.get_location_pane(1).get_name(),
+                        Equals('Washington'))