Merge lp:~elopio/ubuntu-ui-toolkit/fix1314390-click_element_on_unity into lp:ubuntu-ui-toolkit/staging

Proposed by Leo Arias
Status: Merged
Approved by: Tim Peeters
Approved revision: 1032
Merged at revision: 1057
Proposed branch: lp:~elopio/ubuntu-ui-toolkit/fix1314390-click_element_on_unity
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 97 lines (+73/-9)
2 files modified
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py (+13/-9)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py (+60/-0)
To merge this branch: bzr merge lp:~elopio/ubuntu-ui-toolkit/fix1314390-click_element_on_unity
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Tim Peeters Approve
Cris Dywan Needs Information
Allan LeSage (community) Approve
Review via email: mp+217693@code.launchpad.net

This proposal supersedes a proposal from 2014-04-29.

Commit message

On the autopilot helpers, find the top container starting from the flickable.

To post a comment you must log in.
Revision history for this message
Allan LeSage (allanlesage) wrote :

Not sure I understand the error condition: it seems like it should mean that you're already at the topmost container (which wouldn't necessarily be an error?), however we'd want to validate that the parent has a globalRect in this case, no?

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

Do you mean this error condition?

25 + if top_container is None:
26 + raise _common.ToolkitException(
27 + "Couldn't find the top-most container.")

It will just happen if no parent has a global rect. Which is an unlikely case, but could happen.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:1028
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/133/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/506
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5131
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/133
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/133
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/133/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/133
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/449
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4772
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4772/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6530
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4411
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5333
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5333/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/133/rebuild

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

FAILED: Continuous integration, rev:1029
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/134/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/510
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5135
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/134
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/134
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/134/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/134
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/451
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4776
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4776/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6535
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4413
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5338
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5338/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/134/rebuild

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

PASSED: Continuous integration, rev:1030
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/136/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/515
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5141
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/136
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/136
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/136/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/136
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/455
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4783
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4783/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6550
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4418
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5344
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5344/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/136/rebuild

review: Approve (continuous-integration)
Revision history for this message
Allan LeSage (allanlesage) wrote :

Thank you for answering my question elopio.

review: Approve
Revision history for this message
Cris Dywan (kalikiana) wrote :

test_get_unity_top_container seems to mock what the API expects but could we have a real QML snippet here that demonstrates the issue?

review: Needs Information
Revision history for this message
Cris Dywan (kalikiana) wrote :

See lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/engineLauncher for a way to reproduce the difference in the component hierarchy.

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

kalikiana, we can merge this and once your branch is ready to be used, I'll update the test.
I say it mainly because this branch is a prerequisite of a branch that's a prerequisite for your tumb branch. For my side, I wouldn't mind waiting.

Revision history for this message
Tim Peeters (tpeeters) wrote :

I have a branch depending on this one that adds automatic showing of the header in AP tests when needed which is currently blocking the telephony apps, so I would not mind if this one is merged soon.

Revision history for this message
Tim Peeters (tpeeters) wrote :

no pressure ;)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

Thanks for adding the FIXME.

CI failed on the old 1033 where the repo was messed up, but 1030 was good so the new 1031 should pass soon also.

There are no merge conflicts with staging.

I'm approving so that we can get all the depending branches in, but let's fix the FIXME as soon as possible.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-autolanding/84/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/259
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/234
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-autolanding/28
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-autolanding/28
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-autolanding/28/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-autolanding/28
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/749
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/529
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/529/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/7234
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/213
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/291
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/291/artifact/work/output/*zip*/output.zip

review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

_StringException: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py", line 52, in test_get_unity_top_container
    flickable = ubuntuuitoolkit.Flickable(dummy_state, 'dummy', 'dummy')
  File "/usr/lib/python3/dist-packages/ubuntuuitoolkit/_custom_proxy_objects/_common.py", line 68, in __init__
    super(UbuntuUIToolkitCustomProxyObjectBase, self).__init__(*args)
  File "/usr/lib/python3/dist-packages/autopilot/introspection/dbus.py", line 86, in __init__
    self.id
  File "/usr/lib/python3/dist-packages/autopilot/introspection/_xpathselect.py", line 182, in new_from_path_and_id
    % type(path).__name__
TypeError: 'path' attribute must be bytes, not 'str'

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

It would have been so easy to get this merged without tests ;)

It should work now. I hope.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:1032
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/240/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/276
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/250
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/72
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/72
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/72/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/72
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/762
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/560
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/560/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/7263
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/226
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/314
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/314/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/240/rebuild

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

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-autolanding/85/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/277
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/251
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-autolanding/29
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-autolanding/29
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-autolanding/29/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-autolanding/29
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/765
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/562
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/562/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/7267
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/227
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/315
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/315/artifact/work/output/*zip*/output.zip

review: Needs Fixing (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

autolanding failed because of jenkins breakage? happroving again.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py'
2--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-04-16 21:13:39 +0000
3+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-05-16 08:50:05 +0000
4@@ -68,15 +68,19 @@
5 def _get_top_container(self):
6 """Return the top-most container with a globalRect."""
7 root = self.get_root_instance()
8- containers = [root]
9- while len(containers) == 1:
10- try:
11- containers[0].globalRect
12- return containers[0]
13- except AttributeError:
14- containers = containers[0].get_children()
15-
16- raise _common.ToolkitException("Couldn't find the top-most container.")
17+ parent = self.get_parent()
18+ top_container = None
19+ while parent.id != root.id:
20+ if hasattr(parent, 'globalRect'):
21+ top_container = parent
22+
23+ parent = parent.get_parent()
24+
25+ if top_container is None:
26+ raise _common.ToolkitException(
27+ "Couldn't find the top-most container.")
28+ else:
29+ return top_container
30
31 def _is_child_visible(self, child, containers):
32 """Check if the center of the child is visible.
33
34=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py'
35--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 1970-01-01 00:00:00 +0000
36+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-05-16 08:50:05 +0000
37@@ -0,0 +1,60 @@
38+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
39+#
40+# Copyright (C) 2014 Canonical Ltd.
41+#
42+# This program is free software; you can redistribute it and/or modify
43+# it under the terms of the GNU Lesser General Public License as published by
44+# the Free Software Foundation; version 3.
45+#
46+# This program is distributed in the hope that it will be useful,
47+# but WITHOUT ANY WARRANTY; without even the implied warranty of
48+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49+# GNU Lesser General Public License for more details.
50+#
51+# You should have received a copy of the GNU Lesser General Public License
52+# along with this program. If not, see <http://www.gnu.org/licenses/>.
53+
54+
55+import testtools
56+
57+import ubuntuuitoolkit
58+
59+
60+class FlickableTestCase(testtools.TestCase):
61+
62+ def test_get_unity_top_container(self):
63+ """Test that we can get the top cointainer in Unity."""
64+ # This tests bug http://pad.lv/1314390
65+ # On Unity, the top container is not the first child as it is in all
66+ # the apps that have a MainView. This makes the first implementation of
67+ # _get_top_container fail. Instead of going from the top looking for
68+ # a container, we should start from the flickable until we find the
69+ # top-most container.
70+ # FIXME we are faking the QML tree because we have no way to launch
71+ # the app with a tree like the one in Unity8. kalikiana has a branch
72+ # with an alternate launcher that will let us clean this test.
73+ # --elopio - 2014-05-15.
74+ RootClass = type('obj', (object,), {'id': 'root'})
75+ mock_root_instance = RootClass()
76+ # We consider a container is an object with a globalRect.
77+ MockNonContainerClass = type('obj', (object,), {})
78+ mock_non_container = MockNonContainerClass()
79+ MockContainerClass = type(
80+ 'obj', (object,), {'id': 'container', 'globalRect': 'dummy'})
81+ mock_container = MockContainerClass()
82+ mock_container.get_parent = lambda: mock_root_instance
83+
84+ # The root instance has two children. This exposes the bug.
85+ mock_root_instance.get_children = lambda: [
86+ mock_non_container, mock_container]
87+
88+ dummy_state = {'id': '10'}
89+ flickable = ubuntuuitoolkit.Flickable(
90+ dummy_state, '/dummy'.encode(), 'dummy')
91+
92+ flickable.get_root_instance = lambda: mock_root_instance
93+ # The top container of the flickable is its immediate parent.
94+ flickable.get_parent = lambda: mock_container
95+
96+ top_container = flickable._get_top_container()
97+ self.assertEqual(top_container, mock_container)

Subscribers

People subscribed via source and target branches