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

Proposed by Victor Thompson on 2015-08-07
Status: Merged
Approved by: Andrew Hayzen on 2015-08-09
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 2015-08-07 Approve on 2015-08-09
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-08-09
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.
86. By Victor Thompson on 2015-08-08

Add missing file

Andrew Hayzen (ahayzen) wrote :

One inline comment for now..

review: Needs Fixing
87. By Victor Thompson on 2015-08-09

Move remove code to list item class

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
=== modified file 'debian/changelog'
--- debian/changelog 2015-08-07 01:22:44 +0000
+++ debian/changelog 2015-08-09 01:44:44 +0000
@@ -11,6 +11,7 @@
11 * Fix the CMakeLists.txt to include the app icon11 * Fix the CMakeLists.txt to include the app icon
12 * Rename EmptyStateComponent to HomePageEmptyStateComponent12 * Rename EmptyStateComponent to HomePageEmptyStateComponent
13 * Add a LocationsPageEmptyStateComponent13 * Add a LocationsPageEmptyStateComponent
14 * Create autopilot test which removes a single location (LP: #1452499)
1415
15 [ Andrew Hayzen ]16 [ Andrew Hayzen ]
16 * Add mocked locations for autopilot and add a test using the data17 * Add mocked locations for autopilot and add a test using the data
1718
=== modified file 'tests/autopilot/ubuntu_weather_app/__init__.py'
--- tests/autopilot/ubuntu_weather_app/__init__.py 2015-08-06 00:10:53 +0000
+++ tests/autopilot/ubuntu_weather_app/__init__.py 2015-08-09 01:44:44 +0000
@@ -152,3 +152,17 @@
152class WeatherListItem(UbuntuUIToolkitCustomProxyObjectBase):152class WeatherListItem(UbuntuUIToolkitCustomProxyObjectBase):
153 def get_name(self):153 def get_name(self):
154 return self.select_single("Label", objectName="name").text154 return self.select_single("Label", objectName="name").text
155
156 @click_object
157 def select_remove(self):
158 return self.select_single(objectName="swipeDeleteAction")
159
160 def swipe_and_select_remove(self):
161 x, y, width, height = self.globalRect
162 start_x = x + (width * 0.2)
163 stop_x = x + (width * 0.8)
164 start_y = stop_y = y + (height // 2)
165
166 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
167
168 self.select_remove()
155169
=== added file 'tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_locations_page.py 2015-08-09 01:44:44 +0000
@@ -0,0 +1,67 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2# Copyright 2013, 2014, 2015 Canonical
3#
4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published
6# by the Free Software Foundation.
7
8"""Ubuntu Weather app autopilot tests."""
9
10from __future__ import absolute_import
11
12import logging
13from autopilot.matchers import Eventually
14from testtools.matchers import Equals
15from testtools.matchers import NotEquals
16
17
18from ubuntu_weather_app.tests import UbuntuWeatherAppTestCaseWithData
19
20logger = logging.getLogger(__name__)
21
22
23class TestLocationsPage(UbuntuWeatherAppTestCaseWithData):
24
25 """ Tests for the locations page
26 setUp jumps to locations page as all tests start from here """
27
28 def setUp(self):
29 super(TestLocationsPage, self).setUp()
30
31 # Get the start count of the homepage
32 self.home_page = self.app.get_home_page()
33 self.start_count = self.home_page.get_location_count()
34
35 # Open the locations page from bottom edge
36 self.home_page.reveal_bottom_edge_page()
37
38 self.locations_page = self.app.get_locations_page()
39 self.locations_page.visible.wait_for(True)
40
41 def test_removing_location_via_list_item_action(self):
42 """ tests removing a location via the list item action """
43
44 # Get the list item of the first location
45 list_item = self.locations_page.get_location(0)
46
47 # Check that the first location is London
48 self.assertThat(list_item.get_name(), Equals("London"))
49
50 # Remove the location via the list item action
51 list_item.swipe_and_select_remove()
52
53 # Check that the location was removed
54 self.assertThat(self.home_page.get_location_count,
55 Eventually(Equals(self.start_count - 1)))
56
57 # Get the list item of the first location
58 list_item = self.locations_page.get_location(0)
59
60 # Check that the first location is not London
61 self.assertThat(list_item.get_name(), NotEquals("London"))
62
63 # Go back to the homepage
64 self.locations_page.click_back()
65
66 # Check homepage is now visible
67 self.assertThat(self.home_page.visible, Eventually(Equals(True)))

Subscribers

People subscribed via source and target branches

to all changes: