From 946300125782da84533147e0f834adb6eafb0ab5 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Thu, 4 Feb 2016 16:23:30 -0200 Subject: [PATCH] web_steps: retry filling in tinyMCE for up to 5 seconds --- features/step_definitions/web_steps.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index af97759..84f25da 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -277,7 +277,18 @@ Then /^display "([^\"]*)"$/ do |element| end Then /^I fill in tinyMCE "(.*?)" with "(.*?)"$/ do |field, content| - execute_script("$(tinymce.editors['#{field}'].setContent('#{content}'))") + n = 0 + begin + execute_script("tinymce.editors['#{field}'].setContent('#{content}')") + rescue Selenium::WebDriver::Error::JavascriptError + n += 1 + if n < 5 + sleep 1 + retry + else + raise + end + end end Then /^there should be a div with class "([^"]*)"$/ do |klass| -- libgit2 0.21.2