From aaf124b0f7698f5def277b02ab97f3992fe1569d Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 18 Nov 2019 21:06:19 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- qa/qa/page/base.rb | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'qa/qa/page/base.rb') diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index c256a895718..ed4d33dc7a3 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -111,12 +111,18 @@ module QA element.select value end - def has_element?(name, text: nil, wait: Capybara.default_max_wait_time) - has_css?(element_selector_css(name), wait: wait, text: text) + def has_element?(name, **kwargs) + wait = kwargs[:wait] ? kwargs[:wait] && kwargs.delete(:wait) : Capybara.default_max_wait_time + text = kwargs[:text] ? kwargs[:text] && kwargs.delete(:text) : nil + + has_css?(element_selector_css(name, kwargs), text: text, wait: wait) end - def has_no_element?(name, text: nil, wait: Capybara.default_max_wait_time) - has_no_css?(element_selector_css(name), wait: wait, text: text) + def has_no_element?(name, **kwargs) + wait = kwargs[:wait] ? kwargs[:wait] && kwargs.delete(:wait) : Capybara.default_max_wait_time + text = kwargs[:text] ? kwargs[:text] && kwargs.delete(:text) : nil + + has_no_css?(element_selector_css(name, kwargs), wait: wait, text: text) end def has_text?(text) @@ -199,8 +205,8 @@ module QA scroll_to(element_selector_css(name), *args) end - def element_selector_css(name) - Page::Element.new(name).selector_css + def element_selector_css(name, *attributes) + Page::Element.new(name, *attributes).selector_css end def click_link_with_text(text) -- cgit v1.2.1