aboutsummaryrefslogtreecommitdiff
path: root/tests.js
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2016-12-01 10:54:33 +1100
committerIan Coleman <coleman.ian@gmail.com>2016-12-01 11:25:36 +1100
commite00964ccf7a556895784ed05f0fdec954f5558d5 (patch)
treee7790593e2309e494eb19ccc3e34bbb74b7188e7 /tests.js
parentfc7c248fafef4ba2aecf9dcf4718b3d4c91d94b0 (diff)
downloadBIP39-e00964ccf7a556895784ed05f0fdec954f5558d5.tar.gz
BIP39-e00964ccf7a556895784ed05f0fdec954f5558d5.tar.zst
BIP39-e00964ccf7a556895784ed05f0fdec954f5558d5.zip
QR code shown on hover for certain bits of data
QR code shown for: * mnemonic * seed * root key * derived extended private key * derived extended public key * addresses * public keys * private keys
Diffstat (limited to 'tests.js')
-rw-r--r--tests.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests.js b/tests.js
index 843078f..10d13a3 100644
--- a/tests.js
+++ b/tests.js
@@ -6,6 +6,11 @@ var page = require('webpage').create();
6var url = 'src/index.html'; 6var url = 'src/index.html';
7var testMaxTime = 10000; 7var testMaxTime = 10000;
8 8
9page.viewportSize = {
10 width: 1024,
11 height: 720
12};
13
9page.onResourceError = function(e) { 14page.onResourceError = function(e) {
10 console.log("Error loading " + e.url); 15 console.log("Error loading " + e.url);
11 phantom.exit(); 16 phantom.exit();
@@ -3042,6 +3047,45 @@ page.open(url, function(status) {
3042}); 3047});
3043}, 3048},
3044 3049
3050// Github issue 35
3051// https://github.com/iancoleman/bip39/issues/35
3052// QR Code support
3053function() {
3054page.open(url, function(status) {
3055 // use entropy
3056 page.evaluate(function() {
3057 $(".generate").click();
3058 });
3059 waitForGenerate(function() {
3060 var p = page.evaluate(function() {
3061 // get position of mnemonic element
3062 return $(".phrase").offset();
3063 });
3064 p.top = Math.ceil(p.top);
3065 p.left = Math.ceil(p.left);
3066 // check the qr code shows
3067 page.sendEvent("mousemove", p.left+4, p.top+4);
3068 var qrShowing = page.evaluate(function() {
3069 return $(".qr-container").find("canvas").length > 0;
3070 });
3071 if (!qrShowing) {
3072 console.log("QR Code does not show");
3073 fail();
3074 }
3075 // check the qr code hides
3076 page.sendEvent("mousemove", p.left-4, p.top-4);
3077 var qrHidden = page.evaluate(function() {
3078 return $(".qr-container").find("canvas").length == 0;
3079 });
3080 if (!qrHidden) {
3081 console.log("QR Code does not hide");
3082 fail();
3083 }
3084 next();
3085 });
3086});
3087},
3088
3045 3089
3046// If you wish to add more tests, do so here... 3090// If you wish to add more tests, do so here...
3047 3091