How to write automation test for ace editor ?

948 views
Skip to first unread message

Madhusudhan Seetharamiah

unread,
Dec 11, 2018, 5:56:46 AM12/11/18
to Ajax.org Cloud9 Editor (Ace)
Hi 

I wanted to write some automation cases to ace editor implementation in my project. 
How can i add some text to editor dynamically through nightwatch ? anyone have some sample test which can help me out? 

usually setValue is used for textboxs, textarea etc, in nightwatch. Any idea how can i do for a div ?



Thanks in advance. 

Harutyun Amirjanyan

unread,
Dec 12, 2018, 4:42:01 AM12/12/18
to ace-d...@googlegroups.com
You can either use javascript api of ace, or send keyboard events for ctrl-a and then typing the text.

Rob S

unread,
Dec 14, 2018, 9:47:18 AM12/14/18
to Ajax.org Cloud9 Editor (Ace)
Using mabl testing, it was difficult to get set up.  Mabl does not allow access to the "window" JavaScript object, which restricted setting up some tests.
I got around it by adding a hidden element, using JavaScript to unhide it, clicking on the button, and the button itself called a function that references ace editor functionality because it has access to ace editor in the document's scope.

Mable doesn't record keyboard events on the ace editor - because it doesn't recognize DIV elements as editable.  The test that I created needed to remove all the current text and use a dropdown on the form to add new text into the Ace Editor.  So I needed a backdoor access to the ace editor object, which wasn't available within the Mable scope because the window object was not available.

Hao Wu

unread,
Jan 12, 2020, 6:23:40 AM1/12/20
to Ajax.org Cloud9 Editor (Ace)
.clearValue('textarea')
.setValue('textarea', content

works for me with nightwatch
Reply all
Reply to author
Forward
0 new messages