aboutsummaryrefslogtreecommitdiff
path: root/selenium
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2016-04-25 16:24:00 +0200
committerMarcello Stanisci <marcello.stanisci@inria.fr>2016-04-25 16:24:00 +0200
commitc5a8773b175e29ec5b7da003596488180ec52a7d (patch)
tree897a4b383bc467305eea38d94a3ee3e99d723bbd /selenium
parent52707f87e7faf1ae985c88b6787b688d121b538b (diff)
downloadwallet-core-c5a8773b175e29ec5b7da003596488180ec52a7d.tar.xz
selenium skeleton and README
Diffstat (limited to 'selenium')
-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'])