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

Subscribers

People subscribed via source and target branches