Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API proposal/discussion for touch platform interactions #803

Closed
carhartl opened this issue Sep 3, 2012 · 11 comments
Closed

API proposal/discussion for touch platform interactions #803

carhartl opened this issue Sep 3, 2012 · 11 comments
Labels

Comments

@carhartl
Copy link

carhartl commented Sep 3, 2012

Little bit of background: For a touch platform only web app we're building we're using Capybara for acceptance tests, along with a js driver that is touch capable (now poltergeist, before capybara-webkit - basically any recent webkit based driver supporting touch events could be used). We're not using any click interactions at all, thus I needed to make the capybara js driver touch capable.

Here's a pull request I sent to poltergeist
https://github.com/jonleighton/poltergeist/pull/135/files

which contains an initial implementation, so far only for simple, single taps:

Element#single_tap

e.g.

find('.tap-me').single_tap

@jonleighton in response asked me to start a discussion here as to (hopefully) agree on an API that could be implemented by any capable driver. See teampoltergeist/poltergeist#141

I had further methods in mind to be implement later, just as a proposal:

single_tap
double_tap
long_tap
swipe_left
swipe_right
swipe_up
swipe_down

(The names follow what Zepto.js provides for touch event abstractions.) There are also gesture events I didn't yet think about.

I'd be glad if we could get a discussion going about this and happily help with the implementation whenever required.

[Edit: swipe_bottom -> swipe_down]

@jnicklas
Copy link
Collaborator

jnicklas commented Sep 3, 2012

It sounds reasonable enough to me. The method names are descriptive and fit their purpose. I'm for it!

@carhartl
Copy link
Author

carhartl commented Sep 3, 2012

Cool! So would I add these methods as follows?

# Capybara::Driver::Node
def single_tap
  raise NotSupportedByDriverError
end
# Capybara::Node::Element
def single_tap
  synchronize { base.single_tap }
end

@jnicklas
Copy link
Collaborator

jnicklas commented Sep 5, 2012

Yes exactly. It would make sense to add tests for them as well. This might be a bit tricky, obviously since none of the drivers in Capybara itself support it.

@carhartl
Copy link
Author

carhartl commented Sep 5, 2012

I am thinking: For Node make sure that the expected exceptions get thrown, for Element set a message expectation on base. But I'll see what's there as well.

@jnicklas
Copy link
Collaborator

jnicklas commented Sep 5, 2012

The ideal solution, imo would be to have tests for the actual implementation in the Capybara suite. Selenium and RackTest could exclude those tests from their own suites.

@zebulgar
Copy link

zebulgar commented Jul 2, 2013

Did this ever get made? I'd be interested in contributing to Capybara to help create this API

@jnicklas
Copy link
Collaborator

jnicklas commented Jul 2, 2013

@MITDelian unfortunately, no. If you'd like to help, that'd be great.

@glaksmono
Copy link

This would be very helpful 👍

@abotalov abotalov modified the milestones: Capybara 2.3, Capybara 2.2 Feb 5, 2014
@abotalov abotalov removed this from the Capybara 2.3 milestone Feb 25, 2014
@twalpole
Copy link
Member

twalpole commented Apr 8, 2014

I've started implementation of a touch api in pr #1289 - currently there are 4 methods single_tap, double_tap, long_press, flick (based on element specific touch methods selenium webdriver provides) -- I'm not sure what useful parameters to flick should be, so feedback is definitely welcome, as are suggestions for any other methods we should have. Please add suggestions/comments over in #1289. I've also added testing of them against android via saucelabs, won't work here yet due to the secure env vars being set for my repo but I'll get them fixed up at some point.

@twalpole
Copy link
Member

Closing this as discussion should move over to pr #1289

@Ricardonacif
Copy link

Hey, there's this gem I have developed that adds touch gestures support to Capybara. Take a look at https://github.com/Ricardonacif/touch_action .

Thanks,

@lock lock bot locked and limited conversation to collaborators Aug 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants