Commit bbd28eeb0199469b4c0f2beaeb064839a8aa9172

Authored by Rodrigo Souto
1 parent 95d5df36

forum-feature: fill tinyMCE field done through execute_script

Tinymce fields are not filled normally as other fields. In order to fill
them, had to use execute_script to set the content of the editor object.

This fix might be necessary in other tests as well.
features/forum.feature
... ... @@ -79,7 +79,7 @@ Feature: forum
79 79 | joaosilva | Forum One |
80 80 And I go to /joaosilva/forum-one
81 81 When I follow "Configure forum"
82   - And I fill in "Description" with "My description"
  82 + And I fill in tinyMCE "article_body" with "My description"
83 83 And I check "Has terms of use:"
84 84 And I press "Save"
85 85 Then I should see "Forum One"
... ... @@ -95,7 +95,7 @@ Feature: forum
95 95 | mariasilva | Maria Silva |
96 96 And I go to /joaosilva/forum-one
97 97 When I follow "Configure forum"
98   - And I fill in "Description" with "My description"
  98 + And I fill in tinyMCE "article_body" with "My description"
99 99 And I check "Has terms of use:"
100 100 And I press "Save"
101 101 When I follow "New discussion topic"
... ... @@ -118,7 +118,7 @@ Feature: forum
118 118 | mariasilva | Maria Silva |
119 119 And I go to /joaosilva/forum-one
120 120 When I follow "Configure forum"
121   - And I fill in "Description" with "My description"
  121 + And I fill in tinyMCE "article_body" with "My description"
122 122 And I check "Has terms of use:"
123 123 And I press "Save"
124 124 When I follow "Logout"
... ... @@ -135,7 +135,7 @@ Feature: forum
135 135 | joaosilva | Forum One |
136 136 And I go to /joaosilva/forum-one
137 137 When I follow "Configure forum"
138   - And I fill in "Description" with "My description"
  138 + And I fill in tinyMCE "article_body" with "My description"
139 139 And I check "Has terms of use:"
140 140 And I press "Save"
141 141 When I follow "Logout"
... ...
features/step_definitions/web_steps.rb
... ... @@ -276,6 +276,10 @@ Then /^display "([^\"]*)"$/ do |element|
276 276 evaluate_script("jQuery('#{element}').show() && false;")
277 277 end
278 278  
  279 +Then /^I fill in tinyMCE "(.*?)" with "(.*?)"$/ do |field, content|
  280 + execute_script("$(tinymce.editors['#{field}'].setContent('#{content}'))")
  281 +end
  282 +
279 283 Then /^there should be a div with class "([^"]*)"$/ do |klass|
280 284 should have_selector("div.#{klass}")
281 285 end
... ...