This is a migrated thread and some comments may be shown as answers.

Creating html canvas automation tests

3 Answers 244 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 04 Jan 2017, 11:04 AM

Hi Telerik,

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:
1. 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.
2. There seems to be an HtmlCanvas class that I can't seem to find much information or examples on. I have tried the following:

HtmlCanvas canvas = Find.AllByTagName.FirstOrDefault(w => w.TagName == "canvas");
var brandNode = canvas.ChildNodes.FirstOrDefault(w => w.TextContent == "Brand");
HtmlDiv div = brandNode;
div.Click();

This code gives me the following errors:

- 'ArtOfTest.WebAii.Core.Find.AllByTagName(string)' is a 'method', which is not valid in the given context

- Cannot implicitly convert type 'ArtOfTest.WebAii.ObjectModel.Element' to 'ArtOfTest.WebAii.Controls.HtmlControls.HtmlDiv'

 

Is my approach maybe wrong? What is the best way to resolve this? Where can I get more information regarding accessing the canvas on a browser to generate automated tests?

 

Thanks in advance

3 Answers, 1 is accepted

Sort by
0
Nikolay Petrov
Telerik team
answered on 09 Jan 2017, 09:17 AM
Hi Chris,

Thank you for your interest in Test Studio.

The exception you got is due to a syntax problem. Try to use this line instead the first line of your sample code:
HtmlCanvas canvas = Find.AllByTagName<HtmlCanvas>("canvas").FirstOrDefault();

Here is a link to our framework documentation for further information related to the canvas element.

I hope it will solve the problem.

Regards,
Nikolay Petrov
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Chris
Top achievements
Rank 1
answered on 09 Jan 2017, 09:56 AM

Hi Nikolay,

Thanks for the attempted, but your answer really does not help me at all. I still have absolutely no idea how to communicate or create hooks for the objects inside of the canvas to generate automated tests.

I honestly do not think you read my question properly either because you would have noticed that my question was how to interact with the canvas and how to create automated tests for it. My code examples was merely put in my question to show that I attempted an approach.

Then lastly if you open up that link to the api you will realize there are next to no explanations or examples for the method names or anything in that documentation, so I have no idea how you expect people to understand it either.

Regards

0
Nikolay Petrov
Telerik team
answered on 09 Jan 2017, 03:56 PM
Hello Chris,

I'm sorry I didn't get your main point here.

By design Test Studio works with the DOM of an application. It means that if elements are not located in the DOM the product can not create and execute an automated steps on them. Unfortunately, in this case the elements in the canvas are not recognized as a DOM elements as shown on the attached screenshot.

We can not suggest a workaround in this case. Thank you for your understanding.

Regards,
Nikolay Petrov
Telerik by Progress
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Chris
Top achievements
Rank 1
Answers by
Nikolay Petrov
Telerik team
Chris
Top achievements
Rank 1
Share this question
or