How to drag and drop selected items in a list to an item in another list using Lebowski?

12 views
Skip to first unread message

Manas

unread,
Dec 16, 2010, 1:19:26 AM12/16/10
to lebowskifw
Hi,
I want to write a test script to drag selected items from a list
1 and drop them to an item in list 2.
I have tried many ways but I have been only successful in
selecting the required items. The drag and drop is just not working.

Example:-
@list1.item_views[3].select
@list1.item_views[4].select_add
@list1.item_views[4].mouse_down

Now I am not sure what to do if I want to drag and drop the
selection to some item in list2.

Does anybody have some idea on how to do this?

Thanks,
Manas

Sam Fentress

unread,
Dec 16, 2010, 7:43:39 AM12/16/10
to lebowskifw
Hi Manas,

If you're dragging your view to another view, you can use Selenium's
(or is it Capybara's?) drag_to command:

@list1.item_views[3].drag_to @list2View

you can also include an offset

@list1.item_views[3].drag_to @list2View, 20, 20

I'm pretty sure that you can specify an exact x and y coordinate as
well (drag_to x, y). However, I've searched around for "drag_to" and I
have no idea where I found the original reference. It's can be hard to
find documentation for the complete set of commands that you can use.

Sam

MikeC

unread,
Dec 16, 2010, 11:04:24 AM12/16/10
to lebowskifw
Although you can use the drag_to command, the better command to use is
drag_on_to:

@list1.item_views[3].select
@list2.item_views[4].select_add
@list1.item_views[4].drag_on_to @list2

If you'd like to see examples of how to drag and drop list items,
please be sure to see the Lebowski example code. Specially, refer to
the foundation demo code here:

https://github.com/FrozenCanuck/Lebowski/tree/master/examples/foundation/spec/demos

To run the examples, go to examples/foundation/app and run sc-server.
If you open up Firefox (or whatever browser), navigate to
http://localhost:4020/sc_controls. The SC controls app shows all the
controls Lebowski currently has proxies for. To run Lebowski code
against the app, go to examples/foundation/spec/demos/ and run the
following:

lebowski-spec run_specs.rb

I'm currently working on fleshing out all the spec files, but for now
you can see specs for things like the SC.ListView, SC.PalettePane,
SC.WebView, and so on. The following spec demonstrates how to drag one
or more list items on to another list:

demos/specs/views/list_view/drag_selected_items_to_another_list.rb

Mike

MikeC

unread,
Dec 16, 2010, 11:09:13 AM12/16/10
to lebowskifw
Also please note that to run the latest example demo code, you'll need
to have the Lebowski v0.3.0 gem installed.

Mike

On Dec 16, 11:04 am, MikeC <michael.lee.co...@gmail.com> wrote:
> Although you can use the drag_to command, the better command to use is
> drag_on_to:
>
> @list1.item_views[3].select
> @list2.item_views[4].select_add
> @list1.item_views[4].drag_on_to @list2
>
> If you'd like to see examples of how to drag and drop list items,
> please be sure to see the Lebowski example code. Specially, refer to
> the foundation demo code here:
>
> https://github.com/FrozenCanuck/Lebowski/tree/master/examples/foundat...
>
> To run the examples, go to examples/foundation/app and run sc-server.
> If you open up Firefox (or whatever browser), navigate tohttp://localhost:4020/sc_controls. The SC controls app shows all the

Manas

unread,
Dec 17, 2010, 2:02:09 AM12/17/10
to lebowskifw
Hi,

Using the tips provided, my test script is working now. The replies
were very helpful. Thanks Sam and Mike!!

Thanks,
Manas
Reply all
Reply to author
Forward
0 new messages