Capybara-webkit cannot handle link with bootstrap glyphicon

I have a link:

link_to %q(<span class='glyphicon glyphicon-trash'/>).html_safe, feed_item, data: {confirm: 'Are you sure?',toggle: 'tooltip'}, method: :delete, title: 'Delete', id: 'delete_post'

and the following function specification code

page.accept_confirm do
  click_link 'delete_post'
end

and I get the following error:

Capybara::Webkit::ClickFailed:
       Failed to find position for element /html/body/div[@id='wrapper']/div[@id='page-content-wrapper']/div/div[@id='main']/div[@id='main_content']/div[4]/div/div/div[1]/h3/div/a[@id='delete_post']

If I replaced the span with a glyphicon with some text, for example. "Delete", the test works. This seems to be due to an unresolved issue on Github and could be due to CSS overlaying on the clickable html element. However, I cannot understand how this overlap occurs in this case or how to fix it.

It is common practice to use icons for common tasks, such as Edit or Delete, so it would be useful to find a solution to this.

How do I solve this problem?

+4
4

, , javascript, . , . trash_icon :

  def trash_icon
    if Rails.env.test?
      'proxy_for_trash_icon'
    else
      "<span class='glyphicon glyphicon-trash'/>".html_safe
    end
  end

:

link_to trash_icon, feed_item, data: {confirm: 'Are you sure?',toggle: 'tooltip'}, method: :delete, title: 'Delete', id: 'delete_post'

:

page.accept_confirm do
  click_link 'proxy_for_trash_icon'
end

, /, .

, , - , .

+2

Obromios , , . , , Rails.env.test?, , .

, :

find('.glyphicon.glyphicon-trash').trigger('click')

:

click_link 'delete_post'
+2

@ariel_scherman, js: true .

- :

feature "delete the glyphicon", js: true do
   ............
end

javascript

0

capybara-webkit Qt 5.5.1, < 5.3 , , .

-1

All Articles