gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-wallet-webex] branch master updated: Adapt screen sc


From: gnunet
Subject: [GNUnet-SVN] [taler-wallet-webex] branch master updated: Adapt screen scraped withdrawing to new bank interface.
Date: Tue, 27 Jun 2017 22:54:23 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository wallet-webex.

The following commit(s) were added to refs/heads/master by this push:
     new 8fc959c3 Adapt screen scraped withdrawing to new bank interface.
8fc959c3 is described below

commit 8fc959c3fad3eed96bb4785969c792b98d553e5a
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Jun 27 22:53:37 2017 +0200

    Adapt screen scraped withdrawing to new bank interface.
---
 selenium/withdraw_buy.py | 38 +++++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/selenium/withdraw_buy.py b/selenium/withdraw_buy.py
index abcb27ce..13fb67b3 100644
--- a/selenium/withdraw_buy.py
+++ b/selenium/withdraw_buy.py
@@ -45,7 +45,9 @@ def client_setup(args):
     if args.remote:
         client = webdriver.Remote(desired_capabilities=cap, 
command_executor=args.remote)
     else:
+        logger.info("About to get chromed")
         client = webdriver.Chrome(desired_capabilities=cap)
+        logger.info("Got chromed")
     client.get('https://taler.net')
 
     listener = """\
@@ -85,7 +87,7 @@ def switch_base():
         taler_baseurl = "https://test.taler.net";
 
 def make_donation(client, amount_menuentry=None):
-    """Make donation at shop.test.taler.net. Assume the wallet has coins.
+    """Make donation at donations.test.taler.net. Assume the wallet has coins.
     Just donate to the default receiver"""
     client.get(parse.urljoin(taler_baseurl, "donations"))
     try:
@@ -142,7 +144,7 @@ def check_article(client, title):
 
 
 def buy_article(client, title, fulfillment_url=None):
-    """Buy article at blog.test.taler.net. Assume the wallet has coins.
+    """Buy article at shop.test.taler.net. Assume the wallet has coins.
        Return False if some error occurs, the fulfillment URL otherwise"""
     if fulfillment_url:
         client.get(fulfillment_url)
@@ -157,10 +159,10 @@ def buy_article(client, title, fulfillment_url=None):
         teaser = wait.until(EC.element_to_be_clickable((By.XPATH, 
"//h3/address@hidden"/essay/%s\"]" % title)))
         
         logger.info("Scrolling to article position: %s", teaser.location['y'])
-        client.execute_script("window.scrollBy(0, %s)" % teaser.location['y'])
+        client.execute_script("window.scrollBy(30, %s)" % teaser.location['y'])
         teaser.click()
-    except (NoSuchElementException, TimeoutException):
-        logger.error('Could not choose "Foreword" chapter on blog')
+    except (NoSuchElementException, TimeoutException) as e:
+        logger.error("Could not choose chapter '%s'" % title)
         client.quit()
         display.stop()
         sys.exit(1)
@@ -257,9 +259,10 @@ def withdraw(client, amount_menuentry=None):
     # Confirm exchange (in-wallet page)
     try:
         logger.info("Polling for the button")
-        mybutton = client.find_element(By.XPATH, "//button[1]")
-        logger.info("Found button '%s'" % mybutton.text)
-        button = wait.until(EC.element_to_be_clickable((By.XPATH, 
"//button[1]")))
+        exchange_input = client.find_element(By.XPATH, 
"//address@hidden'url']")
+        # Bad: see #5095
+        exchange_input.send_keys("https://exchange.test.taler.net/";)
+        accept_exchange = wait.until(EC.element_to_be_clickable((By.XPATH, 
"//button[1]")))
     except TimeoutException:
         logger.error("Could not confirm exchange")
         client.quit()
@@ -267,7 +270,16 @@ def withdraw(client, amount_menuentry=None):
         sys.exit(1)
     # This click returns the captcha page (put wait?)
     logger.info("About to confirm exchange")
-    button.click()
+    accept_exchange.click()
+    try:
+        accept_fees = wait.until(EC.element_to_be_clickable((By.XPATH, 
"//button[1]")))
+    except TimeoutException:
+        logger.error("Could not accept fees")
+        client.quit()
+        display.stop()
+        sys.exit(1)
+    accept_fees.click()
+    # Properly wait for the next page to be loaded?
     try:
         answer = client.find_element(By.XPATH, "//address@hidden'pin_0']")
         question = client.find_element(By.XPATH, 
"//address@hidden'captcha-question']/div")
@@ -311,16 +323,16 @@ ret = client_setup(args)
 logger.info("Creating the browser driver..")
 client = ret['client']
 client.implicitly_wait(10)
-withdraw(client, "10.00 PUDOS")
-logger.info("Making donations..")
-# FIXME: wait for coins more appropriately
+withdraw(client, "10.00 TESTKUDOS")
+# FIXME: wait for coins appropriately
 time.sleep(2)
-make_donation(client, "1.0 PUDOS")
 logger.info("Buying article..")
 fulfillment_url_25 = buy_article(client, "25._The_Danger_of_Software_Patents")
 fulfillment_url_41 = buy_article(client, "41._Avoiding_Ruinous_Compromises")
 client.delete_all_cookies()
 ret = buy_article(client, "25._The_Danger_of_Software_Patents", 
fulfillment_url_25)
+logger.info("Donating..")
+make_donation(client, "1.0 TESTKUDOS")
 logger.info("Bookmarked purchase: '%s'" % ret)
 logger.info("Test passed")
 client.quit()

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]