diff options
author | Mark Lapierre <mlapierre@gitlab.com> | 2018-12-28 12:39:07 -0500 |
---|---|---|
committer | Mark Lapierre <mlapierre@gitlab.com> | 2018-12-28 13:15:46 -0500 |
commit | 441dee4c315cb728e61ae5e5e42f36d782ef8e29 (patch) | |
tree | 368761bfe175e0c01633560fb0d29005f4e20ba4 /qa | |
parent | e962baf4417e59cbb2ef8621ef0662f93f180f92 (diff) | |
download | gitlab-ce-441dee4c315cb728e61ae5e5e42f36d782ef8e29.tar.gz |
Log text_filter arg of find_element
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/support/page/logging.rb | 7 | ||||
-rw-r--r-- | qa/spec/page/logging_spec.rb | 9 |
2 files changed, 14 insertions, 2 deletions
diff --git a/qa/qa/support/page/logging.rb b/qa/qa/support/page/logging.rb index df3b794b14b..cfccbb910b7 100644 --- a/qa/qa/support/page/logging.rb +++ b/qa/qa/support/page/logging.rb @@ -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 diff --git a/qa/spec/page/logging_spec.rb b/qa/spec/page/logging_spec.rb index a54ff424f53..f108a5ca318 100644 --- a/qa/spec/page/logging_spec.rb +++ b/qa/spec/page/logging_spec.rb @@ -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 |