summaryrefslogtreecommitdiff
path: root/qa/qa/page/base.rb
diff options
context:
space:
mode:
authorMark Lapierre <mlapierre@gitlab.com>2019-06-05 08:46:30 +0000
committerRémy Coutable <remy@rymai.me>2019-06-05 08:46:30 +0000
commit5cccf313c3f473cf7104ce846d6daed86cfeb392 (patch)
tree9701299c3333e3cda044b9ba65e888865e65b98c /qa/qa/page/base.rb
parent765917dc088bee52a3f95d76fc7f32d408a2af20 (diff)
downloadgitlab-ce-5cccf313c3f473cf7104ce846d6daed86cfeb392.tar.gz
Fix Web IDE add template test
Wait for the new file modal to stop animating before clicking it We now need to click the commit button 3 times: 1. To enter commit mode 2. To being staging changes 3. To submit the commit
Diffstat (limited to 'qa/qa/page/base.rb')
-rw-r--r--qa/qa/page/base.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb
index 389f4e0032e..d247a273637 100644
--- a/qa/qa/page/base.rb
+++ b/qa/qa/page/base.rb
@@ -78,8 +78,12 @@ module QA
page.evaluate_script('xhr.status') == 200
end
- def find_element(name, text: nil, wait: Capybara.default_max_wait_time)
- find(element_selector_css(name), wait: wait, text: text)
+ def find_element(name, **kwargs)
+ find(element_selector_css(name), kwargs)
+ end
+
+ def active_element?(name)
+ find_element(name, class: 'active')
end
def all_elements(name)
@@ -132,6 +136,15 @@ module QA
has_no_css?('.fa-spinner', wait: Capybara.default_max_wait_time)
end
+ def wait_for_animated_element(name)
+ # It would be ideal if we could detect when the animation is complete
+ # but in some cases there's nothing we can easily access via capybara
+ # so instead we wait for the element, and then we wait a little longer
+ raise ElementNotFound, %Q(Couldn't find element named "#{name}") unless has_element?(name)
+
+ sleep 1
+ end
+
def within_element(name, text: nil)
page.within(element_selector_css(name), text: text) do
yield