diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-04-25 16:24:00 +0200 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-04-25 16:24:00 +0200 |
commit | c5a8773b175e29ec5b7da003596488180ec52a7d (patch) | |
tree | 897a4b383bc467305eea38d94a3ee3e99d723bbd | |
parent | 52707f87e7faf1ae985c88b6787b688d121b538b (diff) | |
download | wallet-core-c5a8773b175e29ec5b7da003596488180ec52a7d.tar.xz |
selenium skeleton and README
-rw-r--r-- | selenium/README | 7 | ||||
-rw-r--r-- | selenium/wallet-test.py | 32 |
2 files changed, 39 insertions, 0 deletions
diff --git a/selenium/README b/selenium/README new file mode 100644 index 000000000..de99e6610 --- /dev/null +++ b/selenium/README @@ -0,0 +1,7 @@ +Directory containing testscases for testing the wallet with Selenium ChromeDriver. + +[1] Contains the ChromeDriver Pythonic documentation +[2] Tells which fields (and which values) the 'loggingPrefs' capability expects + +[1] http://seleniumhq.github.io/selenium/docs/api/py/index.html +[2] https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities#loggingpreferences-json-object diff --git a/selenium/wallet-test.py b/selenium/wallet-test.py new file mode 100644 index 000000000..0725539a1 --- /dev/null +++ b/selenium/wallet-test.py @@ -0,0 +1,32 @@ +from selenium import webdriver +import time + +co = webdriver.ChromeOptions() +co.add_argument("load-extension=/home/marcello/Taler/wallet-webex") +cap = webdriver.DesiredCapabilities.CHROME.copy() +cap['loggingPrefs'] = {'driver': 'INFO', 'browser': 'INFO'} +client = webdriver.Chrome(chrome_options=co, desired_capabilities=cap) +client.get('https://taler.net') +listener = """\ + document.addEventListener('taler-id', function(evt){ + window['extId'] = evt.detail.id; + }); + evt = new CustomEvent('taler-query-id'); + document.dispatchEvent(evt); + """ +client.execute_script(listener) +poll = """\ + if(window.extId) + return window.extId; + else return false; + """ +# TODO intelligent poller needed +time.sleep(1) +ext_id = client.execute_script(poll) + +labels = ['balance'] +for l in labels: + client.get('chrome-extensio://' + ext_id + '/popup/popup.html#/' + l) +for log_type in ['browser']: + for log in client.get_log(log_type): + print(log['level'] + ': ' + log['message']) |