Commit 5697907969f48ef731a511049cc8898381f3df44
Exists in
master
and in
14 other branches
Merge branch 'fix_selenium_click_link' of https://gitlab.com/rafamanzo/noosfero
Showing
1 changed file
with
16 additions
and
1 deletions
Show diff stats
features/step_definitions/web_steps.rb
... | ... | @@ -39,7 +39,22 @@ end |
39 | 39 | |
40 | 40 | When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector| |
41 | 41 | with_scope(selector) do |
42 | - click_link(link, :match => :prefer_exact) | |
42 | + begin | |
43 | + click_link(link, :match => :prefer_exact) | |
44 | + rescue Selenium::WebDriver::Error::UnknownError => selenium_error | |
45 | + if selenium_error.message.start_with? 'Element is not clickable at point' | |
46 | + href = find_link(link)[:href] | |
47 | + | |
48 | + warn "#{selenium_error.message}\n\n"\ | |
49 | + "Trying to overcome this by redirecting you to the link's href:\n"\ | |
50 | + "\t'#{href}'\n\n"\ | |
51 | + "Good luck and be careful that this may produce hidden links to work on tests!\n" | |
52 | + | |
53 | + visit href | |
54 | + else | |
55 | + raise selenium_error | |
56 | + end | |
57 | + end | |
43 | 58 | end |
44 | 59 | end |
45 | 60 | ... | ... |