Hi,
We want to write Protractor test cases on canvas page, which includes basic events like
a. clicking on a node/link
b. double click on a node/link
c. right click on a node/link
d. selecting a node/link.
As in canvas based approach, Didn’t found any way to get the DOM elements of canvas elements, but using below method able to get Label value of element.
(window.canvasModel.nodes[0].stage.label) we are able to fetch label value by using protractor API, after fetch the value while performing any activity (Double click , Mouse Move) didn’t performed.
Is there any other way to perform these activity like( Double click/mousemove) by using Go-JS, please let me know, or if required any other information please let me know .
First, please understand that Canvas elements do not contain any DOM elements within them. This is true for all browsers and has nothing to do with GoJS.
Second, when talking about GoJS, you should not be assuming that there is anything within the HTML DIV element that hosts the Diagram. The implementation might change at any time.
Third, I suggest that you use the GoJS API to discover and manipulate what is in the diagram and what is seen within the viewport, and that you use the Robot class to simulate mouse events.
I have tried to include robot.js in my project but its giving me same error" Robot is not defiened," i have tried to include robot.js like [ require(’./Robot.js’);]
Could you please let me know this is correct approach to include the robot.js in protractor project.
Thanks in advance
I’m sorry, but I really have no idea of how to use Protractor. Please ask in one of their forums. And if you find a satisfactory answer, please post it here so that other people can benefit.
I will try to find out how to include this robot.js file and try to simulate the mouse events, I will post if any problem statement or solution i found regarding the same.
Hi, @walter
I have included robot.js in my current javascript (.js). Below is the code snippet i am following:
“require(’./Robot.js’);
var robot;
var canvasele = element(by.xpath(”//div[@class=‘spectrum-gojs-diagram’]"));
robot = new Robot(canvasele);
var dragdrop = { writeToNull.getWebElement(),
robot.mouseDown(60, 60, 100, dragdrop);"
In the above Snippet i am trying to use robot .js to perform my Mouse operation on canvas div element but i keep on getting “Robot is not defined " error or " robo.Robot is not a constructor”.
Please Advise.
as in Go js documents , i have assigned var robot as global variable.
Note : we have not developed this application as this is test Environment so we are using canvasele as subsititute of my diagram, as all the canvas page element should be inside this canvasele.