← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~ahayzen/ubuntu-weather-app/reboot-1452497-add-location-from-empty-state into lp:ubuntu-weather-app/reboot

 

Andrew Hayzen has proposed merging lp:~ahayzen/ubuntu-weather-app/reboot-1452497-add-location-from-empty-state into lp:ubuntu-weather-app/reboot.

Commit message:
* Add autopilot test which adds a location from empty state page via cached location list

Requested reviews:
  Ubuntu Weather Developers (ubuntu-weather-dev)
Related bugs:
  Bug #1452497 in Ubuntu Weather App: "[reboot] Autopilot Testcase Needed: Test adding a location"
  https://bugs.launchpad.net/ubuntu-weather-app/+bug/1452497

For more details, see:
https://code.launchpad.net/~ahayzen/ubuntu-weather-app/reboot-1452497-add-location-from-empty-state/+merge/266050

* Add autopilot test which adds a location from empty state page via cached location list

This tests that you can add a location from the empty state page via selecting the add button and then using the pre cached location list.
-- 
Your team Ubuntu Weather Developers is requested to review the proposed merge of lp:~ahayzen/ubuntu-weather-app/reboot-1452497-add-location-from-empty-state into lp:ubuntu-weather-app/reboot.
=== modified file 'app/ui/AddLocationPage.qml'
--- app/ui/AddLocationPage.qml	2015-06-28 23:37:10 +0000
+++ app/ui/AddLocationPage.qml	2015-07-27 23:14:15 +0000
@@ -206,6 +206,7 @@
 
         delegate: ListItem {
             divider.visible: false
+            objectName: "addLocation" + index
             Column {
                 anchors {
                     left: parent.left

=== modified file 'debian/changelog'
--- debian/changelog	2015-07-26 15:24:27 +0000
+++ debian/changelog	2015-07-27 23:14:15 +0000
@@ -12,6 +12,7 @@
   * Add mocked locations for autopilot and add a test using the data
   * Add setting to disable auto detecting location
   * When running under autopilot do not auto detect location
+  * Add autopilot test which adds a location from empty state page via cached location list
 
  -- Victor Thompson <victor.thompson@xxxxxxxxx>  Mon, 01 Jun 2015 20:11:23 -0500
 

=== modified file 'tests/autopilot/ubuntu_weather_app/__init__.py'
--- tests/autopilot/ubuntu_weather_app/__init__.py	2015-07-23 00:36:06 +0000
+++ tests/autopilot/ubuntu_weather_app/__init__.py	2015-07-27 23:14:15 +0000
@@ -62,6 +62,11 @@
     def __init__(self, *args):
         super(AddLocationPage, self).__init__(*args)
 
+    @click_object
+    def click_location(self, index):
+        return self.select_single("UCListItem",
+                                  objectName="addLocation" + str(index))
+
 
 class HomePage(Page):
     """Autopilot helper for HomePage."""

=== modified file 'tests/autopilot/ubuntu_weather_app/tests/test_empty_state.py'
--- tests/autopilot/ubuntu_weather_app/tests/test_empty_state.py	2015-07-18 19:08:21 +0000
+++ tests/autopilot/ubuntu_weather_app/tests/test_empty_state.py	2015-07-27 23:14:15 +0000
@@ -24,6 +24,30 @@
     def setUp(self):
         super(TestEmptyState, self).setUp()
 
+    def test_add_location(self):
+        """ tests adding a location via the button and selecting a cached
+            location """
+
+        # Get the start count of the homepage
+        home_page = self.app.get_home_page()
+        start_count = home_page.get_location_count()
+
+        # Open the locations page
+        self.app.click_add_location_button()
+
+        add_location_page = self.app.get_add_location_page()
+        add_location_page.visible.wait_for(True)
+
+        # Select the location
+        add_location_page.click_location(0)
+
+        # Check that the location was added
+        self.assertThat(home_page.get_location_count,
+                        Eventually(Equals(start_count + 1)))
+
+        # Check homepage is now visible
+        self.assertThat(home_page.visible, Eventually(Equals(True)))
+
     def test_add_location_button(self):
         """ tests that the add location page is shown after the Add Location
             button is clicked """


Follow ups