From 08e60506d5df6db78fe29541b751fb7bf13861d0 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Tue, 3 May 2016 11:12:12 +0200 Subject: [PATCH] selenium: the wallet can select amounts from the bank's dropdown --- selenium/test.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/selenium/test.py b/selenium/test.py index d697f73c8..b2bece4e0 100644 --- a/selenium/test.py +++ b/selenium/test.py @@ -145,7 +145,7 @@ def register(client): logger.error('User not registered at bank') -def withdraw(client): +def withdraw(client, amount_value=None): """Register and withdraw (1) KUDOS for a fresh user""" register(client) # trigger withdrawal button @@ -154,6 +154,13 @@ def withdraw(client): except NoSuchElementException: logger.error("Selecting exchange impossible") sys.exit(1) + if amount_value: + xpath = "//select/option[@value='" + str(amount_value) + "']" + try: + client.find_element(By.XPATH, xpath) + except NoSuchElementException: + logger.error("value '" + str(amount_value) + "' is not offered by this bank to withdraw, please adapt it") + sys.exit(1) button.click() location = client.execute_script("return document.location.href") client.get(location) @@ -198,7 +205,7 @@ args = parser.parse_args() ret = client_setup(args) client = ret['client'] client.implicitly_wait(10) -withdraw(client) +withdraw(client, 11) make_donation(client) buy_article(client) logger.info("Test passed")