aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--selenium/README7
-rw-r--r--selenium/wallet-test.py32
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'])