chenglou / node-huxley

Codeless front-end testing.
MIT License
361 stars 29 forks source link

Use xpath instead of coordinates #79

Open jhnns opened 9 years ago

jhnns commented 9 years ago

What do you think about specifying an xpath instead of coordinates for a click action? This is probably more useful because I don't want to re-record my tests when I changed the location of a button.

With document.evaluate() you're able to get a reference of the DOM element.

chenglou commented 9 years ago

But if you refactor the underlying DOM structure without changing the look, then it'd break right?

It seems like breaking when the button changes location is a desired behaviour?

jhnns commented 9 years ago

Yes, you're right. But re-recording the test is more work than adjusting an xpath. And the acceptance criteria are usually not "click at 300,400", but "click on red button". And "red button" is probably best described via an xpath.

But you could leave that decision up to the developer. Both coordinates and xpath should be valid.