Commit 4bbbea40 authored by Mark Lapierre's avatar Mark Lapierre

Retry (un)checking an element

This checks or unchecks an element and then confirms that the change
was successful, and retries if it was not.
parent 698aae94
...@@ -86,11 +86,19 @@ module QA ...@@ -86,11 +86,19 @@ module QA
end end
def check_element(name) def check_element(name)
retry_until(sleep_interval: 1) do
find_element(name).set(true) find_element(name).set(true)
find_element(name).checked?
end
end end
def uncheck_element(name) def uncheck_element(name)
retry_until(sleep_interval: 1) do
find_element(name).set(false) find_element(name).set(false)
!find_element(name).checked?
end
end end
# replace with (..., page = self.class) # replace with (..., page = self.class)
......
...@@ -59,6 +59,18 @@ module QA ...@@ -59,6 +59,18 @@ module QA
elements elements
end end
def check_element(name)
log("checking :#{name}")
super
end
def uncheck_element(name)
log("unchecking :#{name}")
super
end
def click_element(name, page = nil, **kwargs) def click_element(name, page = nil, **kwargs)
msg = ["clicking :#{name}"] msg = ["clicking :#{name}"]
msg << ", expecting to be at #{page.class}" if page msg << ", expecting to be at #{page.class}" if page
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment