summaryrefslogtreecommitdiff
path: root/selenium
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2016-05-03 15:05:58 +0200
committerMarcello Stanisci <marcello.stanisci@inria.fr>2016-05-03 15:05:58 +0200
commitdc83b85e85110eb7ed2e96ecdbcbb90b5a5620aa (patch)
treeb6f440717cb00925d5f80902073aa85f325f8ad6 /selenium
parent048e4f8dc9cfca81907ff6562125a92f9661882c (diff)
downloadwallet-core-dc83b85e85110eb7ed2e96ecdbcbb90b5a5620aa.tar.gz
wallet-core-dc83b85e85110eb7ed2e96ecdbcbb90b5a5620aa.tar.bz2
wallet-core-dc83b85e85110eb7ed2e96ecdbcbb90b5a5620aa.zip
selenium: adding function to switch between 'test' and 'demo' base URLs,
used to introduce currency mismatches when testing errors management
Diffstat (limited to 'selenium')
-rw-r--r--selenium/test.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/selenium/test.py b/selenium/test.py
index 3d46585bf..14140e953 100644
--- a/selenium/test.py
+++ b/selenium/test.py
@@ -17,9 +17,10 @@ import time
import logging
import sys
import os
+import re
logger = logging.getLogger(__name__)
-taler_baseurl = os.environ['TALER_BASEURL'] if 'TALER_BASEURL' in os.environ else 'https://test.taler.net/'
+taler_baseurl = os.environ.get('TALER_BASEURL', 'https://test.taler.net/')
def client_setup(args):
"""Return a dict containing the driver and the extension's id"""
@@ -52,6 +53,17 @@ def is_error(client):
return False
+def switch_base():
+ """If 'test' is in TALER_BASEURL, then make it be 'demo', and viceversa.
+ Used to trig currency mismatch errors. It assumes that the https://{test,demo}.taler.net
+ layout is being used"""
+ global taler_baseurl
+ url = parse.urlparse(taler_baseurl)
+ if url[1] == 'test.taler.net':
+ taler_baseurl = "https://demo.taler.net"
+ if url[1] == 'demo.taler.net':
+ taler_baseurl = "https://test.taler.net"
+
def make_donation(client, amount_value=None):
"""Make donation at shop.test.taler.net. Assume the wallet has coins"""
client.get(parse.urljoin(taler_baseurl, "shop"))
@@ -208,6 +220,7 @@ ret = client_setup(args)
client = ret['client']
client.implicitly_wait(10)
withdraw(client, 10)
+switch_base() # inducing error
make_donation(client, 6.0)
buy_article(client)
logger.info("Test passed")