Commit fdaabeb4 authored by Vadim Rutkovsky's avatar Vadim Rutkovsky

tests: initial setup: rewrite Next/Continue button detection

parent 53eab69b
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
from behave import step from behave import step
from common_steps import wait_until, check_for_errors from common_steps import check_for_errors
from dogtail.tree import root from dogtail.tree import root
from os import system from os import system
from pyatspi import STATE_SENSITIVE from pyatspi import STATE_SENSITIVE
...@@ -67,17 +67,12 @@ def wait_for_account_to_be_looked_up(context): ...@@ -67,17 +67,12 @@ def wait_for_account_to_be_looked_up(context):
def click_next(window): def click_next(window):
# As initial wizard dialog creates a bunch of 'Next' buttons # As initial wizard dialog creates a bunch of 'Next' buttons
# We have to click to the visible and enabled one # We have to click to the visible and enabled one
button = None buttons = window.findChildren(lambda x: x.name == 'Next' and x.showing and
for attempt in xrange(0, 10): STATE_SENSITIVE in x.getState().getStates())
btns = window.findChildren(lambda x: x.name == 'Next') if buttons == []:
visible_and_enabled = [x for x in btns if x.showing and STATE_SENSITIVE in x.getState().getStates()] raise Exception("Enabled Next button was not found")
if visible_and_enabled == []: else:
sleep(0.1) buttons[0].click()
continue
else:
button = visible_and_enabled[0]
break
button.click()
@step(u'Complete {sending_or_receiving} Email dialog of Evolution Account Assistant setting') @step(u'Complete {sending_or_receiving} Email dialog of Evolution Account Assistant setting')
......
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