Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from PhantomJS to headless Chrome #101

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
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