From e00964ccf7a556895784ed05f0fdec954f5558d5 Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Thu, 1 Dec 2016 10:54:33 +1100 Subject: 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 --- tests.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'tests.js') 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(); var url = 'src/index.html'; var testMaxTime = 10000; +page.viewportSize = { + width: 1024, + height: 720 +}; + page.onResourceError = function(e) { console.log("Error loading " + e.url); phantom.exit(); @@ -3042,6 +3047,45 @@ page.open(url, function(status) { }); }, +// Github issue 35 +// https://github.com/iancoleman/bip39/issues/35 +// QR Code support +function() { +page.open(url, function(status) { + // use entropy + page.evaluate(function() { + $(".generate").click(); + }); + waitForGenerate(function() { + var p = page.evaluate(function() { + // get position of mnemonic element + return $(".phrase").offset(); + }); + p.top = Math.ceil(p.top); + p.left = Math.ceil(p.left); + // check the qr code shows + page.sendEvent("mousemove", p.left+4, p.top+4); + var qrShowing = page.evaluate(function() { + return $(".qr-container").find("canvas").length > 0; + }); + if (!qrShowing) { + console.log("QR Code does not show"); + fail(); + } + // check the qr code hides + page.sendEvent("mousemove", p.left-4, p.top-4); + var qrHidden = page.evaluate(function() { + return $(".qr-container").find("canvas").length == 0; + }); + if (!qrHidden) { + console.log("QR Code does not hide"); + fail(); + } + next(); + }); +}); +}, + // If you wish to add more tests, do so here... -- cgit v1.2.3