Commit bbd28eeb0199469b4c0f2beaeb064839a8aa9172
1 parent
95d5df36
Exists in
master
and in
14 other branches
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.
Showing
2 changed files
with
8 additions
and
4 deletions
Show diff stats
features/forum.feature
| @@ -79,7 +79,7 @@ Feature: forum | @@ -79,7 +79,7 @@ Feature: forum | ||
| 79 | | joaosilva | Forum One | | 79 | | joaosilva | Forum One | |
| 80 | And I go to /joaosilva/forum-one | 80 | And I go to /joaosilva/forum-one |
| 81 | When I follow "Configure forum" | 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 | And I check "Has terms of use:" | 83 | And I check "Has terms of use:" |
| 84 | And I press "Save" | 84 | And I press "Save" |
| 85 | Then I should see "Forum One" | 85 | Then I should see "Forum One" |
| @@ -95,7 +95,7 @@ Feature: forum | @@ -95,7 +95,7 @@ Feature: forum | ||
| 95 | | mariasilva | Maria Silva | | 95 | | mariasilva | Maria Silva | |
| 96 | And I go to /joaosilva/forum-one | 96 | And I go to /joaosilva/forum-one |
| 97 | When I follow "Configure forum" | 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 | And I check "Has terms of use:" | 99 | And I check "Has terms of use:" |
| 100 | And I press "Save" | 100 | And I press "Save" |
| 101 | When I follow "New discussion topic" | 101 | When I follow "New discussion topic" |
| @@ -118,7 +118,7 @@ Feature: forum | @@ -118,7 +118,7 @@ Feature: forum | ||
| 118 | | mariasilva | Maria Silva | | 118 | | mariasilva | Maria Silva | |
| 119 | And I go to /joaosilva/forum-one | 119 | And I go to /joaosilva/forum-one |
| 120 | When I follow "Configure forum" | 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 | And I check "Has terms of use:" | 122 | And I check "Has terms of use:" |
| 123 | And I press "Save" | 123 | And I press "Save" |
| 124 | When I follow "Logout" | 124 | When I follow "Logout" |
| @@ -135,7 +135,7 @@ Feature: forum | @@ -135,7 +135,7 @@ Feature: forum | ||
| 135 | | joaosilva | Forum One | | 135 | | joaosilva | Forum One | |
| 136 | And I go to /joaosilva/forum-one | 136 | And I go to /joaosilva/forum-one |
| 137 | When I follow "Configure forum" | 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 | And I check "Has terms of use:" | 139 | And I check "Has terms of use:" |
| 140 | And I press "Save" | 140 | And I press "Save" |
| 141 | When I follow "Logout" | 141 | When I follow "Logout" |
features/step_definitions/web_steps.rb
| @@ -276,6 +276,10 @@ Then /^display "([^\"]*)"$/ do |element| | @@ -276,6 +276,10 @@ Then /^display "([^\"]*)"$/ do |element| | ||
| 276 | evaluate_script("jQuery('#{element}').show() && false;") | 276 | evaluate_script("jQuery('#{element}').show() && false;") |
| 277 | end | 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 | Then /^there should be a div with class "([^"]*)"$/ do |klass| | 283 | Then /^there should be a div with class "([^"]*)"$/ do |klass| |
| 280 | should have_selector("div.#{klass}") | 284 | should have_selector("div.#{klass}") |
| 281 | end | 285 | end |