Skip to content
6 changes: 3 additions & 3 deletions spec/features/pages/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
fill_in 'page_navigation_title', with: 'A new navigation title'
fill_in 'page_content', with: "A new content with a ![existing image](@image-existing-image) and a ![new image](@image-new-image). Also an ![existing code](@code-existing-code) and a ![new code](@code-new-code). "
fill_in 'page_notes', with: 'A new note'

find('#page_images_attributes_0_file', visible: false).set base64_other_image[:data]
# As capybara does not finde thethe element having "display: none" in headless chrome we simulate it as js code
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea.

Some improvements:

  • Typos: finde thethe
  • Create a module with this method, e.g. find_hidden (see FocusElement module for inspiration) so we can reuse it.

page.execute_script("jQuery('#page_images_attributes_0_file').val('#{base64_other_image[:data]}')")
fill_in 'page_images_attributes_0_identifier', with: 'existing-image'

fill_in 'page_codes_attributes_0_identifier', with: 'existing-code'
Expand Down Expand Up @@ -114,7 +114,7 @@
.and change { @page.navigation_title }.to('A new navigation title')
.and change { @page.parent }.from(old_page_parent).to(new_parent_page)
.and change { @page.position }.from(1).to(2)
.and change { @page.content }.to("A new content with a ![existing image](@image-existing-image) and a ![new image](@image-new-image). Also an ![existing code](@code-existing-code) and a ![new code](@code-new-code).")
.and change { @page.content }.to('A new content with a [existing image](@image-existing-image) and a [new image](@image-new-image). Also an [existing code](@code-existing-code) and a [new code](@code-new-code).')
.and change { @page.notes }.to('A new note')
.and change { @page.images.count }.by(1)
.and change { @page.images.first.file.file.identifier }.to('file.png')
Expand Down