diff options
author | Ramya Authappan <rauthappan@gitlab.com> | 2019-01-02 06:16:44 +0000 |
---|---|---|
committer | Ramya Authappan <rauthappan@gitlab.com> | 2019-01-02 06:16:44 +0000 |
commit | 5c1eb9ab821f8d9427d43b4f2959b918de9dd3c2 (patch) | |
tree | e7e0c45b32e9050feb2e80aea9971e7a70fe7e94 | |
parent | dcc17872d510da91f0ad05a44339e3826f6d7cae (diff) | |
parent | 441dee4c315cb728e61ae5e5e42f36d782ef8e29 (diff) | |
download | gitlab-ce-5c1eb9ab821f8d9427d43b4f2959b918de9dd3c2.tar.gz |
Merge branch 'qa-fix-logging-find-element' into 'master'
log text_filter arg of find_element
Closes gitlab-org/quality/nightly#52
See merge request gitlab-org/gitlab-ce!24064
-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 |