Merge lp:~rhuddie/gallery-app/add-photos-page-object into lp:gallery-app

Proposed by Richard Huddie
Status: Merged
Merged at revision: 1023
Proposed branch: lp:~rhuddie/gallery-app/add-photos-page-object
Merge into: lp:gallery-app
Diff against target: 133 lines (+33/-17)
4 files modified
rc/qml/PickerScreen.qml (+1/-0)
tests/autopilot/gallery_app/emulators/picker_screen.py (+25/-3)
tests/autopilot/gallery_app/tests/__init__.py (+2/-2)
tests/autopilot/gallery_app/tests/test_picker_mode.py (+5/-12)
To merge this branch: bzr merge lp:~rhuddie/gallery-app/add-photos-page-object
Reviewer Review Type Date Requested Status
Leo Arias (community) code review Approve
PS Jenkins bot continuous-integration Needs Fixing
Víctor R. Ruiz (community) Approve
Arthur Mello Pending
Review via email: mp+225962@code.launchpad.net

Commit message

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.

Description of the change

A new Page view to represent photos page in picker view with method to select the named photo.

PickerScreen go_to_photos() method will switch the picker screen to photos view and return the photos Page view.

test_pick_named_photo() re-worked to use the new page object.

Also fix issue with existing failing picker mode tests where launch parameters were appended incorrectly.

To post a comment you must log in.
Revision history for this message
Víctor R. Ruiz (vrruiz) wrote :

Looks good to me.

review: Approve
Revision history for this message
Leo Arias (elopio) wrote :

It's great, thanks. You even fixed a pep8 error, that's bonus points :)
But can we reenable the test?

Revision history for this message
Leo Arias (elopio) wrote :

Richard, please remove the skip. I will kick Jenkins at least three times to see if it's stable enough.

review: Needs Fixing
Revision history for this message
Richard Huddie (rhuddie) wrote :

I left it skipped because there is a separate branch from Arthur for re-enabling the test. But I will re-enable it here so we can get test results from Jenkins. I ran the test locally and it was fine.

1008. By Richard Huddie

re-enable pick named photo test

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Leo Arias (elopio) wrote :

Right, Arthur told me about it yesterday, but said it was failing. It seems easier to get it back to green from this branch. I'll take a look at the results.

Revision history for this message
Leo Arias (elopio) wrote :

With the new release of the toolkit, the page now has a version so autopilot sees it as Page10.

You should also set an objectName to that page:

http://paste.ubuntu.com/7771555/

review: Needs Fixing
1009. By Richard Huddie

updates for photosPage and use wait_select_single for getting PickerScreen

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1010. By Richard Huddie

extend wait period for picker view

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1011. By Richard Huddie

add pick-mode parameter check

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1012. By Richard Huddie

reset self.ARGS before each test

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
1013. By Richard Huddie

Enable disabled tests

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1014. By Richard Huddie

Update to use focusedApplicationId

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1015. By Richard Huddie

picker state is not saved

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1016. By Richard Huddie

merge from trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Richard Huddie (rhuddie) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list
No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
Yes - mako

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/gallery-app) on device or emulator?
Yes - mako

If you changed the UI, was the change specified/approved by design?
No UI changes. - Only app change is to add objectName property to picker screen photos tab. The rest is autopilot test changes.

If you changed the packaging (debian), did you subscribe a core-dev to this MP?
No packaging changes.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Leo Arias (elopio) :
review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'rc/qml/PickerScreen.qml'
2--- rc/qml/PickerScreen.qml 2013-12-10 09:40:52 +0000
3+++ rc/qml/PickerScreen.qml 2014-07-15 11:54:55 +0000
4@@ -75,6 +75,7 @@
5 objectName: "photosTab"
6 page: Page {
7 id: photosOverview
8+ objectName: "photosPage"
9
10 tools: pickTools
11
12
13=== modified file 'tests/autopilot/gallery_app/emulators/picker_screen.py'
14--- tests/autopilot/gallery_app/emulators/picker_screen.py 2014-05-02 17:31:46 +0000
15+++ tests/autopilot/gallery_app/emulators/picker_screen.py 2014-07-15 11:54:55 +0000
16@@ -32,16 +32,38 @@
17 grid_view = self.grid_view()
18 return grid_view.select_many("OrganicItemInteraction")[0]
19
20+ def go_to_photos(self):
21+ """
22+ Switch to the photos tab on picker screen
23+ Return the Page object representing the photos
24+ """
25+ self.switch_to_tab('photosTab')
26+ return self.select_single(Page10, objectName='photosPage')
27+
28+ def click_pick_button(self):
29+ """Click on the pick button"""
30+ self.pointing_device.click_object(self.pick_button())
31+
32+ def select_photo(self, photo_name):
33+ """Go to the photos view and pick the named photo"""
34+ photos_page = self.go_to_photos()
35+ photos_page.click_named_photo(photo_name)
36+ self.click_pick_button()
37+
38+
39+class Page10(PickerScreen):
40+ """Class to represent photos page view from picker screen"""
41+
42 def _get_named_photo_element(self, photo_name):
43 """
44 Return the ShapeItem container object for the named photo.
45 This object can be clicked to enable the photo to be selected.
46 """
47- photo_element = self.grid_view().wait_select_single('QQuickImage',
48- source=photo_name)
49+ photo_element = self.grid_view().wait_select_single(
50+ 'QQuickImage', source=photo_name)
51 return photo_element.get_parent()
52
53- def select_named_photo(self, photo_name):
54+ def click_named_photo(self, photo_name):
55 """Select the named photo from the picker view."""
56 photo_element = self._get_named_photo_element(photo_name)
57 self.pointing_device.click_object(photo_element)
58
59=== modified file 'tests/autopilot/gallery_app/tests/__init__.py'
60--- tests/autopilot/gallery_app/tests/__init__.py 2014-06-10 18:54:21 +0000
61+++ tests/autopilot/gallery_app/tests/__init__.py 2014-07-15 11:54:55 +0000
62@@ -291,10 +291,10 @@
63 # details.
64 from unity8 import process_helpers
65 pid = process_helpers._get_unity_pid()
66- unity8 = get_proxy_object_for_existing_process(pid)
67+ unity8 = get_proxy_object_for_existing_process(pid=pid)
68 shell = unity8.select_single("Shell")
69 shell.slots.showHome()
70- self.assertThat(shell.currentFocusedAppId,
71+ self.assertThat(shell.focusedApplicationId,
72 Eventually(NotEquals("gallery-app")))
73 self.app.process.send_signal(signal.SIGTERM)
74
75
76=== modified file 'tests/autopilot/gallery_app/tests/test_picker_mode.py'
77--- tests/autopilot/gallery_app/tests/test_picker_mode.py 2014-05-21 16:02:19 +0000
78+++ tests/autopilot/gallery_app/tests/test_picker_mode.py 2014-07-15 11:54:55 +0000
79@@ -15,16 +15,15 @@
80 from gallery_app.tests import GalleryTestCase
81 import unittest
82
83-from unittest import skip
84
85 class TestPickerMode(GalleryTestCase):
86
87 @property
88 def picker_view(self):
89- return self.app.select_single(PickerScreen)
90+ return self.app.wait_select_single(PickerScreen)
91
92 def setUp(self):
93- self.ARGS.append("--pick-mode")
94+ self.ARGS = ['--pick-mode']
95 super(TestPickerMode, self).setUp()
96
97 def select_first_event_media(self):
98@@ -35,8 +34,6 @@
99 first_media = self.picker_view.first_media_in_events_view()
100 self.click_item(first_media)
101
102- @unittest.skip("Temporarily disable as it fails in some cases, "
103- "supposedly due to problems with the infrastructure")
104 def test_pick_first_photo(self):
105 """Check if the button enabled state follows the selection"""
106 pick_button = self.picker_view.pick_button()
107@@ -65,23 +62,19 @@
108 Eventually(Equals(False))
109 )
110
111- @skip("Temporarily disable as it fails in some cases")
112 def test_pick_named_photo(self):
113 """Select a named photo and press Pick button."""
114- self.picker_view.switch_to_tab('photosTab')
115+ photos_page = self.picker_view.go_to_photos()
116 pick_button = self.picker_view.pick_button()
117 self.assertFalse(pick_button.enabled)
118
119 # create the image location path based on sample location
120 image_path = 'image://thumbnailer/{}/sample02.jpg'.format(
121 self.sample_destination_dir)
122- self.picker_view.select_named_photo(image_path)
123-
124+ photos_page.click_named_photo(image_path)
125 self.assertTrue(pick_button.enabled)
126- self.click_item(pick_button)
127+ self.picker_view.click_pick_button()
128
129- @unittest.skip("Temporarily disable as it fails in some cases, "
130- "supposedly due to problems with the infrastructure")
131 def test_selection_synchronisation(self):
132 """Checks if the selection is the same for both views"""
133 first_events_media = self.picker_view.first_media_in_events_view()

Subscribers

People subscribed via source and target branches