These feature tests were taking too long, we can't run them for every
single model.
I'm taking the approach of using one different model for each test, but
in theory only using a few models covering every possible scenario
would be enough.
The `type: :feature` is automatically detected by RSpec because these
tests are inside the `spec/features` folder. Using `feature` re-adds a
`type: :feature` to these files, which will result in a conflict when we
upgrade to Rails 5.1's system tests.
Because of this change, we also need to change `background` to `before`
or else these tests will fail.
From now on these static pages:
`/privacy'
`/conditions'
`/accesibility'
`/help/faq'
`/welcome'
have been moved to the DB and can be modified easily by any
administrator in `/admin/site_customization/pages'
It was accidentally deleted in commit 914bfa6.
Note the following spec passes on my machine if we add a `sleep 0.1`
call in the `:wait_readable` part of ruby's `Net::Protocol#rbuf_fill`.
Otherwise, it hangs forever after clicking the `.fileupload-file` div,
which closes its window. It might be solved when upgrading rails,
capybara, selenium or chromedriver.
scenario "Allows images in CKEditor", :js do
visit edit_admin_site_customization_page_path(custom_page)
within(".ckeditor") do
within_frame(0) { expect(page).not_to have_css("img") }
expect(page).to have_css(".cke_toolbar .cke_button__image_icon")
find(".cke_toolbar .cke_button__image_icon").click
end
within_window(window_opened_by { click_link "Browse Server" }) do
attach_file :file,
Rails.root.join('spec/fixtures/files/clippy.jpg'),
visible: false
find(".fileupload-file").click
end
click_link "OK"
within(".ckeditor") do
within_frame(0) { expect(page).to have_css("img") }
end
end