Merge pull request #4026 from consul/fill_in_ckeditor
Fix chromedriver hanging with CKEditor
This commit is contained in:
@@ -53,6 +53,5 @@ Capybara.register_driver :headless_chrome do |app|
|
|||||||
end
|
end
|
||||||
|
|
||||||
Capybara.exact = true
|
Capybara.exact = true
|
||||||
Webdrivers::Chromedriver.required_version = "2.38"
|
|
||||||
|
|
||||||
OmniAuth.config.test_mode = true
|
OmniAuth.config.test_mode = true
|
||||||
|
|||||||
@@ -51,14 +51,8 @@ module Verifications
|
|||||||
sleep 0.01
|
sleep 0.01
|
||||||
end
|
end
|
||||||
|
|
||||||
# Fill the editor content
|
within("#cke_#{locator}") do
|
||||||
page.execute_script <<-SCRIPT
|
within_frame(0) { find("body").set(with) }
|
||||||
var ckeditor = CKEDITOR.instances.#{locator}
|
end
|
||||||
ckeditor.setData("#{with}")
|
|
||||||
ckeditor.focus()
|
|
||||||
ckeditor.updateElement()
|
|
||||||
SCRIPT
|
|
||||||
|
|
||||||
expect(page).to have_ckeditor label, with: with
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,8 +14,12 @@ RSpec::Matchers.define :have_ckeditor do |label, with:|
|
|||||||
match do
|
match do
|
||||||
return false unless has_ckeditor?
|
return false unless has_ckeditor?
|
||||||
|
|
||||||
|
until page.execute_script("return CKEDITOR.instances.#{textarea_id}.status === 'ready';") do
|
||||||
|
sleep 0.01
|
||||||
|
end
|
||||||
|
|
||||||
page.within(ckeditor_id) do
|
page.within(ckeditor_id) do
|
||||||
within_frame(0) { has_content?(with) }
|
within_frame(0) { has_content?(with, exact: true) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user