ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #02312
[Merge] lp:~vthompson/ubuntu-weather-app/reboot-add-pull-to-refresh-test into lp:ubuntu-weather-app/reboot
Victor Thompson has proposed merging lp:~vthompson/ubuntu-weather-app/reboot-add-pull-to-refresh-test into lp:ubuntu-weather-app/reboot with lp:~ahayzen/ubuntu-weather-app/reboot-add-base-for-autopilot-tests as a prerequisite.
Commit message:
* Add a pull to refresh test.
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/reboot-add-pull-to-refresh-test/+merge/259886
* Add a pull to refresh test.
--
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~vthompson/ubuntu-weather-app/reboot-add-pull-to-refresh-test into lp:ubuntu-weather-app/reboot.
=== modified file 'app/ui/HomePage.qml'
--- app/ui/HomePage.qml 2015-05-22 03:55:03 +0000
+++ app/ui/HomePage.qml 2015-05-22 03:55:03 +0000
@@ -105,6 +105,7 @@
PullToRefresh {
id: pullToRefresh
+ objectName: "pullToRefresh"
parent: locationFlickable
refreshing: false
onRefresh: {
=== modified file 'tests/autopilot/ubuntu_weather_app/__init__.py'
--- tests/autopilot/ubuntu_weather_app/__init__.py 2015-05-22 03:55:03 +0000
+++ tests/autopilot/ubuntu_weather_app/__init__.py 2015-05-22 03:55:03 +0000
@@ -53,6 +53,17 @@
def __init__(self, *args):
super(HomePage, self).__init__(*args)
+ def get_pull_to_refresh(self):
+ return self.wait_select_single("*", objectName="pullToRefresh")
+
+ def pull_to_refresh(self):
+ x, y, width, height = self.globalRect
+ start_y = y + (height * 0.3)
+ stop_y = y + (height * 0.8)
+ start_x = stop_x = width // 2
+
+ self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
+
class MainView(MainView):
"""Autopilot custom proxy object for the MainView."""
=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_weather.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_weather.py 2015-05-22 03:55:03 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_weather.py 2015-05-22 03:55:03 +0000
@@ -30,3 +30,12 @@
home_page = self.app.get_home_page()
self.assertThat(home_page.visible, Eventually(Equals(True)))
+
+ def test_pull_to_refresh(self):
+ """ tests that the pull to refresh action works correctly"""
+
+ home_page = self.app.get_home_page()
+ pull_to_refresh = home_page.get_pull_to_refresh()
+ self.assertThat(pull_to_refresh.refreshing, Equals(False))
+ home_page.pull_to_refresh()
+ self.assertThat(pull_to_refresh.refreshing, Eventually(Equals(False)))