How to test ActionText rich_text_field in a System test?

Viewed 467

I'm trying to fill in an ActionText rich_text field form input, but can't figure out how to select it. I'm using Rails 6 and ActionText.

With

class Activity
    has_rich_text :description
end

and _form.rb

= f.label :description
= f.rich_text_area :description, class: 'form-control'

Test using:

fill_in "Description", with: "Some description.."

I'll get the error

Capybara::ElementNotFound: Unable to find field "Description" that is not disabled

I suspect the problem is with how the Trix editor dynamically fills in this field as you type. I'm just not sure how to do the input, replicating how the user would be entering text.

1 Answers

You can do so by find the trix editor and entering your details manually:

find(".trix-content").set("New value")
Related