~phablet-team/gallery-app/gallery-app-main-screen-load

« back to all changes in this revision

Viewing changes to tests/autopilot/gallery_app/emulators/picker_screen.py

  • Committer: CI bot
  • Author(s): Richard Huddie
  • Date: 2014-07-26 03:37:56 UTC
  • mfrom: (1004.2.13 gallery-app)
  • Revision ID: ps-jenkins@lists.canonical.com-20140726033756-quf0g24kkpuwmlsr
A new Page view to represent photos page in picker view with method to select the named photo.

Fix issue with existing failing picker mode tests where launch parameters were appended incorrectly. Fixes: 1336414
Approved by: Arthur Mello, Leo Arias, PS Jenkins bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
        grid_view = self.grid_view()
33
33
        return grid_view.select_many("OrganicItemInteraction")[0]
34
34
 
 
35
    def go_to_photos(self):
 
36
        """
 
37
        Switch to the photos tab on picker screen
 
38
        Return the Page object representing the photos
 
39
        """
 
40
        self.switch_to_tab('photosTab')
 
41
        return self.select_single(Page10, objectName='photosPage')
 
42
 
 
43
    def click_pick_button(self):
 
44
        """Click on the pick button"""
 
45
        self.pointing_device.click_object(self.pick_button())
 
46
 
 
47
    def select_photo(self, photo_name):
 
48
        """Go to the photos view and pick the named photo"""
 
49
        photos_page = self.go_to_photos()
 
50
        photos_page.click_named_photo(photo_name)
 
51
        self.click_pick_button()
 
52
 
 
53
 
 
54
class Page10(PickerScreen):
 
55
    """Class to represent photos page view from picker screen"""
 
56
 
35
57
    def _get_named_photo_element(self, photo_name):
36
58
        """
37
59
        Return the ShapeItem container object for the named photo.
38
60
        This object can be clicked to enable the photo to be selected.
39
61
        """
40
 
        photo_element = self.grid_view().wait_select_single('QQuickImage',
41
 
                                                       source=photo_name)
 
62
        photo_element = self.grid_view().wait_select_single(
 
63
            'QQuickImage', source=photo_name)
42
64
        return photo_element.get_parent()
43
65
 
44
 
    def select_named_photo(self, photo_name):
 
66
    def click_named_photo(self, photo_name):
45
67
        """Select the named photo from the picker view."""
46
68
        photo_element = self._get_named_photo_element(photo_name)
47
69
        self.pointing_device.click_object(photo_element)