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
end
def check_element(name)
find_element(name).set(true)
retry_until(sleep_interval: 1) do
find_element(name).set(true)
find_element(name).checked?
end
end
def uncheck_element(name)
find_element(name).set(false)
retry_until(sleep_interval: 1) do
find_element(name).set(false)
!find_element(name).checked?
end
end
# replace with (..., page = self.class)
......
......@@ -59,6 +59,18 @@ module QA
elements
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)
msg = ["clicking :#{name}"]
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