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

Proposed by Victor Thompson on 2015-08-14
Status: Needs review
Proposed branch: lp:~vthompson/ubuntu-weather-app/fix-1452486-pull-refresh
Merge into: lp:ubuntu-weather-app
Diff against target: 83 lines (+41/-0)
4 files modified
app/ui/LocationPane.qml (+1/-0)
debian/changelog (+1/-0)
tests/autopilot/ubuntu_weather_app/__init__.py (+22/-0)
tests/autopilot/ubuntu_weather_app/tests/test_home_page.py (+17/-0)
To merge this branch: bzr merge lp:~vthompson/ubuntu-weather-app/fix-1452486-pull-refresh
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Needs Fixing on 2015-10-27
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-10-18
Andrew Hayzen 2015-08-14 Needs Fixing on 2015-10-15
Review via email: mp+268027@code.launchpad.net

Commit message

* Create autopilot test which does a pull to refresh action

Description of the change

* Create autopilot test which does a pull to refresh action

To post a comment you must log in.
95. By Victor Thompson on 2015-08-14

Update commentary

Andrew Hayzen (ahayzen) wrote :

Some inline comment questions..

review: Needs Information
Victor Thompson (vthompson) wrote :

I'll need to update this to release when refreshing is true. It'll need to be done that way to ensure the flag changes from False to True.

96. By Victor Thompson on 2015-08-19

Patch up test

97. By Victor Thompson on 2015-08-19

Merge and resolve

98. By Victor Thompson on 2015-08-19

Update commentary

Andrew Hayzen (ahayzen) wrote :

This fails for me, and some inline comments.

Traceback (most recent call last):
  File "/tmp/fix-1452486-pull-refresh/tests/autopilot/ubuntu_weather_app/tests/test_home_page.py", line 61, in test_pull_to_refresh
    self.assertThat(home_page.refreshing(), Eventually(Equals(True)))
  File "/usr/lib/python3/dist-packages/testtools/testcase.py", line 423, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: After 10.0 seconds test on PullToRefresh.refreshing failed: True != dbus.Boolean(False, variant_level=1)

Ran 1 test in 17.798s
FAILED (failures=1)

review: Needs Fixing
99. By Victor Thompson on 2015-08-24

Update matcher.

Victor Thompson (vthompson) wrote :

I've updated the matcher--hopefully that's what was causing the failure for you. It's working for me.

100. By Victor Thompson on 2015-08-29

Move refreshing check

101. By Victor Thompson on 2015-08-29

Merge of trunk and update test

102. By Victor Thompson on 2015-08-30

Update pep8

103. By Victor Thompson on 2015-09-10

Merge and resolve conflicts.

104. By Victor Thompson on 2015-09-25

Merge and resolve conflicts

Andrew Hayzen (ahayzen) wrote :

Once [0] lands and you merge with it, the LocationPane will be using the correct autopilot helper which then means you'll be able to use the pullToRefresh helper [1] as LocationPane will have the QQuickFlickable properties.

0 - https://code.launchpad.net/~ahayzen/ubuntu-weather-app/fix-1496422-1478255-today-extra-info/+merge/272790
1 - http://people.canonical.com/~nskaggs/autopilot-sdk-helpers.html#ubuntuuitoolkit.QQuickFlickable.pull_to_refresh

review: Needs Fixing
105. By Victor Thompson on 2015-10-16

Merge trunk

106. By Victor Thompson on 2015-10-18

Adjust the test to occur within the LocationPane

107. By Victor Thompson on 2015-10-18

Merge of trunk and resolve conflict

review: Needs Fixing (continuous-integration)

Unmerged revisions

107. By Victor Thompson on 2015-10-18

Merge of trunk and resolve conflict

106. By Victor Thompson on 2015-10-18

Adjust the test to occur within the LocationPane

105. By Victor Thompson on 2015-10-16

Merge trunk

104. By Victor Thompson on 2015-09-25

Merge and resolve conflicts

103. By Victor Thompson on 2015-09-10

Merge and resolve conflicts.

102. By Victor Thompson on 2015-08-30

Update pep8

101. By Victor Thompson on 2015-08-29

Merge of trunk and update test

100. By Victor Thompson on 2015-08-29

Move refreshing check

99. By Victor Thompson on 2015-08-24

Update matcher.

98. By Victor Thompson on 2015-08-19

Update commentary

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/ui/LocationPane.qml'
2--- app/ui/LocationPane.qml 2015-10-15 14:15:10 +0000
3+++ app/ui/LocationPane.qml 2015-10-18 15:24:09 +0000
4@@ -130,6 +130,7 @@
5
6 PullToRefresh {
7 id: pullToRefresh
8+ objectName: "pullToRefresh"
9 refreshing: false
10 onRefresh: {
11 locationPages.loaded = false
12
13=== modified file 'debian/changelog'
14--- debian/changelog 2015-10-16 00:12:57 +0000
15+++ debian/changelog 2015-10-18 15:24:09 +0000
16@@ -28,6 +28,7 @@
17 * Make sure the text elides on the LocationsPage and the AddLocationPage. (LP: #1469460)
18 * Make the first column of the day delegate extra info wider to accommodate other
19 languages.
20+ * Create autopilot test which does a pull to refresh action (LP: #1452486)
21
22 [ Andrew Hayzen ]
23 * Add mocked locations for autopilot and add a test using the data
24
25=== modified file 'tests/autopilot/ubuntu_weather_app/__init__.py'
26--- tests/autopilot/ubuntu_weather_app/__init__.py 2015-10-15 14:12:37 +0000
27+++ tests/autopilot/ubuntu_weather_app/__init__.py 2015-10-18 15:24:09 +0000
28@@ -228,6 +228,28 @@
29 return self.select_single(
30 "AbstractButton", objectName="settingsButton")
31
32+ def pull_to_refresh_data(self):
33+ x, y, width, height = self.globalRect
34+ start_x = stop_x = x + (width // 2)
35+ start_y = y + (height * 0.2)
36+ stop_y = y + (height * 0.8)
37+
38+ # Swipe down (pull), hold, and release
39+ self.pointing_device.move(start_x, start_y)
40+ self.pointing_device.press()
41+ self.pointing_device.move(stop_x, stop_y)
42+ self.release_to_refresh().wait_for(True)
43+ self.pointing_device.release()
44+ self.refreshing().wait_for(True)
45+
46+ def refreshing(self):
47+ return self.wait_select_single(
48+ "PullToRefresh", objectName="pullToRefresh").refreshing
49+
50+ def release_to_refresh(self):
51+ return self.wait_select_single(
52+ "PullToRefresh", objectName="pullToRefresh").releaseToRefresh
53+
54
55 class LocationsPage(Page):
56 """Autopilot helper for LocationsPage."""
57
58=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_home_page.py'
59--- tests/autopilot/ubuntu_weather_app/tests/test_home_page.py 2015-09-29 15:21:55 +0000
60+++ tests/autopilot/ubuntu_weather_app/tests/test_home_page.py 2015-10-18 15:24:09 +0000
61@@ -57,6 +57,23 @@
62 self.assertThat(day_delegate.state, Eventually(Equals("expanded")))
63 self.assertEqual(day_delegate.height, day_delegate.expandedHeight)
64
65+ def test_pull_to_refresh(self):
66+ """ tests swiping downward to refresh the app's data """
67+
68+ location_pane = self.home_page.get_selected_location_pane()
69+
70+ # Ensure we are not refreshing
71+ self.assertThat(location_pane.refreshing(), Equals(False))
72+
73+ # Swipe down to refresh
74+ location_pane.pull_to_refresh_data()
75+
76+ # Re-get home page as change in loaders changes tree
77+ location_pane = self.home_page.get_selected_location_pane()
78+
79+ # Ensure that eventually we are not refreshing
80+ self.assertThat(location_pane.refreshing, Eventually(Equals(False)))
81+
82 def test_show_today_details(self):
83 """tests clicking on the today info to expand and contract it"""
84

Subscribers

People subscribed via source and target branches

to all changes: