Using Karate testcase scenario (feature) I need to interact with to simulate signature to be written in it.
<canvas width="1292" height="596" style="width: 100%; height: 100%; touch-action: none;"></canvas>
I have tried to use JS to draw some element, but it not identified as signature. I have used this:
* script('document.getElementsByTagName("canvas")[0].getContext("2d").fillStyle = "green"')
* script('document.getElementsByTagName("canvas")[0].getContext("2d").fillRect(10, 10, 150, 100)')
It worked, but the paint was not identified as signature. I have different idea - to use path/move to/fill in javascript:
* script('document.getElementsByTagName("canvas")[0].getContext("2d").fillStyle = "green"')
* script('document.getElementsByTagName("canvas")[0].getContext("2d").beginPath()')
* script('document.getElementsByTagName("canvas")[0].getContext("2d").moveTo(200, 200)')
* script('document.getElementsByTagName("canvas")[0].getContext("2d").fill()')
Using this, the test has passed (these lines passed) but in reality the line has not been written into the canvas...
Do you have any idea how to simulate this? Or is there another way how to do it differently? My aim is to simulate hand-written signature in .
Thank you!