I want to test some keypresses against a ui-ace
instance. However, Protractor can't get focus on the ace element. Ace includes a <textarea>
that I can get focus on (and thus send keys to) but ui-ace
doesn't recognize keys inputted there (and subsequently doesn't update the model).
Selecting method (by.model
, etc) has no impact.
My current workaround is to use evaluate
to set the scope value manually, but this breaks the point of using Protractor.
Good question! Seems that the workaround is double clicking first.
The following works at least on Chrome:
"use strict";
describe('Testing ui-ace', function() {
var divInput = $('div.ace_content');
var inputElm = $('textarea.ace_text-input');
it('opens a ui-ace page', function() {
browser.ignoreSynchronization = true; // sorry but no angular page
browser.get('http://angular-ui.github.io/ui-ace/');
browser.sleep(3000); // sorry but no angular page
});
it('starts editing', function() {
browser.actions().doubleClick(divInput).perform();
});
it('enters some text', function() {
inputElm.sendKeys('Hola');
browser.sleep(5000); // to let you see the result
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With