diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 28abc03d9..3de8fd85d 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -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 diff --git a/spec/support/common_actions/verifications.rb b/spec/support/common_actions/verifications.rb index 92ef462e0..d9c4b2c68 100644 --- a/spec/support/common_actions/verifications.rb +++ b/spec/support/common_actions/verifications.rb @@ -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 diff --git a/spec/support/matchers/have_ckeditor.rb b/spec/support/matchers/have_ckeditor.rb index 8072ad511..6a5a8585d 100644 --- a/spec/support/matchers/have_ckeditor.rb +++ b/spec/support/matchers/have_ckeditor.rb @@ -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