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
|
||||
|
||||
Capybara.exact = true
|
||||
Webdrivers::Chromedriver.required_version = "2.38"
|
||||
|
||||
OmniAuth.config.test_mode = true
|
||||
|
||||
@@ -51,14 +51,8 @@ module Verifications
|
||||
sleep 0.01
|
||||
end
|
||||
|
||||
# Fill the editor content
|
||||
page.execute_script <<-SCRIPT
|
||||
var ckeditor = CKEDITOR.instances.#{locator}
|
||||
ckeditor.setData("#{with}")
|
||||
ckeditor.focus()
|
||||
ckeditor.updateElement()
|
||||
SCRIPT
|
||||
|
||||
expect(page).to have_ckeditor label, with: with
|
||||
within("#cke_#{locator}") do
|
||||
within_frame(0) { find("body").set(with) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,8 +14,12 @@ RSpec::Matchers.define :have_ckeditor do |label, with:|
|
||||
match do
|
||||
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
|
||||
within_frame(0) { has_content?(with) }
|
||||
within_frame(0) { has_content?(with, exact: true) }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user