Commit 441dee4c authored by Mark Lapierre's avatar Mark Lapierre

Log text_filter arg of find_element

parent e962baf4
...@@ -37,8 +37,11 @@ module QA ...@@ -37,8 +37,11 @@ module QA
exists exists
end end
def find_element(name, wait: Capybara.default_max_wait_time) def find_element(name, text_filter = nil, wait: Capybara.default_max_wait_time)
log("finding :#{name} (wait: #{wait})") msg = ["finding :#{name}"]
msg << %Q(with text_filter "#{text_filter}") if text_filter
msg << "(wait: #{wait})"
log(msg.compact.join(' '))
element = super element = super
......
...@@ -47,6 +47,15 @@ describe QA::Support::Page::Logging do ...@@ -47,6 +47,15 @@ describe QA::Support::Page::Logging do
it 'logs find_element' do it 'logs find_element' do
expect { subject.find_element(:element) } expect { subject.find_element(:element) }
.to output(/finding :element/).to_stdout_from_any_process
expect { subject.find_element(:element) }
.to output(/found :element/).to_stdout_from_any_process
end
it 'logs find_element with text_filter' do
expect { subject.find_element(:element, 'foo') }
.to output(/finding :element with text_filter "foo"/).to_stdout_from_any_process
expect { subject.find_element(:element, 'foo') }
.to output(/found :element/).to_stdout_from_any_process .to output(/found :element/).to_stdout_from_any_process
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment