keoghpe
keoghpe

Reputation: 404

Testing D3 Applications with click and drag events

I'm creating an application based loosely on this example: http://bl.ocks.org/rkirsling/5001347

I was wondering if anyone had any ideas on how to write tests for it. Screenshot diff tools aren't the way to go as I don't want to test how the visualisation looks, but how it behaves.

Ideally what I would like to do is be able to check events.

For example, click the middle of the svg and check if a node has been created. Get the locations of two nodes, drag from one to the other and check if a link has been created.

Any thoughts on how to do this?

Upvotes: 2

Views: 500

Answers (1)

Pierre-Yves O.
Pierre-Yves O.

Reputation: 598

What you need is end-to-end testing tools. For Angular apps, Protractor is nice.

However, be careful, the native HTML5 drag-n-drop events are not well supported on Chrome, as described here: https://code.google.com/p/selenium/issues/detail?id=3604

Upvotes: 1

Related Questions