Filling in WYMeditor when testing

28 views
Skip to first unread message

Anita Graham

unread,
Nov 16, 2013, 9:12:18 AM11/16/13
to refine...@googlegroups.com

Now I'm trying to add rspec tests to refinerycms-testimonials, and I'm testing the form where one adds a testimonial.

quote is a required field so it must have a value.

For my testing I have borrowed parts of the refinerycms-page's testing and simplified/renamed to fit the far simpler testimonial.

When I test using this

          visit refinery.testimonials_admin_testimonials_path

          click_link ::I18n.t('create_new', :scope => 'refinery.testimonials.admin.testimonials.actions')

          fill_in "Name", :with => "My first testimonial"
          sleep 5
          within_frame('WYMeditor_0'){  fill_in "quote", :with => "Quote" }
          click_button "Save"

I get this:

 Testimonials new/create allows a testimonial to be created
     Failure/Error: within_frame('WYMeditor_0'){  fill_in "quote", :with => "Quote" }
     Capybara::NotSupportedByDriverError:
       Capybara::NotSupportedByDriverError


How should I fill in this required field?

I found one link (http://ruby-journal.com/how-to-fill-in-fckeditor-with-capybara-2/) which may be what I need, but I'd like to know how refinerycms test it. (Obviously I haven't found that part of the page testing yet.)

Anita

Chris Irish

unread,
Nov 16, 2013, 1:59:44 PM11/16/13
to refine...@googlegroups.com
The way I do it is to use a javascript driver and do it via plain javascript. Something like

page.evaluate_script("WYMeditor.INSTANCES[0].html('<p>This is some random content</p>')")

Anita Graham

unread,
Nov 19, 2013, 12:56:45 AM11/19/13
to refine...@googlegroups.com


Thanks that worked!

Kris Quigley

unread,
Jan 29, 2015, 5:13:33 PM1/29/15
to refine...@googlegroups.com
Thanks for that, you just saved me hours of hacking!
Reply all
Reply to author
Forward
0 new messages