Comments (12)
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.
Related Issues (20)
- Cannot assert text exists if it is across multiple elements such as spans HOT 3
- Allow to skip chromedriver-chrome version match check HOT 4
- Testing live views with chromedriver fails on GitHub actions HOT 7
- Bug in hexdocs, readme link/expand button not visible HOT 2
- Wallaby does not set Selenium sessionId correctly. HOT 3
- Wallaby doesn't find html elements anymore HOT 4
- One chromedriver per core becomes problematic with sufficiently many cores HOT 4
- Support Chrome DevTools HOT 2
- Unexpected output to console when running tests HOT 3
- LiveViewTest Driver HOT 1
- Error tracking db ownership when overriding the useragent of the session HOT 1
- Uncaught TypeError: Cannot set properties of null (setting 'textContent') when field exists (or seems to)
- Multiple wallaby configs for different umbrella apps HOT 4
- chromedriver 115.0.5790.102 not working HOT 10
- Passed capabilities may be passed in the wrong format HOT 1
- Modify capabilities while keeping metadata in user agent HOT 2
- 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
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.