Merge lp:~vthompson/ubuntu-weather-app/fix-1452499 into lp:ubuntu-weather-app

Proposed by Victor Thompson
Status: Merged
Approved by: Andrew Hayzen
Approved revision: 87
Merged at revision: 87
Proposed branch: lp:~vthompson/ubuntu-weather-app/fix-1452499
Merge into: lp:ubuntu-weather-app
Diff against target: 105 lines (+82/-0)
3 files modified
debian/changelog (+1/-0)
tests/autopilot/ubuntu_weather_app/__init__.py (+14/-0)
tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py (+67/-0)
To merge this branch: bzr merge lp:~vthompson/ubuntu-weather-app/fix-1452499
Reviewer Review Type Date Requested Status
Andrew Hayzen Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+267428@code.launchpad.net

Commit message

* Create autopilot test which removes a single location

Description of the change

* Create autopilot test which removes a single location

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
86. By Victor Thompson

Add missing file

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

One inline comment for now..

review: Needs Fixing
Revision history for this message
Andrew Hayzen (ahayzen) wrote :
87. By Victor Thompson

Move remove code to list item class

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

LGTM, thanks for the extra change :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-08-07 01:22:44 +0000
3+++ debian/changelog 2015-08-09 01:44:44 +0000
4@@ -11,6 +11,7 @@
5 * Fix the CMakeLists.txt to include the app icon
6 * Rename EmptyStateComponent to HomePageEmptyStateComponent
7 * Add a LocationsPageEmptyStateComponent
8+ * Create autopilot test which removes a single location (LP: #1452499)
9
10 [ Andrew Hayzen ]
11 * Add mocked locations for autopilot and add a test using the data
12
13=== modified file 'tests/autopilot/ubuntu_weather_app/__init__.py'
14--- tests/autopilot/ubuntu_weather_app/__init__.py 2015-08-06 00:10:53 +0000
15+++ tests/autopilot/ubuntu_weather_app/__init__.py 2015-08-09 01:44:44 +0000
16@@ -152,3 +152,17 @@
17 class WeatherListItem(UbuntuUIToolkitCustomProxyObjectBase):
18 def get_name(self):
19 return self.select_single("Label", objectName="name").text
20+
21+ @click_object
22+ def select_remove(self):
23+ return self.select_single(objectName="swipeDeleteAction")
24+
25+ def swipe_and_select_remove(self):
26+ x, y, width, height = self.globalRect
27+ start_x = x + (width * 0.2)
28+ stop_x = x + (width * 0.8)
29+ start_y = stop_y = y + (height // 2)
30+
31+ self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
32+
33+ self.select_remove()
34
35=== added file 'tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py'
36--- tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py 1970-01-01 00:00:00 +0000
37+++ tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py 2015-08-09 01:44:44 +0000
38@@ -0,0 +1,67 @@
39+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
40+# Copyright 2013, 2014, 2015 Canonical
41+#
42+# This program is free software: you can redistribute it and/or modify it
43+# under the terms of the GNU General Public License version 3, as published
44+# by the Free Software Foundation.
45+
46+"""Ubuntu Weather app autopilot tests."""
47+
48+from __future__ import absolute_import
49+
50+import logging
51+from autopilot.matchers import Eventually
52+from testtools.matchers import Equals
53+from testtools.matchers import NotEquals
54+
55+
56+from ubuntu_weather_app.tests import UbuntuWeatherAppTestCaseWithData
57+
58+logger = logging.getLogger(__name__)
59+
60+
61+class TestLocationsPage(UbuntuWeatherAppTestCaseWithData):
62+
63+ """ Tests for the locations page
64+ setUp jumps to locations page as all tests start from here """
65+
66+ def setUp(self):
67+ super(TestLocationsPage, self).setUp()
68+
69+ # Get the start count of the homepage
70+ self.home_page = self.app.get_home_page()
71+ self.start_count = self.home_page.get_location_count()
72+
73+ # Open the locations page from bottom edge
74+ self.home_page.reveal_bottom_edge_page()
75+
76+ self.locations_page = self.app.get_locations_page()
77+ self.locations_page.visible.wait_for(True)
78+
79+ def test_removing_location_via_list_item_action(self):
80+ """ tests removing a location via the list item action """
81+
82+ # Get the list item of the first location
83+ list_item = self.locations_page.get_location(0)
84+
85+ # Check that the first location is London
86+ self.assertThat(list_item.get_name(), Equals("London"))
87+
88+ # Remove the location via the list item action
89+ list_item.swipe_and_select_remove()
90+
91+ # Check that the location was removed
92+ self.assertThat(self.home_page.get_location_count,
93+ Eventually(Equals(self.start_count - 1)))
94+
95+ # Get the list item of the first location
96+ list_item = self.locations_page.get_location(0)
97+
98+ # Check that the first location is not London
99+ self.assertThat(list_item.get_name(), NotEquals("London"))
100+
101+ # Go back to the homepage
102+ self.locations_page.click_back()
103+
104+ # Check homepage is now visible
105+ self.assertThat(self.home_page.visible, Eventually(Equals(True)))

Subscribers

People subscribed via source and target branches

to all changes: