← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~vthompson/ubuntu-weather-app/fix-1452486-pull-refresh into lp:ubuntu-weather-app/reboot

 

Victor Thompson has proposed merging lp:~vthompson/ubuntu-weather-app/fix-1452486-pull-refresh into lp:ubuntu-weather-app/reboot.

Commit message:
* Create autopilot test which does a pull to refresh action

Requested reviews:
  Ubuntu Weather Developers (ubuntu-weather-dev)
Related bugs:
  Bug #1452486 in Ubuntu Weather App: "[reboot] Autopilot Testcase Needed: Pull down refresh action"
  https://bugs.launchpad.net/ubuntu-weather-app/+bug/1452486

For more details, see:
https://code.launchpad.net/~vthompson/ubuntu-weather-app/fix-1452486-pull-refresh/+merge/268027

* Create autopilot test which does a pull to refresh action
-- 
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~vthompson/ubuntu-weather-app/fix-1452486-pull-refresh into lp:ubuntu-weather-app/reboot.
=== modified file 'app/ui/HomePage.qml'
--- app/ui/HomePage.qml	2015-07-30 04:10:44 +0000
+++ app/ui/HomePage.qml	2015-08-14 03:01:06 +0000
@@ -113,6 +113,7 @@
 
         PullToRefresh {
             id: pullToRefresh
+            objectName: "pullToRefresh"
             parent: locationFlickable
             refreshing: false
             onRefresh: {

=== modified file 'debian/changelog'
--- debian/changelog	2015-08-12 00:11:38 +0000
+++ debian/changelog	2015-08-14 03:01:06 +0000
@@ -17,6 +17,7 @@
   * Create autopilot test which cancels adding a location (LP: #1452498)
   * Make the tests grab the top of the minimized tooltip to avoid resizing the
     app
+  * Create autopilot test which does a pull to refresh action (LP: #1452486)
 
   [ 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-10 03:26:46 +0000
+++ tests/autopilot/ubuntu_weather_app/__init__.py	2015-08-14 03:01:06 +0000
@@ -9,6 +9,7 @@
 from autopilot.introspection import dbus
 import logging
 from ubuntuuitoolkit import MainView, UbuntuUIToolkitCustomProxyObjectBase
+import time
 
 logger = logging.getLogger(__name__)
 
@@ -134,10 +135,29 @@
         return weekdaycolumn.wait_select_single(
             "DayDelegate", objectName="dayDelegate" + str(day))
 
+    def is_refreshing(self):
+        return self.select_single(
+            "PullToRefresh", objectName="pullToRefresh").refreshing
+
     @click_object
     def click_daydelegate(self, day_delegate):
         return day_delegate
 
+    def pull_to_refresh(self):
+        x, y, width, height = self.globalRect
+        start_x = stop_x = x + (width // 2)
+        start_y = y + (height * 0.2)
+        stop_y = y + (height * 0.8)
+
+        # Ensure refreshing is false
+
+        # Swipe down (pull) and hold
+        self.pointing_device.move(start_x, start_y)
+        self.pointing_device.press()
+        self.pointing_device.move(stop_x, stop_y)
+        time.sleep(0.5)
+        self.pointing_device.release()
+
 
 class LocationsPage(Page):
     """Autopilot helper for LocationsPage."""

=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_home_page.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_home_page.py	2015-08-09 16:28:57 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_home_page.py	2015-08-14 03:01:06 +0000
@@ -45,3 +45,20 @@
         day_delegate.height.wait_for(day_delegate.expandedHeight)
         self.assertThat(day_delegate.state, Eventually(Equals("expanded")))
         self.assertEqual(day_delegate.height, day_delegate.expandedHeight)
+
+    def test_pull_to_refresh(self):
+        """ tests swiping downward to refresh the app's data """
+
+        home_page = self.app.get_home_page()
+
+        # Ensure we are not refreshing
+        self.assertThat(home_page.is_refreshing(), Equals(False))
+
+        # Swipe down to refresh
+        home_page.pull_to_refresh()
+
+        # Ensure we are now refreshing
+        self.assertThat(home_page.is_refreshing(), Equals(False))
+
+        # Ensure that eventually we are not refreshing
+        self.assertThat(home_page.is_refreshing(), Eventually(Equals(False)))


Follow ups