← Back to team overview

ubuntu-phone team mailing list archive

Re: Autopilot: Get dynamic elements contained within a ListView

 

Hola,

On Thu, Jan 23, 2014 at 11:40 AM, Iain Lane <laney@xxxxxxxxxx> wrote:

> Sorry for the annoying questions, but I have another one now


Believe it or not, there are some of us who enjoy writing autopilot tests :)
You are not annoying.


> --- I can
> expand the ItemSelector from AP (modulo bug #1271969 which I worked
> around by calculating the coordinates), but then I don't know how to get
> at the items in it. The introspection tree is
> <http://paste.ubuntu.com/6804028/> (warning: huge) -- I want to click the
> "By size" label. Trying item_selector.select_single(text="By size")
> doesn't find it. Is it because it's down a few levels of the tree?


It shouldn't be. But it's really hard to look at the tree. Do you have some
code I can try? Using autopilot vis we can figure it out better. I'll be on
IRC for ~30 minutes before going to lunch.


> The
> code is "ItemSelector { ... model: ["By name", "By size"] }" which I don't
> know how to attach ObjectNames to.
>

You will need to make your model more verbose.
Take a look here:
http://bazaar.launchpad.net/~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk/view/head:/tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py#L738
This is really important, because if you rely on the text, you will end up
changing the tests more often than you should.

pura vida.

References