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

Clicking certain coordinates within an element #68

Open
knownasilya opened this issue May 17, 2017 · 3 comments
Open

Clicking certain coordinates within an element #68

knownasilya opened this issue May 17, 2017 · 3 comments

Comments

@knownasilya
Copy link

I'd like to be able to do something like click('.my-map', { xOffset: 5, yOffset: 5 }), since there isn't usually anything to select on to click on a map if you are doing testing that requires drawing on the map, and not clicking existing objects.

@knownasilya
Copy link
Author

So it's possible to pass client* or screen*, but not possible to do a relative offset, which is far more useful, especially when the browser can change sizes during tests.

@Turbo87
Copy link
Contributor

Turbo87 commented May 17, 2017

@knownasilya it should be possible to build a wrapper around find() and click() that does what you're looking for. essentially something like:

async clickXY(selector, x, y) {
  let element = find(selector);
  let elementX = element.foobarX;
  let elementY = element.foobarY;
  let globalX = elementX + x;
  let globalY = elementY + y;
  await click(element, { x: globalX, y: globalY });
}

@cibernox
Copy link
Owner

I also lean to think that click should remain "bare metal" and just forward options to the event, since it's pretty easy to create an utility like @Turbo87 did. With async/await and this helpers you can don't need to worry about asynchrony and that helper will work both in acceptance and integration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants