Blitz
Blitz

Reputation: 259

protractor tinymce automated tests

I'm trying to test AngularJS tinyMCE with protractor and I keep bumping into problems when trying to send content or do any test on the tinyMCE editor. The environment for testing is Selenium with Jasmine2

Currently i have:

HTML

<textarea 
    id="page-editor" 
    ui-tinymce="tinymceOptions" 
    ng-model="item.description">
</textarea>

Test

browser.switchTo().frame('page-editor_ifr');
var body = element(by.id('tinymce'));
body.clear();
body.click();
body.sendKeys('Testing123');

The error I get is: Failed: no such frame but if I load the page normally the frame is there with the correct ID. Also tried using promise

browser.switchTo().frame('page-editor_ifr')
    .then(function() {
        var body = element(by.id('tinymce'));
        body.clear();
        body.click();
        body.sendKeys('Testing123');
    });

but with no result.

Upvotes: 1

Views: 1285

Answers (1)

alecxe
alecxe

Reputation: 473873

You need to find that frame first and pass the element finder to the switchTo().frame():

var frame = element(by.id('page-editor_ifr'));
browser.switchTo().frame(frame);

Upvotes: 1

Related Questions