← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~canonical-platform-qa/ubuntu-rssreader-app/fix-bug-1456788 into lp:ubuntu-rssreader-app

 

Sergio Cazzolato has proposed merging lp:~canonical-platform-qa/ubuntu-rssreader-app/fix-bug-1456788 into lp:ubuntu-rssreader-app.

Commit message:
In this fix the class of the popover element is modified and some small refactors to keeps the tests that are failing more readable are implemented

Requested reviews:
  Ubuntu RSS Feed Reader Developers (ubuntu-rssreader-dev)
Related bugs:
  Bug #1456788 in Ubuntu RSS Feed Reader App: "test test_switch_to_list_view_mode failing in ci"
  https://bugs.launchpad.net/ubuntu-rssreader-app/+bug/1456788

For more details, see:
https://code.launchpad.net/~canonical-platform-qa/ubuntu-rssreader-app/fix-bug-1456788/+merge/259542
-- 
Your team Ubuntu RSS Feed Reader Developers is requested to review the proposed merge of lp:~canonical-platform-qa/ubuntu-rssreader-app/fix-bug-1456788 into lp:ubuntu-rssreader-app.
=== modified file 'tests/autopilot/shorts_app/__init__.py'
--- tests/autopilot/shorts_app/__init__.py	2015-01-29 21:26:34 +0000
+++ tests/autopilot/shorts_app/__init__.py	2015-05-19 20:37:18 +0000
@@ -56,21 +56,10 @@
             TopicManagement, objectName='topicmanagement')
 
     def _click_add_reads(self):
-        # does not work using workaround
-        # header = self.get_header()
-        # header.click_action_button('Add feeds')
-
-        # -------------------------------------------------------------------
-        # this will have to bee removed after fixing above header issue
-        actionsButton = self.wait_select_single(
-            "PageHeadButton", objectName='actions_overflow_button')
-        self.pointing_device.click_object(actionsButton)
-        popover = self.wait_select_single(
-            "StyledItem", objectName="popover_foreground")
-        addReadsAction = popover.wait_select_single(
+        popover = self._open_popover()
+        add_reads_action = popover.wait_select_single(
             "AbstractButton", text="Add feeds")
-        self.pointing_device.click_object(addReadsAction)
-        # -----------------------------------------------------------------
+        self.pointing_device.click_object(add_reads_action)
 
     def get_selected_tab_title(self):
         tabs = self.get_tabs()
@@ -212,8 +201,8 @@
         self.pointing_device.click_object(feed_in_feeedlist)
 
     def _get_feed_in_feedlist(self, topic, feed):
-        itemList = self._get_feedlist(topic)
-        for item in itemList:
+        item_list = self._get_feedlist(topic)
+        for item in item_list:
             label = item.select_single("Label", objectName="labelFeedname")
             if label.text == feed:
                 return item
@@ -248,68 +237,39 @@
                          if you are not in list mode it equals "isNotListMode"
 
         """
-
-        # does not work using workaround
-        """
-        header = self.get_header()
-        if mode == "isListMode":
-            header.click_action_button("Grid View")
-        else:
-            header.click_action_button("List view")
-        """
-        # -------------------------------------------------------------------
-        # this will have to bee removed after fixing above header issue
-        actionsButton = self.wait_select_single(
-            "PageHeadButton", objectName='actions_overflow_button')
-        self.pointing_device.click_object(actionsButton)
-        popover = self.wait_select_single(
-            "StyledItem", objectName="popover_foreground")
-        if mode == "isListMode":
-            addReadsAction = popover.wait_select_single(
+        popover = self._open_popover()
+        if mode == "isListMode":
+            add_rads_action = popover.wait_select_single(
                 "AbstractButton", text="Grid View")
         else:
-            addReadsAction = popover.wait_select_single(
+            add_rads_action = popover.wait_select_single(
                 "AbstractButton", text="List view")
 
-        self.pointing_device.click_object(addReadsAction)
-        # -----------------------------------------------------------------
+        self.pointing_device.click_object(add_rads_action)
 
     @autopilot_logging.log_action(logger.info)
     def click_edit_topics_in_header(self):
-        """
-        does not work using workaround
-        header = self.get_header()
-        header.click_action_button('editTopicsAction')
-        """
-        # -------------------------------------------------------------------
-        # this will have to bee removed after fixing above header issue
-        # reported bug #1412967 -- 20/01/2015
-        actionsButton = self.wait_select_single(
-            "PageHeadButton", objectName='actions_overflow_button')
-        self.pointing_device.click_object(actionsButton)
-        popover = self.wait_select_single(
-            "StyledItem", objectName="popover_foreground")
-        addReadsAction = popover.wait_select_single(
+        popover = self._open_popover()
+        add_reads_action = popover.wait_select_single(
             "AbstractButton", text="Edit topics")
 
-        self.pointing_device.click_object(addReadsAction)
-        # -----------------------------------------------------------------
+        self.pointing_device.click_object(add_reads_action)
 
     @autopilot_logging.log_action(logger.info)
     def click_header_done_button(self):
-        """
-        does not work using workaround
-
-        header = self.get_header()
-        header.click_action_button("doneButton")
-
-        """
-        # -------------------------------------------------------------------
-        # this will have to bee removed after fixing above header issue
-        # reported bug #1412967 -- 20/01/2015
-        actionsButton = self.wait_select_single(
+        actions_button = self.wait_select_single(
             "PageHeadButton", objectName='doneButton_header_button')
-        self.pointing_device.click_object(actionsButton)
+        self.pointing_device.click_object(actions_button)
+
+    @autopilot_logging.log_action(logger.info)
+    def _open_popover(self):
+        """Opens the popover and returns the object"""
+
+        actions_button = self.wait_select_single(
+            "PageHeadButton", objectName='actions_overflow_button')
+        self.pointing_device.click_object(actions_button)
+        return self.wait_select_single(
+            "UCStyledItemBase", objectName="popover_foreground")
 
 
 class Page(toolkit_emulators.MainView):


References