Comments (13)
Update: @jangromko is working on adding some touch support to Wallaby, we're basing the API on what's available in Selenium WebDriver Wire Protocol and what works in Chrome (doesn't work in Firefox for some reason). Expect a PR with tests + new commands in a few weeks (similar to #453 )
from wallaby.
What sort of api were you thinking about for this? I'd be interested to see a sample implementation. Otherwise if this is an issue you're facing right now you can always use execute_script/2
and just do drag and drop directly with JS.
from wallaby.
I would think it would be nice to separate the drag and drop actions to allow partial application for reuse.
session
|> drag("#garbage")
|> drop("#trash")
This way you could save off everything before the drop into a function and call it with a new drop target easily for multiple tests.
from wallaby.
I think the way we'd have to do this is with the perform actions endpoint: https://www.w3.org/TR/webdriver/#dfn-perform-actions.
We'd have to construct the list of actions internally and then execute them. I'm not sure what the level of effort would be to construct the actions since I'm not exactly sure what format the actions have to be in or if they would work with our existing functionality.
from wallaby.
Selenium JSON Wire Protocol has some touch-related commands (see Selenium Wiki) and I am currently using touch_scroll
like this:
def touch_scroll(session, element, x_offset, y_offset) do
{:ok, _} =
request(:post, "#{session.url}/touch/scroll", %{
element: element.id,
xoffset: x_offset,
yoffset: y_offset
})
session
end
def touch_scroll(session, x_offset, y_offset) do
{:ok, _} =
request(:post, "#{session.url}/touch/scroll", %{xoffset: x_offset, yoffset: y_offset})
session
end
We could look into whether this is also supported on chromedriver and add these commands to Wallaby
from wallaby.
That sounds good to me. I believe that chromedriver had something similar so we can probably take advantage of that.
from wallaby.
@michallepicki just checking -- was any progress made on this?
from wallaby.
There is a stale PR by @jangromko , needs to be updated: #480 - @oliverswitzer is this something you'd want to pick up?
edit: Looks like @jangromko updated the PR and there are no conflicts now.
edit2: This was released in Wallaby 0.28 :)
from wallaby.
@mhanberg I think this can be closed?
from wallaby.
@michallepicki @jangromko were you ever able to get drag and drop working with the touch commands?
from wallaby.
@mhanberg I think there are different use cases, for some you want the touch commands (naming from Wallaby.WebdriverClient
) like touch_down
+ touch_move
+ touch_up
, but for just drag and drop the first PR linked in this issue added regular mouse events support. So there are button_down
+ move_mouse_to
+ button_up
that can be used for drag and drop. Should be still working since integration tests were added?
from wallaby.
We are trying to do it at work currently, and it is not working, but I was wondering if it has something to do with the JS api we are using to accomplish it.
I also noticed that Capybara still uses some JS to do drag and drop, so I was wondering if it actually worked without the JS haha.
Thanks for the response, I'll take a closer look at our tests.
from wallaby.
Are there any updates on this use case?
I am doing something like this:
session
|> button_down()
|> move_mouse_by(-300, -200)
|> button_up()
This actually triggers the dragging, and the final location of the moved element is correct.
However, the drop
event is not triggered on button_up
, so the whole flow is incomplete. In my use case, if the drop
is not triggered, I consider the drag to be cancelled and move the element back to its original position. E.g. drop
is legitimately not triggered when you drag and hit Esc
before dropping.
from wallaby.
Related Issues (20)
- Wallaby test issue HOT 1
- js_errors: false config is being ignored
- Is it possible to configure "headless: true | false" at session opening? HOT 2
- Chrome is activated but the test times out HOT 4
- Test cases fail randomely because of missing elements HOT 3
- `run_command.sh` improvements HOT 1
- Running wallaby `feature` tests in VS Code HOT 1
- Minor thing: change wording of docs --> browser / users are not the same. HOT 2
- Suggested Phoenix Configuration for Concurrent Feature Test Issues Warning HOT 1
- How Might A Developer New to Wallaby Understand 'page' In the Documentation? HOT 5
- Setup docs unclear when using Phoenix but not Ecto HOT 3
- Use external chromedriver server? HOT 8
- Debug output HOT 5
- Warning on Elixir 1.17.0-rc.1: `ExUnit.Case.register_test/4 is deprecated` HOT 3
- How to send API Requests in parallel? HOT 4
- Getting Selenium (Firefox & Safari) working in Wallaby (~> 0.30.x) HOT 1
- Unable to use Wallaby in release mode
- Feature request: Affordances for asserting on js console output HOT 2
- Wallaby and Ash: dev/test env differences for `on_mount` hooks passed to `ash_authentication_live_session` HOT 2
- ChromeDriver failing with invalid session id HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wallaby.