spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
815 stars 256 forks source link

Capybara feature specs with TinyMCE: Capybara::ElementNotFound: Unable to find visible frame "content_ifr" #259

Closed ianrandmckenzie closed 5 years ago

ianrandmckenzie commented 5 years ago

In a Capybara feature spec, I am attempting to do the following:

  within_frame("element_content_content_ifr") do
    # do stuff
  end

Where element_content_content_ifr is the name of my tinymce iframe.

I get the error:

Capybara::ElementNotFound:
       Unable to find visible frame "element_content_content_ifr"

I've set a pause during the test and inspected element. The iframe with the specified ID is definitely there, but Capybara can't find it. I am not having issues with Capybara finding iframes in other parts of my application, only the TinyMCE iframe.

I have also attempted sleep 5 before executing the within_frame line, but I get the same error. Is there something I'm doing wrong? Is there a proper way to do Capybara tests when TinyMCE is on the page?

ianrandmckenzie commented 5 years ago

A team member from Capybara helped me figure this out:

https://stackoverflow.com/questions/57419772/tinymce-capybaraelementnotfound-unable-to-find-visible-frame-content-ifr

It turns out that one of the containing elements has CSS visibility: hidden which hindered the ability for the iframe to be found.