Merge pull request #4026 from consul/fill_in_ckeditor

Fix chromedriver hanging with CKEditor
This commit is contained in:
Javier Martín
2020-06-09 14:47:06 +02:00
committed by GitHub
3 changed files with 8 additions and 11 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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