I am currently investigating Telerik Test Studio to generate automated tests and I have been trying to figure out a way to create automated tests for our application that uses a GoJS html 5 canvas. I have noticed two ways so far:
- Click on specific points (ActiveBrowser.Desktop.Mouse.Click(MouseClickType.LeftClick, 930, 405);). This seems to work provided that the browser always opens in full screen and that the elements in the canvas never change meaning that the tests might become obsolete so I don't believe it being the best approach.
- There seems to be an HtmlCanvas class that I can't seem to find much information or examples on. I have tried to use it as follows but it does not seem as if I can access the elements or text in the canvas this way either:
HtmlCanvas canvas = new HtmlCanvas(ActiveBrowser.Find.AllElements().FirstOrDefault(w => w.TagName == "canvas"));
What would be the best way to approach this scenario? Where is a good place to find more information and examples regarding Test Studio HtmlCanvas?
I suggest that you look at the http://gojs.net/latest/extensions/Robot.html sample, and then make use of the http://gojs.net/latest/extensions/Robot.js extension in your test system.
Note that the coordinates used by Robot are in GoJS document coordinates, not screen coordinates or any particular HTML element's coordinates.