Log text_filter arg of find_element

This commit is contained in:
Mark Lapierre 2018-12-28 12:39:07 -05:00
parent e962baf441
commit 441dee4c31
2 changed files with 14 additions and 2 deletions

View File

@ -37,8 +37,11 @@ module QA
exists
end
def find_element(name, wait: Capybara.default_max_wait_time)
log("finding :#{name} (wait: #{wait})")
def find_element(name, text_filter = nil, wait: Capybara.default_max_wait_time)
msg = ["finding :#{name}"]
msg << %Q(with text_filter "#{text_filter}") if text_filter
msg << "(wait: #{wait})"
log(msg.compact.join(' '))
element = super

View File

@ -47,6 +47,15 @@ describe QA::Support::Page::Logging do
it 'logs find_element' do
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
end