Andrew
Andrew

Reputation: 21

Test WordPress TinyMCE with Codeception

I am trying to add content in a WordPress post type with an acceptance test in Codeception.

I tried several things but I can not make to work.

For example. I would like to add content in a Post or Page or Product. The main content is the iframe with TinyMCE in WordPress.

The best solution I found until now is this but it is not working on WordPress :

$I->switchToIFrame('#content_ifr');
$I->executeJS('document.getElementById("tinymce").innerHTML = "<p>Test content</p>";');

Have you got any idea how to implement this?

Upvotes: 1

Views: 198

Answers (1)

Andrew
Andrew

Reputation: 21

If anyone need to add content in the tinymce editor in WordPress with Codeception the solution is this :

 $I->click('#content-html');

 $I->fillField('#content', 'Test Content');

With the 1st command we change the tinymce tab to html and with the 2nd one we can add the content we like inside.

Hope this helps!

Upvotes: 1

Related Questions