]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/blob - tests/spec/tests.js
Fix ethercore test
[perso/Immae/Projets/Cryptomonnaies/BIP39.git] / tests / spec / tests.js
1 // Usage:
2 // cd /path/to/repo/tests
3 // jasmine spec/tests.js
4 //
5 // Dependencies:
6 // nodejs
7 // selenium
8 // jasmine
9 // see https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode#Automated_testing_with_headless_mode
10
11 // USER SPECIFIED OPTIONS
12 var browser = process.env.BROWSER; //"firefox"; // or "chrome"
13 if (!browser) {
14 console.log("Browser can be set via environment variable, eg");
15 console.log("BROWSER=firefox jasmine spec/tests.js");
16 console.log("Options for BROWSER are firefox chrome");
17 console.log("Using default browser: chrome");
18 browser = "chrome";
19 }
20 else {
21 console.log("Using browser: " + browser);
22 }
23
24 // Globals
25
26 var webdriver = require('selenium-webdriver');
27 var By = webdriver.By;
28 var Key = webdriver.Key;
29 var until = webdriver.until;
30 var newDriver = null;
31 var driver = null;
32 // Delays in ms
33 var generateDelay = 1500;
34 var feedbackDelay = 500;
35 var entropyFeedbackDelay = 500;
36 var bip38delay = 15000;
37
38 // url uses file:// scheme
39 var path = require('path')
40 var parentDir = path.resolve(process.cwd(), '..', 'src', 'index.html');
41 var url = "file://" + parentDir;
42 if (browser == "firefox") {
43 // TODO loading local html in firefox is broken
44 console.log("Loading local html in firefox is broken, see https://stackoverflow.com/q/46367054");
45 console.log("You must run a server in this case, ie do this:");
46 console.log("$ cd /path/to/bip39/src");
47 console.log("$ python -m http.server");
48 url = "http://localhost:8000";
49 }
50
51 // Variables dependent on specific browser selection
52
53 if (browser == "firefox") {
54 var firefox = require('selenium-webdriver/firefox');
55 var binary = new firefox.Binary(firefox.Channel.NIGHTLY);
56 binary.addArguments("-headless");
57 newDriver = function() {
58 return new webdriver.Builder()
59 .forBrowser('firefox')
60 .setFirefoxOptions(new firefox.Options().setBinary(binary))
61 .build();
62 }
63 }
64 else if (browser == "chrome") {
65 var chrome = require('selenium-webdriver/chrome');
66 newDriver = function() {
67 return new webdriver.Builder()
68 .forBrowser('chrome')
69 .setChromeOptions(new chrome.Options().addArguments("headless"))
70 .build();
71 }
72 }
73
74 // Helper functions
75
76 function testNetwork(done, params, comparePub = false) {
77 var phrase = params.phrase || 'abandon abandon ability';
78 driver.findElement(By.css('.phrase'))
79 .sendKeys(phrase);
80 selectNetwork(params.selectText);
81 driver.sleep(generateDelay).then(function() {
82 if (!comparePub) {
83 getFirstAddress(function(address) {
84 expect(address).toBe(params.firstAddress);
85 done();
86 });
87 } else {
88 getFirstPublicKey(function(pubkey) {
89 expect(pubkey).toBe(params.firstPubKey);
90 done();
91 });
92 }
93 });
94 }
95
96 function getFirstRowValue(handler, selector) {
97 driver.findElements(By.css(selector))
98 .then(function(els) {
99 els[0].getText()
100 .then(handler);
101 })
102 }
103
104 function getFirstAddress(handler) {
105 getFirstRowValue(handler, ".address");
106 }
107
108 function getFirstPublicKey(handler) {
109 getFirstRowValue(handler, ".pubkey");
110 }
111
112 function getFirstPath(handler) {
113 getFirstRowValue(handler, ".index");
114 }
115
116 function testColumnValuesAreInvisible(done, columnClassName) {
117 var selector = "." + columnClassName + " span";
118 driver.findElements(By.css(selector))
119 .then(function(els) {
120 els[0].getAttribute("class")
121 .then(function(classes) {
122 expect(classes).toContain("invisible");
123 done();
124 });
125 })
126 }
127
128 function testRowsAreInCorrectOrder(done) {
129 driver.findElements(By.css('.index'))
130 .then(function(els) {
131 var testRowAtIndex = function(i) {
132 if (i >= els.length) {
133 done();
134 }
135 else {
136 els[i].getText()
137 .then(function(actualPath) {
138 var noHardened = actualPath.replace(/'/g, "");
139 var pathBits = noHardened.split("/")
140 var lastBit = pathBits[pathBits.length-1];
141 var actualIndex = parseInt(lastBit);
142 expect(actualIndex).toBe(i);
143 testRowAtIndex(i+1);
144 });
145 }
146 }
147 testRowAtIndex(0);
148 });
149 }
150
151 function selectNetwork(name) {
152 driver.executeScript(function() {
153 var selectText = arguments[0];
154 $(".network option[selected]").removeAttr("selected");
155 $(".network option").filter(function(i,e) {
156 return $(e).html() == selectText;
157 }).prop("selected", true);
158 $(".network").trigger("change");
159 }, name);
160 }
161
162 function testEntropyType(done, entropyText, entropyTypeUnsafe) {
163 // entropy type is compiled into regexp so needs escaping
164 // see https://stackoverflow.com/a/2593661
165 var entropyType = (entropyTypeUnsafe+'').replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
166 driver.findElement(By.css('.use-entropy'))
167 .click();
168 driver.findElement(By.css('.entropy'))
169 .sendKeys(entropyText);
170 driver.sleep(generateDelay).then(function() {
171 driver.findElement(By.css('.entropy-container'))
172 .getText()
173 .then(function(text) {
174 var re = new RegExp("Entropy Type\\s+" + entropyType);
175 expect(text).toMatch(re);
176 done();
177 });
178 });
179 }
180
181 function testEntropyBits(done, entropyText, entropyBits) {
182 driver.findElement(By.css('.use-entropy'))
183 .click();
184 driver.findElement(By.css('.entropy'))
185 .sendKeys(entropyText);
186 driver.sleep(generateDelay).then(function() {
187 driver.findElement(By.css('.entropy-container'))
188 .getText()
189 .then(function(text) {
190 var re = new RegExp("Total Bits\\s+" + entropyBits);
191 expect(text).toMatch(re);
192 done();
193 });
194 });
195 }
196
197 function testEntropyFeedback(done, entropyDetail) {
198 // entropy type is compiled into regexp so needs escaping
199 // see https://stackoverflow.com/a/2593661
200 if ("type" in entropyDetail) {
201 entropyDetail.type = (entropyDetail.type+'').replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
202 }
203 driver.findElement(By.css('.use-entropy'))
204 .click();
205 driver.findElement(By.css('.entropy'))
206 .sendKeys(entropyDetail.entropy);
207 driver.sleep(entropyFeedbackDelay).then(function() {
208 driver.findElement(By.css('.entropy-container'))
209 .getText()
210 .then(function(text) {
211 driver.findElement(By.css('.phrase'))
212 .getAttribute("value")
213 .then(function(phrase) {
214 if ("filtered" in entropyDetail) {
215 var key = "Filtered Entropy";
216 var value = entropyDetail.filtered;
217 var reText = key + "\\s+" + value;
218 var re = new RegExp(reText);
219 expect(text).toMatch(re);
220 }
221 if ("type" in entropyDetail) {
222 var key = "Entropy Type";
223 var value = entropyDetail.type;
224 var reText = key + "\\s+" + value;
225 var re = new RegExp(reText);
226 expect(text).toMatch(re);
227 }
228 if ("events" in entropyDetail) {
229 var key = "Event Count";
230 var value = entropyDetail.events;
231 var reText = key + "\\s+" + value;
232 var re = new RegExp(reText);
233 expect(text).toMatch(re);
234 }
235 if ("bits" in entropyDetail) {
236 var key = "Total Bits";
237 var value = entropyDetail.bits;
238 var reText = key + "\\s+" + value;
239 var re = new RegExp(reText);
240 expect(text).toMatch(re);
241 }
242 if ("bitsPerEvent" in entropyDetail) {
243 var key = "Bits Per Event";
244 var value = entropyDetail.bitsPerEvent;
245 var reText = key + "\\s+" + value;
246 var re = new RegExp(reText);
247 expect(text).toMatch(re);
248 }
249 if ("words" in entropyDetail) {
250 var actualWords = phrase.split(/\s+/)
251 .filter(function(w) { return w.length > 0 })
252 .length;
253 expect(actualWords).toBe(entropyDetail.words);
254 }
255 if ("strength" in entropyDetail) {
256 var key = "Time To Crack";
257 var value = entropyDetail.strength;
258 var reText = key + "\\s+" + value;
259 var re = new RegExp(reText);
260 expect(text).toMatch(re);
261 }
262 done();
263 });
264 });
265 });
266 }
267
268 function testClientSelect(done, params) {
269 // set mnemonic and select bip32 tab
270 driver.findElement(By.css('#bip32-tab a'))
271 .click()
272 driver.findElement(By.css('.phrase'))
273 .sendKeys("abandon abandon ability");
274 driver.sleep(generateDelay).then(function() {
275 // BITCOIN CORE
276 // set bip32 client to bitcoin core
277 driver.executeScript(function() {
278 $("#bip32-client").val(arguments[0]).trigger("change");
279 }, params.selectValue);
280 driver.sleep(generateDelay).then(function() {
281 // check the derivation path is correct
282 driver.findElement(By.css("#bip32-path"))
283 .getAttribute("value")
284 .then(function(path) {
285 expect(path).toBe(params.bip32path);
286 // check hardened addresses is selected
287 driver.findElement(By.css(".hardened-addresses"))
288 .getAttribute("checked")
289 .then(function(isChecked) {
290 expect(isChecked).toBe(params.useHardenedAddresses);
291 // check input is readonly
292 driver.findElement(By.css("#bip32-path"))
293 .getAttribute("readonly")
294 .then(function(isReadonly) {
295 expect(isReadonly).toBe("true");
296 done();
297 });
298 });
299 });
300 });
301 });
302 }
303
304 // Tests
305
306 describe('BIP39 Tool Tests', function() {
307
308 beforeEach(function(done) {
309 driver = newDriver();
310 driver.get(url).then(done);
311 });
312
313 // Close the website after each test is run (so that it is opened fresh each time)
314 afterEach(function(done) {
315 driver.quit().then(done);
316 });
317
318 // BEGIN TESTS
319
320 // Page initially loads with blank phrase
321 it('Should load the page', function(done) {
322 driver.findElement(By.css('.phrase'))
323 .getAttribute('value').then(function(value) {
324 expect(value).toBe('');
325 done();
326 });
327 });
328
329 // Page has text
330 it('Should have text on the page', function(done) {
331 driver.findElement(By.css('body'))
332 .getText()
333 .then(function(text) {
334 var textToFind = "You can enter an existing BIP39 mnemonic";
335 expect(text).toContain(textToFind);
336 done();
337 });
338 });
339
340 // Entering mnemonic generates addresses
341 it('Should have a list of addresses', function(done) {
342 driver.findElement(By.css('.phrase'))
343 .sendKeys('abandon abandon ability');
344 driver.sleep(generateDelay).then(function() {
345 driver.findElements(By.css('.address'))
346 .then(function(els) {
347 expect(els.length).toBe(20);
348 done();
349 })
350 });
351 });
352
353 // Generate button generates random mnemonic
354 it('Should be able to generate a random mnemonic', function(done) {
355 // initial phrase is blank
356 driver.findElement(By.css('.phrase'))
357 .getAttribute("value")
358 .then(function(phrase) {
359 expect(phrase.length).toBe(0);
360 // press generate
361 driver.findElement(By.css('.generate')).click();
362 driver.sleep(generateDelay).then(function() {
363 // new phrase is not blank
364 driver.findElement(By.css('.phrase'))
365 .getAttribute("value")
366 .then(function(phrase) {
367 expect(phrase.length).toBeGreaterThan(0);
368 done();
369 });
370 });
371 });
372 });
373
374 // Mnemonic length can be customized
375 it('Should allow custom length mnemonics', function(done) {
376 // set strength to 6
377 driver.executeScript(function() {
378 $(".strength option[selected]").removeAttr("selected");
379 $(".strength option[value=6]").prop("selected", true);
380 });
381 driver.findElement(By.css('.generate')).click();
382 driver.sleep(generateDelay).then(function() {
383 driver.findElement(By.css('.phrase'))
384 .getAttribute("value")
385 .then(function(phrase) {
386 var words = phrase.split(" ");
387 expect(words.length).toBe(6);
388 done();
389 });
390 });
391 });
392
393 // Passphrase can be set
394 it('Allows a passphrase to be set', function(done) {
395 driver.findElement(By.css('.phrase'))
396 .sendKeys('abandon abandon ability');
397 driver.findElement(By.css('.passphrase'))
398 .sendKeys('secure_passphrase');
399 driver.sleep(generateDelay).then(function() {
400 getFirstAddress(function(address) {
401 expect(address).toBe("15pJzUWPGzR7avffV9nY5by4PSgSKG9rba");
402 done();
403 })
404 });
405 });
406
407 // Network can be set to networks other than bitcoin
408 it('Allows selection of bitcoin testnet', function(done) {
409 var params = {
410 selectText: "BTC - Bitcoin Testnet",
411 firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi",
412 };
413 testNetwork(done, params);
414 });
415 it('Allows selection of bitcoin regtest', function(done) {
416 var params = {
417 selectText: "BTC - Bitcoin RegTest",
418 firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi",
419 };
420 testNetwork(done, params);
421 });
422 it('Allows selection of litecoin', function(done) {
423 var params = {
424 selectText: "LTC - Litecoin",
425 firstAddress: "LQ4XU8RX2ULPmPq9FcUHdVmPVchP9nwXdn",
426 };
427 testNetwork(done, params);
428 });
429 it('Allows selection of litecoin testnet', function(done) {
430 var params = {
431 selectText: "LTCt - Litecoin Testnet",
432 firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi",
433 };
434 testNetwork(done, params);
435 });
436 it('Allows selection of ripple', function(done) {
437 var params = {
438 selectText: "XRP - Ripple",
439 firstAddress: "rLTFnqbmCVPGx6VfaygdtuKWJgcN4v1zRS",
440 phrase: "ill clump only blind unit burden thing track silver cloth review awake useful craft whale all satisfy else trophy sunset walk vanish hope valve",
441 };
442 testNetwork(done, params);
443 });
444 it('Allows selection of casinocoin', function(done) {
445 var params = {
446 selectText: "CSC - CasinoCoin",
447 firstAddress: "c3P5EUb27Pzk9dcGt4s7zQDQj4sC6Y81mT",
448 phrase: "ill clump only blind unit burden thing track silver cloth review awake useful craft whale all satisfy else trophy sunset walk vanish hope valve",
449 };
450 testNetwork(done, params);
451 });
452 it('Allows selection of dogecoin', function(done) {
453 var params = {
454 selectText: "DOGE - Dogecoin",
455 firstAddress: "DPQH2AtuzkVSG6ovjKk4jbUmZ6iXLpgbJA",
456 };
457 testNetwork(done, params);
458 });
459 it('Allows selection of dogecoin testnet', function(done) {
460 var params = {
461 selectText: "DOGEt - Dogecoin Testnet",
462 firstAddress: "niHnSJKHdwDyDxRMLBJrtNqpvHEsAFWe6B",
463 };
464 testNetwork(done, params);
465 });
466 it('Allows selection of denarius', function(done) {
467 var params = {
468 selectText: "DNR - Denarius",
469 firstAddress: "DFdFMVUMzU9xX88EywXvAGwjiwpxyh9vKb",
470 };
471 testNetwork(done, params);
472 });
473 it('Allows selection of shadowcash', function(done) {
474 var params = {
475 selectText: "SDC - ShadowCash",
476 firstAddress: "SiSZtfYAXEFvMm3XM8hmtkGDyViRwErtCG",
477 };
478 testNetwork(done, params);
479 });
480 it('Allows selection of shadowcash testnet', function(done) {
481 var params = {
482 selectText: "SDC - ShadowCash Testnet",
483 firstAddress: "tM2EDpVKaTiEg2NZg3yKg8eqjLr55BErHe",
484 };
485 testNetwork(done, params);
486 });
487 it('Allows selection of viacoin', function(done) {
488 var params = {
489 selectText: "VIA - Viacoin",
490 firstAddress: "Vq9Eq4N5SQnjqZvxtxzo7hZPW5XnyJsmXT",
491 };
492 testNetwork(done, params);
493 });
494 it('Allows selection of viacoin testnet', function(done) {
495 var params = {
496 selectText: "VIA - Viacoin Testnet",
497 firstAddress: "tM2EDpVKaTiEg2NZg3yKg8eqjLr55BErHe",
498 };
499 testNetwork(done, params);
500 });
501 it('Allows selection of jumbucks', function(done) {
502 var params = {
503 selectText: "JBS - Jumbucks",
504 firstAddress: "JLEXccwDXADK4RxBPkRez7mqsHVoJBEUew",
505 };
506 testNetwork(done, params);
507 });
508 it('Allows selection of clam', function(done) {
509 var params = {
510 selectText: "CLAM - Clams",
511 firstAddress: "xCp4sakjVx4pUAZ6cBCtuin8Ddb6U1sk9y",
512 };
513 testNetwork(done, params);
514 });
515 it('Allows selection of crown', function(done) {
516 var params = {
517 selectText: "CRW - Crown (Legacy)",
518 firstAddress: "18pWSwSUAQdiwMHUfFZB1fM2xue9X1FqE5",
519 };
520 testNetwork(done, params);
521 });
522 it('Allows selection of crown', function(done) {
523 var params = {
524 selectText: "CRW - Crown",
525 firstAddress: "CRWKnVmVhvH1KWTYe6sq8xV4dFGcFpBEEkPQ",
526 };
527 testNetwork(done, params);
528 });
529 it('Allows selection of dash', function(done) {
530 var params = {
531 selectText: "DASH - Dash",
532 firstAddress: "XdbhtMuGsPSkE6bPdNTHoFSszQKmK4S5LT",
533 };
534 testNetwork(done, params);
535 });
536 it('Allows selection of dash testnet', function(done) {
537 var params = {
538 selectText: "DASH - Dash Testnet",
539 firstAddress: "yaR52EN4oojdJfBgzWJTymC4uuCLPT29Gw",
540 };
541 testNetwork(done, params);
542 });
543 it('Allows selection of game', function(done) {
544 var params = {
545 selectText: "GAME - GameCredits",
546 firstAddress: "GSMY9bAp36cMR4zyT4uGVS7GFjpdXbao5Q",
547 };
548 testNetwork(done, params);
549 });
550 it('Allows selection of komodo', function(done) {
551 var params = {
552 selectText: "KMD - Komodo",
553 firstAddress: "RMPPzJwAjPVZZAwJvXivHJGGjdCx6WBD2t",
554 };
555 testNetwork(done, params);
556 });
557 it('Allows selection of namecoin', function(done) {
558 var params = {
559 selectText: "NMC - Namecoin",
560 firstAddress: "Mw2vK2Bvex1yYtYF6sfbEg2YGoUc98YUD2",
561 };
562 testNetwork(done, params);
563 });
564 it('Allows selection of onixcoin', function(done) {
565 var params = {
566 selectText: "ONX - Onixcoin",
567 firstAddress: "XGwMqddeKjT3ddgX73QokjVbCL3aK6Yxfk",
568 };
569 testNetwork(done, params);
570 });
571 it('Allows selection of lkrcoin', function(done) {
572 var params = {
573 selectText: "LKR - Lkrcoin",
574 firstAddress: "LfbT296e7AEEnn4bYDbL535Nd8P9g98CdJ",
575 };
576 testNetwork(done, params);
577 });
578 it('Allows selection of bolivarcoin', function(done) {
579 var params = {
580 selectText: "BOLI - Bolivarcoin",
581 firstAddress: "bbKzCAUR7hZ3nqfffy7VgrSz8LmAP3S5mK",
582 };
583 testNetwork(done, params);
584 });
585 it('Allows selection of peercoin', function(done) {
586 var params = {
587 selectText: "PPC - Peercoin",
588 firstAddress: "PVAiioTaK2eDHSEo3tppT9AVdBYqxRTBAm",
589 };
590 testNetwork(done, params);
591 });
592 it('Allows selection of ethereum', function(done) {
593 var params = {
594 selectText: "ETH - Ethereum",
595 firstAddress: "0xe5815d5902Ad612d49283DEdEc02100Bd44C2772",
596 };
597 testNetwork(done, params);
598 });
599 it('Allows selection of slimcoin', function(done) {
600 var params = {
601 selectText: "SLM - Slimcoin",
602 firstAddress: "SNzPi1CafHFm3WWjRo43aMgiaEEj3ogjww",
603 };
604 testNetwork(done, params);
605 });
606 it('Allows selection of slimcoin testnet', function(done) {
607 var params = {
608 selectText: "SLM - Slimcoin Testnet",
609 firstAddress: "n3nMgWufTek5QQAr6uwMhg5xbzj8xqc4Dq",
610 };
611 testNetwork(done, params);
612 });
613 it('Allows selection of bitcoin cash', function(done) {
614 var params = {
615 selectText: "BCH - Bitcoin Cash",
616 firstAddress: "bitcoincash:qzlquk7w4hkudxypl4fgv8x279r754dkvur7jpcsps",
617 };
618 testNetwork(done, params);
619 });
620
621 it('Allows selection of simpleledger(SLP)', function(done) {
622 var params = {
623 selectText: "SLP - Simple Ledger Protocol",
624 firstAddress: "simpleledger:qrtffz6ajfsn74gpur7y3epjquz42pvww5acewqmre",
625 };
626 testNetwork(done, params);
627 });
628
629 it('Allows selection of myriadcoin', function(done) {
630 var params = {
631 selectText: "XMY - Myriadcoin",
632 firstAddress: "MJEswvRR46wh9BoiVj9DzKYMBkCramhoBV",
633 };
634 testNetwork(done, params);
635 });
636 it('Allows selection of pivx', function(done) {
637 var params = {
638 selectText: "PIVX - PIVX",
639 firstAddress: "DBxgT7faCuno7jmtKuu6KWCiwqsVPqh1tS",
640 };
641 testNetwork(done, params);
642 });
643 it('Allows selection of pivx testnet', function(done) {
644 var params = {
645 selectText: "PIVX - PIVX Testnet",
646 firstAddress: "yB5U384n6dGkVE3by5y9VdvHHPwPg68fQj",
647 };
648 testNetwork(done, params);
649 });
650 it('Allows selection of maza', function(done) {
651 var params = {
652 selectText: "MAZA - Maza",
653 firstAddress: "MGW4Bmi2NEm4PxSjgeFwhP9vg18JHoRnfw",
654 };
655 testNetwork(done, params);
656 });
657 it('Allows selection of FIX', function(done) {
658 var params = {
659 selectText: "FIX - FIX",
660 firstAddress: "FS5MEU8fs5dUvsaSCSusV8RQtC8j2h3JEh",
661 };
662 testNetwork(done, params);
663 });
664 it('Allows selection of FIX testnet', function(done) {
665 var params = {
666 selectText: "FIX - FIX Testnet",
667 firstAddress: "XpnU1HHdNG5YxvG9Rez4wjmidchxqnZaNa",
668 };
669 testNetwork(done, params);
670 });
671 it('Allows selection of fujicoin', function(done) {
672 var params = {
673 selectText: "FJC - Fujicoin",
674 firstAddress: "FgiaLpG7C99DyR4WnPxXedRVHXSfKzUDhF",
675 };
676 testNetwork(done, params);
677 });
678 it('Allows selection of nubits', function(done) {
679 var params = {
680 selectText: "USNBT - NuBits",
681 firstAddress: "BLxkabXuZSJSdesLD7KxZdqovd4YwyBTU6",
682 };
683 testNetwork(done, params);
684 });
685 it('Allows selection of bitcoin gold', function(done) {
686 var params = {
687 selectText: "BTG - Bitcoin Gold",
688 firstAddress: "GdDqug4WUsn5syNbSTHatNn4XnuwZtzedx",
689 };
690 testNetwork(done, params);
691 });
692 it('Allows selection of monacoin', function(done) {
693 var params = {
694 selectText: "MONA - Monacoin",
695 firstAddress: "MKMiMr7MyjDKjJbCBzgF6u4ByqTS4NkRB1",
696 };
697 testNetwork(done, params);
698 });
699 it('Allows selection of AXE', function(done) {
700 var params = {
701 selectText: "AXE - Axe",
702 firstAddress: "PScwtLUyPiGrqtKXrHF37DGETLXLZdw4up",
703 };
704 testNetwork(done, params);
705 });
706 it('Allows selection of BlackCoin', function(done) {
707 var params = {
708 selectText: "BLK - BlackCoin",
709 firstAddress: "B5MznAKwj7uQ42vDz3w4onhBXPcqhTwJ9z",
710 };
711 testNetwork(done, params);
712 });
713 it('Allows selection of Neblio', function(done) {
714 var params = {
715 selectText: "NEBL - Neblio",
716 firstAddress: "NefkeEEvhusbHMmTRrxx7H9wFnUXd8qQsE",
717 };
718 testNetwork(done, params);
719 });
720 it('Allows selection of Beetlecoin', function(done) {
721 var params = {
722 selectText: "BEET - Beetlecoin",
723 firstAddress: "BVmtbEsGrjpknprmpHFq26z4kYHJUFHE71",
724 };
725 testNetwork(done, params);
726 });
727 it('Allows selection of Adcoin', function(done) {
728 var params = {
729 selectText: "ACC - Adcoin",
730 firstAddress: "AcEDM6V5sF4kFHC76MJjjfProtS5Sw2qcd",
731 };
732 testNetwork(done, params);
733 });
734 it('Allows selection of Asiacoin', function(done) {
735 var params = {
736 selectText: "AC - Asiacoin",
737 firstAddress: "ALupuEEz7kJjQTAvmtcBMBVuEjPa7GqZzE",
738 };
739 testNetwork(done, params);
740 });
741 it('Allows selection of Aryacoin', function(done) {
742 var params = {
743 selectText: "ARYA - Aryacoin",
744 firstAddress: "Abr6gX25KaU9BpwD34UfsL3A4n89NvYYSf",
745 };
746 testNetwork(done, params);
747 });
748 it('Allows selection of Auroracoin', function(done) {
749 var params = {
750 selectText: "AUR - Auroracoin",
751 firstAddress: "ANuraS6F4Jpi413FEnavjYkKYJJRHkgYCm",
752 };
753 testNetwork(done, params);
754 });
755 it('Allows selection of Bata', function(done) {
756 var params = {
757 selectText: "BTA - Bata",
758 firstAddress: "BGxBdNeYPtF3GCuTtZBPQdFxCkdBYSF3fj",
759 };
760 testNetwork(done, params);
761 });
762 it('Allows selection of Belacoin', function(done) {
763 var params = {
764 selectText: "BELA - Belacoin",
765 firstAddress: "BEeetqpNffdzeknSpNmQp5KAFh2KK1Qx7S",
766 };
767 testNetwork(done, params);
768 });
769 it('Allows selection of Bitcoin Atom', function(done) {
770 var params = {
771 selectText: "BCA - Bitcoin Atom",
772 firstAddress: "AMy6qMbJeC4zsGRL6iWszmeCdQH65fgfih",
773 };
774 testNetwork(done, params);
775 });
776 it('Allows selection of Bitcoinplus', function(done) {
777 var params = {
778 selectText: "XBC - Bitcoinplus",
779 firstAddress: "B7FSynZoDbEwTCSgsXq9nJ5ue8owYLVL8r",
780 };
781 testNetwork(done, params);
782 });
783 it('Allows selection of Bitcoin Private', function(done) {
784 var params = {
785 selectText: "BTCP - Bitcoin Private",
786 firstAddress: "b1M3PbiXXyN6Hdivdw5rJv5VKpLjPzhm4jM",
787 };
788 testNetwork(done, params);
789 });
790 it('Allows selection of Bitcoin SV', function(done) {
791 var params = {
792 selectText: "BSV - BitcoinSV",
793 firstAddress: "1N4mgtE5yxifch9jWs7Sds6oVqxdy2t576",
794 };
795 testNetwork(done, params);
796 });
797 it('Allows selection of Bitcoinz', function(done) {
798 var params = {
799 selectText: "BTCZ - Bitcoinz",
800 firstAddress: "t1X2YQoxs8cYRo2oaBYgVEwW5QNjCC59NYc",
801 };
802 testNetwork(done, params);
803 });
804 it('Allows selection of BitCloud', function(done) {
805 var params = {
806 selectText: "BTDX - BitCloud",
807 firstAddress: "BHbWitXCNgTf1BhsRDNMP186EeibuzmrBi",
808 };
809 testNetwork(done, params);
810 });
811 it('Allows selection of Bitcore', function(done) {
812 var params = {
813 selectText: "BTX - Bitcore",
814 firstAddress: "2Rgp5Znhpy34TK4QmPkfCiYs9r4KovfTH9",
815 };
816 testNetwork(done, params);
817 });
818 it('Allows selection of Bitsend', function(done) {
819 var params = {
820 selectText: "BSD - Bitsend",
821 firstAddress: "iBPk7LYjDun3EPk7CRR8UUmnPoceVc1bp2",
822 };
823 testNetwork(done, params);
824 });
825 it('Allows selection of Britcoin', function(done) {
826 var params = {
827 selectText: "BRIT - Britcoin",
828 firstAddress: "B6Aue4J2XLs1f1dtD4H1SHYFfh4XrmEbrw",
829 };
830 testNetwork(done, params);
831 });
832 it('Allows selection of Canadaecoin', function(done) {
833 var params = {
834 selectText: "CDN - Canadaecoin",
835 firstAddress: "CanAyCfd5Rj2CQVfaoAmvDUZunPM5W1AEQ",
836 };
837 testNetwork(done, params);
838 });
839 it('Allows selection of Cannacoin', function(done) {
840 var params = {
841 selectText: "CCN - Cannacoin",
842 firstAddress: "CYjW8xWB43g6krLJTmmrPk1PonoQX7h9Qd",
843 };
844 testNetwork(done, params);
845 });
846 it('Allows selection of Clubcoin', function(done) {
847 var params = {
848 selectText: "CLUB - Clubcoin",
849 firstAddress: "CHMDEXN4sihpSVX4GyAa2hZ62shnby7uyN",
850 };
851 testNetwork(done, params);
852 });
853 it('Allows selection of Compcoin', function(done) {
854 var params = {
855 selectText: "CMP - Compcoin",
856 firstAddress: "CLshtw3zhxkseBJS46UF12v3AFy9Dx7JVv",
857 };
858 testNetwork(done, params);
859 });
860 it('Allows selection of CPUchain', function(done) {
861 var params = {
862 selectText: "CPU - CPUchain",
863 firstAddress: "CWSpLpW7jS4mBHJnkz3mmL5s3yQMg93zK8",
864 };
865 testNetwork(done, params);
866 });
867 it('Allows selection of Crave', function(done) {
868 var params = {
869 selectText: "CRAVE - Crave",
870 firstAddress: "VCYJeti6uKMNBFKCL7eP96UwuFWYHM7c85",
871 };
872 testNetwork(done, params);
873 });
874 it('Allows selection of Defcoin', function(done) {
875 var params = {
876 selectText: "DFC - Defcoin",
877 firstAddress: "D8swcgyaaFUrXZU3ATwbgy16buCpWqbG1M",
878 };
879 testNetwork(done, params);
880 });
881 it('Allows selection of Diamond', function(done) {
882 var params = {
883 selectText: "DMD - Diamond",
884 firstAddress: "dJnrVbLL9UPjdaVRz2C8VpqHZknqAqjLek",
885 };
886 testNetwork(done, params);
887 });
888 it('Allows selection of Digibyte', function(done) {
889 var params = {
890 selectText: "DGB - Digibyte",
891 firstAddress: "D85Rp9jwLtMdmP6wGjTiqHBdVQLST3YCEq",
892 };
893 testNetwork(done, params);
894 });
895 it('Allows selection of Digitalcoin', function(done) {
896 var params = {
897 selectText: "DGC - Digitalcoin",
898 firstAddress: "DKw4UGKEAZWweDNEbBFNQx4EM8x1mpUdia",
899 };
900 testNetwork(done, params);
901 });
902 it('Allows selection of Ecoin', function(done) {
903 var params = {
904 selectText: "ECN - Ecoin",
905 firstAddress: "e6WFPLG5gcXyF7cESFteH1hE2XSmowW5yB",
906 };
907 testNetwork(done, params);
908 });
909 it('Allows selection of Edrcoin', function(done) {
910 var params = {
911 selectText: "EDRC - Edrcoin",
912 firstAddress: "eh1nUJsvgKPFv6ebMBfcwJ299GMCpjeZUG",
913 };
914 testNetwork(done, params);
915 });
916 it('Allows selection of Egulden', function(done) {
917 var params = {
918 selectText: "EFL - Egulden",
919 firstAddress: "Lg66yt55R7edRM58cDhKzXik2kFme3viX7",
920 };
921 testNetwork(done, params);
922 });
923 it('Allows selection of Einsteinium', function(done) {
924 var params = {
925 selectText: "EMC2 - Einsteinium",
926 firstAddress: "EVAABm9hXKHk2MpVMbwNakRubFnNha5m8m",
927 };
928 testNetwork(done, params);
929 });
930 it('Allows selection of EOSIO', function(done) {
931 var params = {
932 selectText: "EOS - EOSIO",
933 firstPubKey: "EOS692VJTBK3Rmw93onNnpnZ8ZtmE9PdxjDStArvbyzoe11QUTNoy",
934 };
935 testNetwork(done, params, true);
936 });
937 it('Allows selection of Europecoin', function(done) {
938 var params = {
939 selectText: "ERC - Europecoin",
940 firstAddress: "ESA2YwPYntAoaPrE8Fm5qkKRtkcwLcwD6R",
941 };
942 testNetwork(done, params);
943 });
944 it('Allows selection of Exclusivecoin', function(done) {
945 var params = {
946 selectText: "EXCL - Exclusivecoin",
947 firstAddress: "EbUa6m8UZW6nTxsYZD2FsDjkadKbp5M6JT",
948 };
949 testNetwork(done, params);
950 });
951 it('Allows selection of Feathercoin', function(done) {
952 var params = {
953 selectText: "FTC - Feathercoin",
954 firstAddress: "6gDdjAMoSgQaW8UhqK3oboHs6ftGAroKkM",
955 };
956 testNetwork(done, params);
957 });
958 it('Allows selection of Firstcoin', function(done) {
959 var params = {
960 selectText: "FRST - Firstcoin",
961 firstAddress: "FJN9GzfMm7Q8R4DJwK1H9F6A1GTghvFiMJ",
962 };
963 testNetwork(done, params);
964 });
965 it('Allows selection of Flashcoin', function(done) {
966 var params = {
967 selectText: "FLASH - Flashcoin",
968 firstAddress: "UWfpf5LfMmLxZYooEb2EyvWhZ8NG7EZDRt",
969 };
970 testNetwork(done, params);
971 });
972 it('Allows selection of GCRCoin', function(done) {
973 var params = {
974 selectText: "GCR - GCRCoin",
975 firstAddress: "GJjF5cLwyXLacpuvXAVksxGxKvHDjx58d6",
976 };
977 testNetwork(done, params);
978 });
979 it('Allows selection of Gobyte', function(done) {
980 var params = {
981 selectText: "GBX - Gobyte",
982 firstAddress: "GS813Ys2brkmvSUw1rUqGPm2HqQVDHJRyA",
983 };
984 testNetwork(done, params);
985 });
986 it('Allows selection of Gridcoin', function(done) {
987 var params = {
988 selectText: "GRC - Gridcoin",
989 firstAddress: "SGrWbBPvobgqKRF8td1Kdc9vbRY7MJ78Y9",
990 };
991 testNetwork(done, params);
992 });
993 it('Allows selection of Gulden', function(done) {
994 var params = {
995 selectText: "NLG - Gulden",
996 firstAddress: "GcDP7cNEc33MPPdTFNJ8pZc6VMZJ2CbKxY",
997 };
998 testNetwork(done, params);
999 });
1000 it('Allows selection of Helleniccoin', function(done) {
1001 var params = {
1002 selectText: "HNC - Helleniccoin",
1003 firstAddress: "LbHEKe5H72zp9G1fuWNiiNePTUfJb88915",
1004 };
1005 testNetwork(done, params);
1006 });
1007 it('Allows selection of Hempcoin', function(done) {
1008 var params = {
1009 selectText: "THC - Hempcoin",
1010 firstAddress: "H8sdWbZyJV4gyXyHtLXDaNnAuUDhK5mfTV",
1011 };
1012 testNetwork(done, params);
1013 });
1014 it('Allows selection of Insane', function(done) {
1015 var params = {
1016 selectText: "INSN - Insane",
1017 firstAddress: "iMPqEJMiXWuxC9U2NVinCCMr4t72h58EWx",
1018 };
1019 testNetwork(done, params);
1020 });
1021 it('Allows selection of Iop', function(done) {
1022 var params = {
1023 selectText: "IOP - Iop",
1024 firstAddress: "pGKQmcaPf95Ur5o6oHK4qdiZ52p1yaTvq1",
1025 };
1026 testNetwork(done, params);
1027 });
1028 it('Allows selection of Ixcoin', function(done) {
1029 var params = {
1030 selectText: "IXC - Ixcoin",
1031 firstAddress: "xgE9bTZ6YypT3E6ByzkTt31Hq68E9BqywH",
1032 };
1033 testNetwork(done, params);
1034 });
1035 it('Allows selection of Kobocoin', function(done) {
1036 var params = {
1037 selectText: "KOBO - Kobocoin",
1038 firstAddress: "FTVoNJETXDAM8x7MnmdE8RwWndSr9PQWhy",
1039 };
1040 testNetwork(done, params);
1041 });
1042 it('Allows selection of Landcoin', function(done) {
1043 var params = {
1044 selectText: "LDCN - Landcoin",
1045 firstAddress: "LLvLwNjG1aJcn1RS4W4GJUbv8fNaRATG7c",
1046 };
1047 testNetwork(done, params);
1048 });
1049 it('Allows selection of Library Credits', function(done) {
1050 var params = {
1051 selectText: "LBC - Library Credits",
1052 firstAddress: "bQJEQrHDJyHdqycB32uysh1SWn8Ln8LMdg",
1053 };
1054 testNetwork(done, params);
1055 });
1056 it('Allows selection of Linx', function(done) {
1057 var params = {
1058 selectText: "LINX - Linx",
1059 firstAddress: "XGWQ3cb3LGUB3VnHmj6xYSMgnokNbf6dyk",
1060 };
1061 testNetwork(done, params);
1062 });
1063 it('Allows selection of Litecoincash', function(done) {
1064 var params = {
1065 selectText: "LCC - Litecoincash",
1066 firstAddress: "Ce5n7fjUuQPLutJ4W5nCCfQLKdKLE1mv9A",
1067 };
1068 testNetwork(done, params);
1069 });
1070 it('Allows selection of Lynx', function(done) {
1071 var params = {
1072 selectText: "LYNX - Lynx",
1073 firstAddress: "KUeY3ZdZkg96p4W98pj1JjygCFU1XqWdw3",
1074 };
1075 testNetwork(done, params);
1076 });
1077 it('Allows selection of Megacoin', function(done) {
1078 var params = {
1079 selectText: "MEC - Megacoin",
1080 firstAddress: "MDfAj9CzkC1HpcUiVGnHp8yKTa7WXgu8AY",
1081 };
1082 testNetwork(done, params);
1083 });
1084 it('Allows selection of Minexcoin', function(done) {
1085 var params = {
1086 selectText: "MNX - Minexcoin",
1087 firstAddress: "XC1VnyJVfiMDwWgFtAHDp41cgY3AHk3dJT",
1088 };
1089 testNetwork(done, params);
1090 });
1091 it('Allows selection of Navcoin', function(done) {
1092 var params = {
1093 selectText: "NAV - Navcoin",
1094 firstAddress: "NTQVTPK3NWSQLKoffkiQw99T8PifkF1Y2U",
1095 };
1096 testNetwork(done, params);
1097 });
1098 it('Allows selection of Nebulas', function(done) {
1099 var params = {
1100 selectText: "NAS - Nebulas",
1101 firstAddress: "n1PbK61DGBfDoDusLw621G6sVSMfLLHdfnm",
1102 };
1103 testNetwork(done, params);
1104 });
1105 it('Allows selection of Neoscoin', function(done) {
1106 var params = {
1107 selectText: "NEOS - Neoscoin",
1108 firstAddress: "NgATz6QbQNXvayHQ4CpZayugb9HeaPDdby",
1109 };
1110 testNetwork(done, params);
1111 });
1112 it('Allows selection of Nix', function(done) {
1113 var params = {
1114 selectText: "NIX - NIX Platform",
1115 firstAddress: "GgcNW2SQQXB4LWHRQTHKkQF3GzXNSLqS8u",
1116 };
1117 testNetwork(done, params);
1118 });
1119 it('Allows selection of Neurocoin', function(done) {
1120 var params = {
1121 selectText: "NRO - Neurocoin",
1122 firstAddress: "NVdYErQ3mFpDuF5DquW9WMiT7sLc8ufFTn",
1123 };
1124 testNetwork(done, params);
1125 });
1126 it('Allows selection of Newyorkc', function(done) {
1127 var params = {
1128 selectText: "NYC - Newyorkc",
1129 firstAddress: "RSVMfyH1fKfy3puADJEhut2vfkRyon6imm",
1130 };
1131 testNetwork(done, params);
1132 });
1133 it('Allows selection of Novacoin', function(done) {
1134 var params = {
1135 selectText: "NVC - Novacoin",
1136 firstAddress: "4JRvUmxcKCJmaMXZyvRoSS1cmG2XvnZfHN",
1137 };
1138 testNetwork(done, params);
1139 });
1140 it('Allows selection of Nushares', function(done) {
1141 var params = {
1142 selectText: "NSR - Nushares",
1143 firstAddress: "SecjXzU3c7EecdT7EbC4vvmbdtBBokWh6J",
1144 };
1145 testNetwork(done, params);
1146 });
1147 it('Allows selection of Okcash', function(done) {
1148 var params = {
1149 selectText: "OK - Okcash",
1150 firstAddress: "PV4Qp1TUYuGv4TqVtLZtqvrsWWRycfx1Yi",
1151 };
1152 testNetwork(done, params);
1153 });
1154 it('Allows selection of Omnicore', function(done) {
1155 var params = {
1156 selectText: "OMNI - Omnicore",
1157 firstAddress: "1Q1t3gonjCT3rW38TsTsCvgSc3hh7zBGbi",
1158 };
1159 testNetwork(done, params);
1160 });
1161 it('Allows selection of DeepOnion', function(done) {
1162 var params = {
1163 selectText: "ONION - DeepOnion",
1164 firstAddress: "DYREY7XCFXVqJ3x5UuN43k2JwD2s1kif48",
1165 };
1166 testNetwork(done, params);
1167 });
1168 it('Allows selection of Pesobit', function(done) {
1169 var params = {
1170 selectText: "PSB - Pesobit",
1171 firstAddress: "PDePsF7ALyXP7JaywokdYiRTDtKa14MAr1",
1172 };
1173 testNetwork(done, params);
1174 });
1175 it('Allows selection of Pinkcoin', function(done) {
1176 var params = {
1177 selectText: "PINK - Pinkcoin",
1178 firstAddress: "2TgjYQffjbzUHJghNaVbdsjHbRwruC3yzC",
1179 };
1180 testNetwork(done, params);
1181 });
1182 it('Allows selection of POSWcoin', function(done) {
1183 var params = {
1184 selectText: "POSW - POSWcoin",
1185 firstAddress: "PNxewmZoPnGBvoEbH6hgQZCK1igDiBCdgC",
1186 };
1187 testNetwork(done, params);
1188 });
1189 it('Allows selection of Potcoin', function(done) {
1190 var params = {
1191 selectText: "POT - Potcoin",
1192 firstAddress: "PEo7Vg2ctXgpP4vuLPeY9aGJtZotyrmiHc",
1193 };
1194 testNetwork(done, params);
1195 });
1196 it('Allows selection of Putincoin', function(done) {
1197 var params = {
1198 selectText: "PUT - Putincoin",
1199 firstAddress: "PViWnfr2uFtovd6e7joM49C94CsGSnqJis",
1200 };
1201 testNetwork(done, params);
1202 });
1203 it('Allows selection of Rapids', function(done) {
1204 var params = {
1205 selectText: "RPD - Rapids",
1206 firstAddress: "Ri8XxUdZaXS5LqxmFJcFEjFinkaMbmhSUp",
1207 };
1208 testNetwork(done, params);
1209 });
1210 it('Allows selection of Ravencoin', function(done) {
1211 var params = {
1212 selectText: "RVN - Ravencoin",
1213 firstAddress: "RBuDoVNnzvFsEcX8XKPm8ic4mgiCzjUCNk",
1214 };
1215 testNetwork(done, params);
1216 });
1217 it('Allows selection of Reddcoin', function(done) {
1218 var params = {
1219 selectText: "RDD - Reddcoin",
1220 firstAddress: "RtgRvXMBng1y51ftteveFqwNfyRG18HpxQ",
1221 };
1222 testNetwork(done, params);
1223 });
1224 it('Allows selection of RevolutionVR', function(done) {
1225 var params = {
1226 selectText: "RVR - RevolutionVR",
1227 firstAddress: "VXeeoP2jkzZnMFxtc66ZBZK1NHN5QJnnjL",
1228 };
1229 testNetwork(done, params);
1230 });
1231 it('Allows selection of Rubycoin', function(done) {
1232 var params = {
1233 selectText: "RBY - Rubycoin",
1234 firstAddress: "RV76JDtjTs11JdMDRToYn6CHecMRPLnKS6",
1235 };
1236 testNetwork(done, params);
1237 });
1238 it('Allows selection of Salus', function(done) {
1239 var params = {
1240 selectText: "SLS - Salus",
1241 firstAddress: "SNzPi1CafHFm3WWjRo43aMgiaEEj3ogjww",
1242 };
1243 testNetwork(done, params);
1244 });
1245 it('Allows selection of Smileycoin', function(done) {
1246 var params = {
1247 selectText: "SMLY - Smileycoin",
1248 firstAddress: "BEZVnEBCAyFByrgKpwAgYgtvP4rKAd9Sj2",
1249 };
1250 testNetwork(done, params);
1251 });
1252 it('Allows selection of Solarcoin', function(done) {
1253 var params = {
1254 selectText: "SLR - Solarcoin",
1255 firstAddress: "8LZ13HbnjtaMJWSvvVFNTLf71zFfDrhwLu",
1256 };
1257 testNetwork(done, params);
1258 });
1259 it('Allows selection of stash', function(done) {
1260 var params = {
1261 selectText: "STASH - Stash",
1262 firstAddress: "XxwAsWB7REDKmAvHA85SbEZQQtpxeUDxS3",
1263 };
1264 testNetwork(done, params);
1265 });
1266 it('Allows selection of stash testnet', function(done) {
1267 var params = {
1268 selectText: "STASH - Stash Testnet",
1269 firstAddress: "yWQCTSkUst7ddYuebKsqa1kSoXEjpCkGKR",
1270 };
1271 testNetwork(done, params);
1272 });
1273 it('Allows selection of Stratis', function(done) {
1274 var params = {
1275 selectText: "STRAT - Stratis",
1276 firstAddress: "ScfJnq3QDhKgDMEds6sqUE1ot6ShfhmXXq",
1277 };
1278 testNetwork(done, params);
1279 });
1280 it('Allows selection of Stratis Test', function(done) {
1281 var params = {
1282 selectText: "TSTRAT - Stratis Testnet",
1283 firstAddress: "TRLWm3dye4FRrDWouwYUSUZP96xb76mBE3",
1284 };
1285 testNetwork(done, params);
1286 });
1287 it('Allows selection of Syscoin', function(done) {
1288 var params = {
1289 selectText: "SYS - Syscoin",
1290 firstAddress: "SZwJi42Pst3VAMomyK5DG4157WM5ofRmSj",
1291 };
1292 testNetwork(done, params);
1293 });
1294 it('Allows selection of Toa', function(done) {
1295 var params = {
1296 selectText: "TOA - Toa",
1297 firstAddress: "TSe1QAnUwQzUfbBusDzRJ9URttrRGKoNKF",
1298 };
1299 testNetwork(done, params);
1300 });
1301 it('Allows selection of TWINS', function(done) {
1302 var params = {
1303 selectText: "TWINS - TWINS",
1304 firstAddress: "WPpJnfLLubNmF7HLNxg8d8zH5haxn4wri8",
1305 };
1306 testNetwork(done, params);
1307 });
1308 it('Allows selection of TWINS testnet', function(done) {
1309 var params = {
1310 selectText: "TWINS - TWINS Testnet",
1311 firstAddress: "XpnU1HHdNG5YxvG9Rez4wjmidchxqnZaNa",
1312 };
1313 testNetwork(done, params);
1314 });
1315 it('Allows selection of Ultimatesecurecash', function(done) {
1316 var params = {
1317 selectText: "USC - Ultimatesecurecash",
1318 firstAddress: "UPyLAZU2Che5fiy7Ed8xVJFmXAUhitA4ug",
1319 };
1320 testNetwork(done, params);
1321 });
1322 it('Allows selection of Unobtanium', function(done) {
1323 var params = {
1324 selectText: "UNO - Unobtanium",
1325 firstAddress: "uUBMPVMXrR6qhqornJqKTWgr8L69vihSL9",
1326 };
1327 testNetwork(done, params);
1328 });
1329 it('Allows selection of Vcash', function(done) {
1330 var params = {
1331 selectText: "XVC - Vcash",
1332 firstAddress: "VuL53MSY6KjvAjKSeRkh3NDnKykacDVeps",
1333 };
1334 testNetwork(done, params);
1335 });
1336 it('Allows selection of Verge', function(done) {
1337 var params = {
1338 selectText: "XVG - Verge",
1339 firstAddress: "DCrVuGkMjLJpTGgwAgv9AcMdeb1nkWbjZA",
1340 };
1341 testNetwork(done, params);
1342 });
1343 it('Allows selection of Vertcoin', function(done) {
1344 var params = {
1345 selectText: "VTC - Vertcoin",
1346 firstAddress: "Vf6koGuiWdXQfx8tNqxoNeEDxh4xh5cxsG",
1347 };
1348 testNetwork(done, params);
1349 });
1350 it('Allows selection of Vivo', function(done) {
1351 var params = {
1352 selectText: "VIVO - Vivo",
1353 firstAddress: "VFmBwuXXGhJe7MarQG2GfzHMFebRHgfSpB",
1354 };
1355 testNetwork(done, params);
1356 });
1357 it('Allows selection of Vpncoin', function(done) {
1358 var params = {
1359 selectText: "VASH - Vpncoin",
1360 firstAddress: "VoEmH1qXC4TsSgBAStR21QYetwnFqbqCx9",
1361 };
1362 testNetwork(done, params);
1363 });
1364 it('Allows selection of VeChain', function(done) {
1365 var params = {
1366 selectText: "VET - VeChain",
1367 firstAddress: "0xdba55B1B6070f3a733D5eDFf35F0da4A00E455F2",
1368 };
1369 testNetwork(done, params);
1370 });
1371 it('Allows selection of Whitecoin', function(done) {
1372 var params = {
1373 selectText: "XWC - Whitecoin",
1374 firstAddress: "WcSwCAUqrSgeSYbsaS3SSWWhsx8KRYTFDR",
1375 };
1376 testNetwork(done, params);
1377 });
1378 it('Allows selection of Wincoin', function(done) {
1379 var params = {
1380 selectText: "WC - Wincoin",
1381 firstAddress: "WaDVCESMGgyKgNESdn3u43NnwmGSkZED3Z",
1382 };
1383 testNetwork(done, params);
1384 });
1385 it('Allows selection of Zcoin', function(done) {
1386 var params = {
1387 selectText: "XZC - Zcoin",
1388 firstAddress: "a6VcMdP4XgAA9Tr7xNszmPG5FZpfRf17Cq",
1389 };
1390 testNetwork(done, params);
1391 });
1392 it('Allows selection of Zcash', function(done) {
1393 var params = {
1394 selectText: "ZEC - Zcash",
1395 firstAddress: "t1Sz8AneMcVuzUg3tPJ8et5AS5LFJ7K2EF9",
1396 };
1397 testNetwork(done, params);
1398 });
1399 it('Allows selection of Zclassic', function(done) {
1400 var params = {
1401 selectText: "ZCL - Zclassic",
1402 firstAddress: "t1TBMxTvVJRybUbMLGWq8H4A8F4VUL7czEc",
1403 };
1404 testNetwork(done, params);
1405 });
1406 it('Allows selection of Horizen', function(done) {
1407 var params = {
1408 selectText: "ZEN - Horizen",
1409 firstAddress: "znWh9XASyW2dZq5tck84wFjiwuqVysi7q3p",
1410 };
1411 testNetwork(done, params);
1412 });
1413 it('Allows selection of Energi', function(done) {
1414 var params = {
1415 selectText: "NRG - Energi",
1416 firstAddress: "EejRy4t4nidzhGGzkJUgFP3z4HYBjhTsRt",
1417 };
1418 testNetwork(done, params);
1419 });
1420 it('Allows selection of Ethereum Classic', function(done) {
1421 var params = {
1422 selectText: "ETC - Ethereum Classic",
1423 firstAddress: "0x3c05e5556693808367afB62eF3b63e35d6eD249A",
1424 };
1425 testNetwork(done, params);
1426 });
1427 it('Allows selection of Pirl', function(done) {
1428 var params = {
1429 selectText: "PIRL - Pirl",
1430 firstAddress: "0xe77FC0723dA122B5025CA79193c28563eB47e776",
1431 };
1432 testNetwork(done, params);
1433 });
1434 it('Allows selection of MIX', function(done) {
1435 var params = {
1436 selectText: "MIX - MIX",
1437 firstAddress: "0x98BC5e63aeb6A4e82d72850d20710F07E29A29F1",
1438 };
1439 testNetwork(done, params);
1440 });
1441 it('Allows selection of Monkey Project', function(done) {
1442 var params = {
1443 selectText: "MONK - Monkey Project",
1444 firstAddress: "MnLrcnnUzKnf7TzufjRe5DLZqQJz18oYyu",
1445 };
1446 testNetwork(done, params);
1447 });
1448
1449 it('Allows selection of Musicoin', function(done) {
1450 var params = {
1451 selectText: "MUSIC - Musicoin",
1452 firstAddress: "0xDc060e4A0b0313ea83Cf6B3A39B9db2D29004897",
1453 };
1454 testNetwork(done, params);
1455 });
1456 it('Allows selection of Poa', function(done) {
1457 var params = {
1458 selectText: "POA - Poa",
1459 firstAddress: "0x53aF28d754e106210C3d0467Dd581eaf7e3C5e60",
1460 };
1461 testNetwork(done, params);
1462 });
1463 it('Allows selection of Expanse', function(done) {
1464 var params = {
1465 selectText: "EXP - Expanse",
1466 firstAddress: "0xf57FeAbf26582b6E3E666559d3B1Cc6fB2b2c5F6",
1467 };
1468 testNetwork(done, params);
1469 });
1470 it('Allows selection of Callisto', function(done) {
1471 var params = {
1472 selectText: "CLO - Callisto",
1473 firstAddress: "0x4f9364F7420B317266C51Dc8eB979717D4dE3f4E",
1474 };
1475 testNetwork(done, params);
1476 });
1477 it('Allows selection of HUSH', function(done) {
1478 var params = {
1479 selectText: "HUSH - Hush (Legacy)",
1480 firstAddress: "t1g6rLXUnJaiJuu4q4zmJjoa9Gk4fwKpiuA",
1481 };
1482 testNetwork(done, params);
1483 });
1484 it('Allows selection of HUSH3', function(done) {
1485 var params = {
1486 selectText: "HUSH - Hush3",
1487 firstAddress: "RXWSQhwvw5jHPGP8bjwJhWoRnMLBnuPDKD",
1488 };
1489 testNetwork(done, params);
1490 });
1491 it('Allows selection of ExchangeCoin', function(done) {
1492 var params = {
1493 selectText: "EXCC - ExchangeCoin",
1494 firstAddress: "22txYKpFN5fwGwdSs2UBf7ywewbLM92YqK7E",
1495 };
1496 testNetwork(done, params);
1497 });
1498 it('Allows selection of Artax', function(done) {
1499 var params = {
1500 selectText: "XAX - Artax",
1501 firstAddress: "AYxaQPY7XLidG31V7F3yNzwxPYpYzRqG4q",
1502 };
1503 testNetwork(done, params);
1504 });
1505 it('Allows selection of BitcoinGreen', function(done) {
1506 var params = {
1507 selectText: "BITG - Bitcoin Green",
1508 firstAddress: "GeNGm9SkEfwbsws3UrrUSE2sJeyWYjzraY",
1509 };
1510 testNetwork(done, params);
1511 });
1512 it('Allows selection of ANON', function(done) {
1513 var params = {
1514 selectText: "ANON - ANON",
1515 firstAddress: "AnU6pijpEeUZFWSTyM2qTqZQn996Zq1Xard",
1516 };
1517 testNetwork(done, params);
1518 });
1519 it('Allows selection of ProjectCoin', function(done) {
1520 var params = {
1521 selectText: "PRJ - ProjectCoin",
1522 firstAddress: "PXZG97saRseSCftfe1mcFmfAA7pf6qBbaz",
1523 };
1524 testNetwork(done, params);
1525 });
1526 it('Allows selection of Phore', function(done) {
1527 var params = {
1528 selectText: "PHR - Phore",
1529 firstAddress: "PJThxpoXAG6hqrmdeQQbVDX4TJtFTMMymC",
1530 };
1531 testNetwork(done, params);
1532 });
1533 it('Allows selection of Safecoin', function(done) {
1534 var params = {
1535 selectText: "SAFE - Safecoin",
1536 firstAddress: "RtxHpnhJz6RY8k9owP3ua5QWraunmewB1G",
1537 };
1538 testNetwork(done, params);
1539 });
1540 it('Allows selection of Blocknode', function(done) {
1541 var params = {
1542 selectText: "BND - Blocknode",
1543 firstAddress: "BG8xZSAur2jYLG9VXt8dYfkKxxeR7w9bSe",
1544 };
1545 testNetwork(done, params);
1546 });
1547 it('Allows selection of Blocknode Testnet', function(done) {
1548 var params = {
1549 selectText: "tBND - Blocknode Testnet",
1550 firstAddress: "bSptsFyDktFSKpWveRywJsDoJA2TC6qfHv",
1551 };
1552 testNetwork(done, params);
1553 });
1554 it('Allows selection of LitecoinZ', function(done) {
1555 var params = {
1556 selectText: "LTZ - LitecoinZ",
1557 firstAddress: "L1VTXju7hLgKV4T7fGXS9sKsnm2gmtRCmyw",
1558 };
1559 testNetwork(done, params);
1560 });
1561 it('Allows selection of BlockStamp', function(done) {
1562 var params = {
1563 selectText: "BST - BlockStamp",
1564 firstAddress: "15gypKtim4cVTj137ApfryG17RkvSbPazZ",
1565 };
1566 testNetwork(done, params);
1567 });
1568 it('Allows selection of DEXON', function(done) {
1569 var params = {
1570 selectText: "DXN - DEXON",
1571 firstAddress: "0x136a58788033E028CCd740FbDec6734358DB56Ec",
1572 };
1573 testNetwork(done, params);
1574 });
1575 it('Allows selection of Ellaism', function(done) {
1576 var params = {
1577 selectText: "ELLA - Ellaism",
1578 firstAddress: "0xa8B0BeA09eeBc41062308546a01d6E544277e2Ca",
1579 };
1580 testNetwork(done, params);
1581 });
1582 it('Allows selection of Ethersocial Network', function(done) {
1583 var params = {
1584 selectText: "ESN - Ethersocial Network",
1585 firstAddress: "0x6EE99Be2A0C7F887a71e21C8608ACF0aa0D2b767",
1586 };
1587 testNetwork(done, params);
1588 });
1589 it('Allows selection of Stellar', function(done) {
1590 var params = {
1591 selectText: "XLM - Stellar",
1592 firstAddress: "GCUK3NYYUXA2QGN6KU5RR36WAKN3Y5EANZV65XNAWN4XM4CHQ3G4DMO2",
1593 };
1594 testNetwork(done, params);
1595 });
1596 it('Allows selection of Wagerr', function(done) {
1597 var params = {
1598 selectText: "WGR - Wagerr",
1599 firstAddress: "WYiVgQU39VcQxcnacoCiaZHZZLjDCJoS95",
1600 };
1601 testNetwork(done, params);
1602 });
1603 it('Allows selection of Groestlcoin', function(done) {
1604 var params = {
1605 selectText: "GRS - Groestlcoin",
1606 firstAddress: "FZycsFvZ1eH1hbtyjBpAgJSukVw1bN6PBN",
1607 };
1608 testNetwork(done, params);
1609 });
1610 it('Allows selection of Groestlcoin Testnet', function(done) {
1611 var params = {
1612 selectText: "GRS - Groestlcoin Testnet",
1613 firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiygRPne9",
1614 };
1615 testNetwork(done, params);
1616 });
1617 it('Allows selection of Elastos', function(done) {
1618 var params = {
1619 selectText: "ELA - Elastos",
1620 firstAddress: "EMccDcsn3SwPDcfeQMf3w7utqi8ioWYtkg",
1621 };
1622 testNetwork(done, params);
1623 });
1624 it('Allows selection of Energyweb', function(done) {
1625 var params = {
1626 selectText: "EWT - EnergyWeb",
1627 firstAddress: "0x22171474844Fc7E8E99A3A69CCf1eDb5574FdD4c",
1628 };
1629 testNetwork(done, params);
1630 });
1631 it('Allows selection of Thought', function(done) {
1632 var params = {
1633 selectText: "THT - Thought",
1634 firstAddress: "4B1Bh9GibDarFQrhtYU8krpc7WSjgGfYvo",
1635 };
1636 testNetwork(done, params);
1637 });
1638 it('Allows selection of EtherCore', function(done) {
1639 var params = {
1640 selectText: "ERE - EtherCore",
1641 firstAddress: "0x119e6EAC3Ce1b473D62d9fD847fb0ea222eF1D9e",
1642 };
1643 testNetwork(done, params);
1644 });
1645
1646 // BIP39 seed is set from phrase
1647 it('Sets the bip39 seed from the prhase', function(done) {
1648 driver.findElement(By.css('.phrase'))
1649 .sendKeys('abandon abandon ability');
1650 driver.sleep(generateDelay).then(function() {
1651 driver.findElement(By.css('.seed'))
1652 .getAttribute("value")
1653 .then(function(seed) {
1654 expect(seed).toBe("20da140d3dd1df8713cefcc4d54ce0e445b4151027a1ab567b832f6da5fcc5afc1c3a3f199ab78b8e0ab4652efd7f414ac2c9a3b81bceb879a70f377aa0a58f3");
1655 done();
1656 })
1657 });
1658 });
1659
1660 // BIP32 root key is set from phrase
1661 it('Sets the bip39 root key from the prhase', function(done) {
1662 driver.findElement(By.css('.phrase'))
1663 .sendKeys('abandon abandon ability');
1664 driver.sleep(generateDelay).then(function() {
1665 driver.findElement(By.css('.root-key'))
1666 .getAttribute("value")
1667 .then(function(seed) {
1668 expect(seed).toBe("xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi");
1669 done();
1670 })
1671 });
1672 });
1673
1674 // Tabs show correct addresses when changed
1675 it('Shows the correct address when tab is changed', function(done) {
1676 driver.findElement(By.css('.phrase'))
1677 .sendKeys('abandon abandon ability');
1678 driver.sleep(generateDelay).then(function() {
1679 driver.findElement(By.css('#bip32-tab a'))
1680 .click();
1681 driver.sleep(generateDelay).then(function() {
1682 getFirstAddress(function(address) {
1683 expect(address).toBe("17uQ7s2izWPwBmEVFikTmZUjbBKWYdJchz");
1684 done();
1685 });
1686 });
1687 });
1688 });
1689
1690 // BIP44 derivation path is shown
1691 it('Shows the derivation path for bip44 tab', function(done) {
1692 driver.findElement(By.css('.phrase'))
1693 .sendKeys('abandon abandon ability');
1694 driver.sleep(generateDelay).then(function() {
1695 driver.findElement(By.css('#bip44 .path'))
1696 .getAttribute("value")
1697 .then(function(path) {
1698 expect(path).toBe("m/44'/0'/0'/0");
1699 done();
1700 })
1701 });
1702 });
1703
1704 // BIP44 extended private key is shown
1705 it('Shows the extended private key for bip44 tab', function(done) {
1706 driver.findElement(By.css('.phrase'))
1707 .sendKeys('abandon abandon ability');
1708 driver.sleep(generateDelay).then(function() {
1709 driver.findElement(By.css('.extended-priv-key'))
1710 .getAttribute("value")
1711 .then(function(path) {
1712 expect(path).toBe("xprvA2DxxvPZcyRvYgZMGS53nadR32mVDeCyqQYyFhrCVbJNjPoxMeVf7QT5g7mQASbTf9Kp4cryvcXnu2qurjWKcrdsr91jXymdCDNxKgLFKJG");
1713 done();
1714 })
1715 });
1716 });
1717
1718 // BIP44 extended public key is shown
1719 it('Shows the extended public key for bip44 tab', function(done) {
1720 driver.findElement(By.css('.phrase'))
1721 .sendKeys('abandon abandon ability');
1722 driver.sleep(generateDelay).then(function() {
1723 driver.findElement(By.css('.extended-pub-key'))
1724 .getAttribute("value")
1725 .then(function(path) {
1726 expect(path).toBe("xpub6FDKNRvTTLzDmAdpNTc49ia9b4byd6vqCdUa46Fp3vqMcC96uBoufCmZXQLiN5AK3iSCJMhf9gT2sxkpyaPepRuA7W3MujV5tGmF5VfbueM");
1727 done();
1728 })
1729 });
1730 });
1731
1732 // BIP44 account field changes address list
1733 it('Changes the address list if bip44 account is changed', function(done) {
1734 driver.findElement(By.css('#bip44 .account'))
1735 .sendKeys('1');
1736 driver.findElement(By.css('.phrase'))
1737 .sendKeys('abandon abandon ability');
1738 driver.sleep(generateDelay).then(function() {
1739 getFirstAddress(function(address) {
1740 expect(address).toBe("1Nq2Wmu726XHCuGhctEtGmhxo3wzk5wZ1H");
1741 done();
1742 });
1743 });
1744 });
1745
1746 // BIP44 change field changes address list
1747 it('Changes the address list if bip44 change is changed', function(done) {
1748 driver.findElement(By.css('#bip44 .change'))
1749 .sendKeys('1');
1750 driver.findElement(By.css('.phrase'))
1751 .sendKeys('abandon abandon ability');
1752 driver.sleep(generateDelay).then(function() {
1753 getFirstAddress(function(address) {
1754 expect(address).toBe("1KAGfWgqfVbSSXY56fNQ7YnhyKuoskHtYo");
1755 done();
1756 });
1757 });
1758 });
1759
1760 // BIP32 derivation path can be set
1761 it('Can use a custom bip32 derivation path', function(done) {
1762 driver.findElement(By.css('#bip32-tab a'))
1763 .click();
1764 driver.findElement(By.css('#bip32 .path'))
1765 .clear();
1766 driver.findElement(By.css('#bip32 .path'))
1767 .sendKeys('m/1');
1768 driver.findElement(By.css('.phrase'))
1769 .sendKeys('abandon abandon ability');
1770 driver.sleep(generateDelay).then(function() {
1771 getFirstAddress(function(address) {
1772 expect(address).toBe("16pYQQdLD1hH4hwTGLXBaZ9Teboi1AGL8L");
1773 done();
1774 });
1775 });
1776 });
1777
1778 // BIP32 can use hardened derivation paths
1779 it('Can use a hardened derivation paths', function(done) {
1780 driver.findElement(By.css('#bip32-tab a'))
1781 .click();
1782 driver.findElement(By.css('#bip32 .path'))
1783 .clear();
1784 driver.findElement(By.css('#bip32 .path'))
1785 .sendKeys("m/0'");
1786 driver.findElement(By.css('.phrase'))
1787 .sendKeys('abandon abandon ability');
1788 driver.sleep(generateDelay).then(function() {
1789 getFirstAddress(function(address) {
1790 expect(address).toBe("14aXZeprXAE3UUKQc4ihvwBvww2LuEoHo4");
1791 done();
1792 });
1793 });
1794 });
1795
1796 // BIP32 extended private key is shown
1797 it('Shows the BIP32 extended private key', function(done) {
1798 driver.findElement(By.css('#bip32-tab a'))
1799 .click();
1800 driver.findElement(By.css('.phrase'))
1801 .sendKeys('abandon abandon ability');
1802 driver.sleep(generateDelay).then(function() {
1803 driver.findElement(By.css('.extended-priv-key'))
1804 .getAttribute("value")
1805 .then(function(privKey) {
1806 expect(privKey).toBe("xprv9va99uTVE5aLiutUVLTyfxfe8v8aaXjSQ1XxZbK6SezYVuikA9MnjQVTA8rQHpNA5LKvyQBpLiHbBQiiccKiBDs7eRmBogsvq3THFeLHYbe");
1807 done();
1808 });
1809 });
1810 });
1811
1812 // BIP32 extended public key is shown
1813 it('Shows the BIP32 extended public key', function(done) {
1814 driver.findElement(By.css('#bip32-tab a'))
1815 .click();
1816 driver.findElement(By.css('.phrase'))
1817 .sendKeys('abandon abandon ability');
1818 driver.sleep(generateDelay).then(function() {
1819 driver.findElement(By.css('.extended-pub-key'))
1820 .getAttribute("value")
1821 .then(function(pubKey) {
1822 expect(pubKey).toBe("xpub69ZVZQzP4T8dwPxwbMzz36cNgwy4yzTHmETZMyihzzXXNi3thgg3HCow1RtY252wdw5rS8369xKnraN5Q93y3FkFfJp2XEHWUrkyXsjS93P");
1823 done();
1824 });
1825 });
1826 });
1827
1828 // Derivation path is shown in table
1829 it('Shows the derivation path in the table', function(done) {
1830 driver.findElement(By.css('.phrase'))
1831 .sendKeys('abandon abandon ability');
1832 driver.sleep(generateDelay).then(function() {
1833 getFirstPath(function(path) {
1834 expect(path).toBe("m/44'/0'/0'/0/0");
1835 done();
1836 });
1837 });
1838 });
1839
1840 // Derivation path for address can be hardened
1841 it('Can derive hardened addresses', function(done) {
1842 driver.findElement(By.css('#bip32-tab a'))
1843 .click();
1844 driver.executeScript(function() {
1845 $(".hardened-addresses").prop("checked", true);
1846 });
1847 driver.findElement(By.css('.phrase'))
1848 .sendKeys('abandon abandon ability');
1849 driver.sleep(generateDelay).then(function() {
1850 getFirstAddress(function(address) {
1851 expect(address).toBe("18exLzUv7kfpiXRzmCjFDoC9qwNLFyvwyd");
1852 done();
1853 });
1854 });
1855 });
1856
1857 // Derivation path visibility can be toggled
1858 it('Can toggle visibility of the derivation path column', function(done) {
1859 driver.findElement(By.css('.phrase'))
1860 .sendKeys('abandon abandon ability');
1861 driver.sleep(generateDelay).then(function() {
1862 driver.findElement(By.css('.index-toggle'))
1863 .click();
1864 testColumnValuesAreInvisible(done, "index");
1865 });
1866 });
1867
1868 // Address is shown
1869 it('Shows the address in the table', function(done) {
1870 driver.findElement(By.css('.phrase'))
1871 .sendKeys('abandon abandon ability');
1872 driver.sleep(generateDelay).then(function() {
1873 getFirstAddress(function(address) {
1874 expect(address).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug");
1875 done();
1876 });
1877 });
1878 });
1879
1880 // Addresses are shown in order of derivation path
1881 it('Shows the address in order of derivation path', function(done) {
1882 driver.findElement(By.css('.phrase'))
1883 .sendKeys('abandon abandon ability');
1884 driver.sleep(generateDelay).then(function() {
1885 testRowsAreInCorrectOrder(done);
1886 });
1887 });
1888
1889 // Address visibility can be toggled
1890 it('Can toggle visibility of the address column', function(done) {
1891 driver.findElement(By.css('.phrase'))
1892 .sendKeys('abandon abandon ability');
1893 driver.sleep(generateDelay).then(function() {
1894 driver.findElement(By.css('.address-toggle'))
1895 .click();
1896 testColumnValuesAreInvisible(done, "address");
1897 });
1898 });
1899
1900 // Public key is shown in table
1901 it('Shows the public key in the table', function(done) {
1902 driver.findElement(By.css('.phrase'))
1903 .sendKeys('abandon abandon ability');
1904 driver.sleep(generateDelay).then(function() {
1905 driver.findElements(By.css('.pubkey'))
1906 .then(function(els) {
1907 els[0].getText()
1908 .then(function(pubkey) {
1909 expect(pubkey).toBe("033f5aed5f6cfbafaf223188095b5980814897295f723815fea5d3f4b648d0d0b3");
1910 done();
1911 });
1912 });
1913 });
1914 });
1915
1916 // Public key visibility can be toggled
1917 it('Can toggle visibility of the public key column', function(done) {
1918 driver.findElement(By.css('.phrase'))
1919 .sendKeys('abandon abandon ability');
1920 driver.sleep(generateDelay).then(function() {
1921 driver.findElement(By.css('.public-key-toggle'))
1922 .click();
1923 testColumnValuesAreInvisible(done, "pubkey");
1924 });
1925 });
1926
1927 // Private key is shown in table
1928 it('Shows the private key in the table', function(done) {
1929 driver.findElement(By.css('.phrase'))
1930 .sendKeys('abandon abandon ability');
1931 driver.sleep(generateDelay).then(function() {
1932 driver.findElements(By.css('.privkey'))
1933 .then(function(els) {
1934 els[0].getText()
1935 .then(function(pubkey) {
1936 expect(pubkey).toBe("L26cVSpWFkJ6aQkPkKmTzLqTdLJ923e6CzrVh9cmx21QHsoUmrEE");
1937 done();
1938 });
1939 });
1940 });
1941 });
1942
1943 // Private key visibility can be toggled
1944 it('Can toggle visibility of the private key column', function(done) {
1945 driver.findElement(By.css('.phrase'))
1946 .sendKeys('abandon abandon ability');
1947 driver.sleep(generateDelay).then(function() {
1948 driver.findElement(By.css('.private-key-toggle'))
1949 .click();
1950 testColumnValuesAreInvisible(done, "privkey");
1951 });
1952 });
1953
1954 // More addresses can be generated
1955 it('Can generate more rows in the table', function(done) {
1956 driver.findElement(By.css('.phrase'))
1957 .sendKeys('abandon abandon ability');
1958 driver.sleep(generateDelay).then(function() {
1959 driver.findElement(By.css('.more'))
1960 .click();
1961 driver.sleep(generateDelay).then(function() {
1962 driver.findElements(By.css('.address'))
1963 .then(function(els) {
1964 expect(els.length).toBe(40);
1965 done();
1966 });
1967 });
1968 });
1969 });
1970
1971 // A custom number of additional addresses can be generated
1972 it('Can generate more rows in the table', function(done) {
1973 driver.findElement(By.css('.phrase'))
1974 .sendKeys('abandon abandon ability');
1975 driver.sleep(generateDelay).then(function() {
1976 driver.findElement(By.css('.rows-to-add'))
1977 .clear();
1978 driver.findElement(By.css('.rows-to-add'))
1979 .sendKeys('1');
1980 driver.findElement(By.css('.more'))
1981 .click();
1982 driver.sleep(generateDelay).then(function() {
1983 driver.findElements(By.css('.address'))
1984 .then(function(els) {
1985 expect(els.length).toBe(21);
1986 done();
1987 });
1988 });
1989 });
1990 });
1991
1992 // Additional addresses are shown in order of derivation path
1993 it('Shows additional addresses in order of derivation path', function(done) {
1994 driver.findElement(By.css('.phrase'))
1995 .sendKeys('abandon abandon ability');
1996 driver.sleep(generateDelay).then(function() {
1997 driver.findElement(By.css('.more'))
1998 .click();
1999 driver.sleep(generateDelay).then(function() {
2000 testRowsAreInCorrectOrder(done);
2001 });
2002 });
2003 });
2004
2005 // BIP32 root key can be set by the user
2006 it('Allows the user to set the BIP32 root key', function(done) {
2007 driver.findElement(By.css('.root-key'))
2008 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi');
2009 driver.sleep(generateDelay).then(function() {
2010 getFirstAddress(function(address) {
2011 expect(address).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug");
2012 done();
2013 });
2014 });
2015 });
2016
2017 // Setting BIP32 root key clears the existing phrase, passphrase and seed
2018 it('Confirms the existing phrase should be cleared', function(done) {
2019 driver.findElement(By.css('.phrase'))
2020 .sendKeys('A non-blank but invalid value');
2021 driver.findElement(By.css('.root-key'))
2022 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi');
2023 driver.switchTo().alert().accept();
2024 driver.findElement(By.css('.phrase'))
2025 .getAttribute("value").then(function(value) {
2026 expect(value).toBe("");
2027 done();
2028 });
2029 });
2030
2031 // Clearing of phrase, passphrase and seed can be cancelled by user
2032 it('Allows the clearing of the phrase to be cancelled', function(done) {
2033 driver.findElement(By.css('.phrase'))
2034 .sendKeys('abandon abandon ability');
2035 driver.sleep(generateDelay).then(function() {
2036 driver.findElement(By.css('.root-key'))
2037 .clear();
2038 driver.findElement(By.css('.root-key'))
2039 .sendKeys('x');
2040 driver.switchTo().alert().dismiss();
2041 driver.findElement(By.css('.phrase'))
2042 .getAttribute("value").then(function(value) {
2043 expect(value).toBe("abandon abandon ability");
2044 done();
2045 });
2046 });
2047 });
2048
2049 // Custom BIP32 root key is used when changing the derivation path
2050 it('Can set derivation path for root key instead of phrase', function(done) {
2051 driver.findElement(By.css('#bip44 .account'))
2052 .sendKeys('1');
2053 driver.findElement(By.css('.root-key'))
2054 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi');
2055 driver.sleep(generateDelay).then(function() {
2056 getFirstAddress(function(address) {
2057 expect(address).toBe("1Nq2Wmu726XHCuGhctEtGmhxo3wzk5wZ1H");
2058 done();
2059 });
2060 });
2061 });
2062
2063 // Incorrect mnemonic shows error
2064 it('Shows an error for incorrect mnemonic', function(done) {
2065 driver.findElement(By.css('.phrase'))
2066 .sendKeys('abandon abandon abandon');
2067 driver.sleep(feedbackDelay).then(function() {
2068 driver.findElement(By.css('.feedback'))
2069 .getText()
2070 .then(function(feedback) {
2071 expect(feedback).toBe("Invalid mnemonic");
2072 done();
2073 });
2074 });
2075 });
2076
2077 // Incorrect word shows suggested replacement
2078 it('Shows word suggestion for incorrect word', function(done) {
2079 driver.findElement(By.css('.phrase'))
2080 .sendKeys('abandon abandon abiliti');
2081 driver.sleep(feedbackDelay).then(function() {
2082 driver.findElement(By.css('.feedback'))
2083 .getText()
2084 .then(function(feedback) {
2085 var msg = "abiliti not in wordlist, did you mean ability?";
2086 expect(feedback).toBe(msg);
2087 done();
2088 });
2089 });
2090 });
2091
2092 // Github pull request 48
2093 // First four letters of word shows that word, not closest
2094 // since first four letters gives unique word in BIP39 wordlist
2095 // eg ille should show illegal, not idle
2096 it('Shows word suggestion based on first four chars', function(done) {
2097 driver.findElement(By.css('.phrase'))
2098 .sendKeys('ille');
2099 driver.sleep(feedbackDelay).then(function() {
2100 driver.findElement(By.css('.feedback'))
2101 .getText()
2102 .then(function(feedback) {
2103 var msg = "ille not in wordlist, did you mean illegal?";
2104 expect(feedback).toBe(msg);
2105 done();
2106 });
2107 });
2108 });
2109
2110 // Incorrect BIP32 root key shows error
2111 it('Shows error for incorrect root key', function(done) {
2112 driver.findElement(By.css('.root-key'))
2113 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpj');
2114 driver.sleep(feedbackDelay).then(function() {
2115 driver.findElement(By.css('.feedback'))
2116 .getText()
2117 .then(function(feedback) {
2118 var msg = "Invalid root key";
2119 expect(feedback).toBe(msg);
2120 done();
2121 });
2122 });
2123 });
2124
2125 // Derivation path not starting with m shows error
2126 it('Shows error for derivation path not starting with m', function(done) {
2127 driver.findElement(By.css('#bip32-tab a'))
2128 .click();
2129 driver.findElement(By.css('#bip32 .path'))
2130 .clear();
2131 driver.findElement(By.css('#bip32 .path'))
2132 .sendKeys('n/0');
2133 driver.findElement(By.css('.phrase'))
2134 .sendKeys('abandon abandon ability');
2135 driver.sleep(feedbackDelay).then(function() {
2136 driver.findElement(By.css('.feedback'))
2137 .getText()
2138 .then(function(feedback) {
2139 var msg = "First character must be 'm'";
2140 expect(feedback).toBe(msg);
2141 done();
2142 });
2143 });
2144 });
2145
2146 // Derivation path containing invalid characters shows useful error
2147 it('Shows error for derivation path not starting with m', function(done) {
2148 driver.findElement(By.css('#bip32-tab a'))
2149 .click();
2150 driver.findElement(By.css('#bip32 .path'))
2151 .clear();
2152 driver.findElement(By.css('#bip32 .path'))
2153 .sendKeys('m/1/0wrong1/1');
2154 driver.findElement(By.css('.phrase'))
2155 .sendKeys('abandon abandon ability');
2156 driver.sleep(feedbackDelay).then(function() {
2157 driver.findElement(By.css('.feedback'))
2158 .getText()
2159 .then(function(feedback) {
2160 var msg = "Invalid characters 0wrong1 found at depth 2";
2161 expect(feedback).toBe(msg);
2162 done();
2163 });
2164 });
2165 });
2166
2167 // Github Issue 11: Default word length is 15
2168 // https://github.com/iancoleman/bip39/issues/11
2169 it('Sets the default word length to 15', function(done) {
2170 driver.findElement(By.css('.strength'))
2171 .getAttribute("value")
2172 .then(function(strength) {
2173 expect(strength).toBe("15");
2174 done();
2175 });
2176 });
2177
2178 // Github Issue 12: Generate more rows with private keys hidden
2179 // https://github.com/iancoleman/bip39/issues/12
2180 it('Sets the correct hidden column state on new rows', function(done) {
2181 driver.findElement(By.css('.phrase'))
2182 .sendKeys("abandon abandon ability");
2183 driver.sleep(generateDelay).then(function() {
2184 driver.findElement(By.css('.private-key-toggle'))
2185 .click();
2186 driver.findElement(By.css('.more'))
2187 .click();
2188 driver.sleep(generateDelay).then(function() {
2189 driver.findElements(By.css('.privkey'))
2190 .then(function(els) {
2191 expect(els.length).toBe(40);
2192 });
2193 testColumnValuesAreInvisible(done, "privkey");
2194 });
2195 });
2196 });
2197
2198 // Github Issue 19: Mnemonic is not sensitive to whitespace
2199 // https://github.com/iancoleman/bip39/issues/19
2200 it('Ignores excess whitespace in the mnemonic', function(done) {
2201 var doublespace = " ";
2202 var mnemonic = "urge cat" + doublespace + "bid";
2203 driver.findElement(By.css('.phrase'))
2204 .sendKeys(mnemonic);
2205 driver.sleep(generateDelay).then(function() {
2206 driver.findElement(By.css('.root-key'))
2207 .getAttribute("value")
2208 .then(function(seed) {
2209 expect(seed).toBe("xprv9s21ZrQH143K3isaZsWbKVoTtbvd34Y1ZGRugGdMeBGbM3AgBVzTH159mj1cbbtYSJtQr65w6L5xy5L9SFC7c9VJZWHxgAzpj4mun5LhrbC");
2210 done();
2211 });
2212 });
2213 });
2214
2215 // Github Issue 23: Part 1: Use correct derivation path when changing tabs
2216 // https://github.com/iancoleman/bip39/issues/23
2217 // This test was failing for default timeout of 5000ms so changed it to +10s
2218 it('Uses the correct derivation path when changing tabs', function(done) {
2219 // 1) and 2) set the phrase
2220 driver.findElement(By.css('.phrase'))
2221 .sendKeys("abandon abandon ability");
2222 driver.sleep(generateDelay).then(function() {
2223 // 3) select bip32 tab
2224 driver.findElement(By.css('#bip32-tab a'))
2225 .click();
2226 driver.sleep(generateDelay).then(function() {
2227 // 4) switch from bitcoin to litecoin
2228 selectNetwork("LTC - Litecoin");
2229 driver.sleep(generateDelay).then(function() {
2230 // 5) Check address is displayed correctly
2231 getFirstAddress(function(address) {
2232 expect(address).toBe("LS8MP5LZ5AdzSZveRrjm3aYVoPgnfFh5T5");
2233 // 5) Check derivation path is displayed correctly
2234 getFirstPath(function(path) {
2235 expect(path).toBe("m/0/0");
2236 done();
2237 });
2238 });
2239 });
2240 });
2241 });
2242 }, generateDelay + 10000);
2243
2244 // Github Issue 23 Part 2: Coin selection in derivation path
2245 // https://github.com/iancoleman/bip39/issues/23#issuecomment-238011920
2246 it('Uses the correct derivation path when changing coins', function(done) {
2247 // set the phrase
2248 driver.findElement(By.css('.phrase'))
2249 .sendKeys("abandon abandon ability");
2250 driver.sleep(generateDelay).then(function() {
2251 // switch from bitcoin to clam
2252 selectNetwork("CLAM - Clams");
2253 driver.sleep(generateDelay).then(function() {
2254 // check derivation path is displayed correctly
2255 getFirstPath(function(path) {
2256 expect(path).toBe("m/44'/23'/0'/0/0");
2257 done();
2258 });
2259 });
2260 });
2261 });
2262
2263 // Github Issue 26: When using a Root key derrived altcoins are incorrect
2264 // https://github.com/iancoleman/bip39/issues/26
2265 it('Uses the correct derivation for altcoins with root keys', function(done) {
2266 // 1) 2) and 3) set the root key
2267 driver.findElement(By.css('.root-key'))
2268 .sendKeys("xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi");
2269 driver.sleep(generateDelay).then(function() {
2270 // 4) switch from bitcoin to viacoin
2271 selectNetwork("VIA - Viacoin");
2272 driver.sleep(generateDelay).then(function() {
2273 // 5) ensure the derived address is correct
2274 getFirstAddress(function(address) {
2275 expect(address).toBe("Vq9Eq4N5SQnjqZvxtxzo7hZPW5XnyJsmXT");
2276 done();
2277 });
2278 });
2279 });
2280 });
2281
2282 // Selecting a language with no existing phrase should generate a phrase in
2283 // that language.
2284 it('Generate a random phrase when language is selected and no current phrase', function(done) {
2285 driver.findElement(By.css("a[href='#japanese']"))
2286 .click();
2287 driver.sleep(generateDelay).then(function() {
2288 driver.findElement(By.css(".phrase"))
2289 .getAttribute("value").then(function(phrase) {
2290 expect(phrase.search(/[a-z]/)).toBe(-1);
2291 expect(phrase.length).toBeGreaterThan(0);
2292 done();
2293 });
2294 });
2295 });
2296
2297 // Selecting a language with existing phrase should update the phrase to use
2298 // that language.
2299 it('Updates existing phrases when the language is changed', function(done) {
2300 driver.findElement(By.css(".phrase"))
2301 .sendKeys("abandon abandon ability");
2302 driver.sleep(generateDelay).then(function() {
2303 driver.findElement(By.css("a[href='#italian']"))
2304 .click();
2305 driver.sleep(generateDelay).then(function() {
2306 driver.findElement(By.css(".phrase"))
2307 .getAttribute("value").then(function(phrase) {
2308 // Check only the language changes, not the phrase
2309 expect(phrase).toBe("abaco abaco abbaglio");
2310 getFirstAddress(function(address) {
2311 // Check the address is correct
2312 expect(address).toBe("1Dz5TgDhdki9spa6xbPFbBqv5sjMrx3xgV");
2313 done();
2314 });
2315 });
2316 });
2317 });
2318 });
2319
2320 // Suggested replacement for erroneous word in non-English language
2321 it('Shows word suggestion for incorrect word in non-English language', function(done) {
2322 driver.findElement(By.css('.phrase'))
2323 .sendKeys('abaco abaco zbbaglio');
2324 driver.sleep(feedbackDelay).then(function() {
2325 driver.findElement(By.css('.feedback'))
2326 .getText()
2327 .then(function(feedback) {
2328 var msg = "zbbaglio not in wordlist, did you mean abbaglio?";
2329 expect(feedback).toBe(msg);
2330 done();
2331 });
2332 });
2333 });
2334
2335 // Japanese word does not break across lines.
2336 // Point 2 from
2337 // https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md#japanese
2338 it('Does not break Japanese words across lines', function(done) {
2339 driver.findElement(By.css('.phrase'))
2340 .getCssValue("word-break")
2341 .then(function(value) {
2342 expect(value).toBe("keep-all");
2343 done();
2344 });
2345 });
2346
2347 // Language can be specified at page load using hash value in url
2348 it('Can set the language from the url hash', function(done) {
2349 driver.get(url + "#japanese").then(function() {
2350 driver.findElement(By.css('.generate')).click();
2351 driver.sleep(generateDelay).then(function() {
2352 driver.findElement(By.css(".phrase"))
2353 .getAttribute("value").then(function(phrase) {
2354 expect(phrase.search(/[a-z]/)).toBe(-1);
2355 expect(phrase.length).toBeGreaterThan(0);
2356 done();
2357 });
2358 });
2359 });
2360 });
2361
2362 // Entropy can be entered by the user
2363 it('Allows entropy to be entered', function(done) {
2364 driver.findElement(By.css('.use-entropy'))
2365 .click();
2366 driver.findElement(By.css('.entropy'))
2367 .sendKeys('00000000 00000000 00000000 00000000');
2368 driver.sleep(generateDelay).then(function() {
2369 driver.findElement(By.css(".phrase"))
2370 .getAttribute("value").then(function(phrase) {
2371 expect(phrase).toBe("abandon abandon ability");
2372 getFirstAddress(function(address) {
2373 expect(address).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug");
2374 done();
2375 })
2376 });
2377 });
2378 });
2379
2380 // A warning about entropy is shown to the user, with additional information
2381 it('Shows a warning about using entropy', function(done) {
2382 driver.findElement(By.css('.use-entropy'))
2383 .click();
2384 driver.findElement(By.css('.entropy-container'))
2385 .getText()
2386 .then(function(containerText) {
2387 var warning = "mnemonic may be insecure";
2388 expect(containerText).toContain(warning);
2389 driver.findElement(By.css('#entropy-notes'))
2390 .findElement(By.xpath("parent::*"))
2391 .getText()
2392 .then(function(notesText) {
2393 var detail = "flipping a fair coin, rolling a fair dice, noise measurements etc";
2394 expect(notesText).toContain(detail);
2395 done();
2396 });
2397 });
2398 });
2399
2400 // The types of entropy available are described to the user
2401 it('Shows the types of entropy available', function(done) {
2402 driver.findElement(By.css('.entropy'))
2403 .getAttribute("placeholder")
2404 .then(function(placeholderText) {
2405 var options = [
2406 "binary",
2407 "base 6",
2408 "dice",
2409 "base 10",
2410 "hexadecimal",
2411 "cards",
2412 ];
2413 for (var i=0; i<options.length; i++) {
2414 var option = options[i];
2415 expect(placeholderText).toContain(option);
2416 }
2417 done();
2418 });
2419 });
2420
2421 // The actual entropy used is shown to the user
2422 it('Shows the actual entropy used', function(done) {
2423 driver.findElement(By.css('.use-entropy'))
2424 .click();
2425 driver.findElement(By.css('.entropy'))
2426 .sendKeys('Not A Very Good Entropy Source At All');
2427 driver.sleep(generateDelay).then(function() {
2428 driver.findElement(By.css('.entropy-container'))
2429 .getText()
2430 .then(function(text) {
2431 expect(text).toMatch(/Filtered Entropy\s+AedEceAA/);
2432 done();
2433 });
2434 });
2435 });
2436
2437 // Binary entropy can be entered
2438 it('Allows binary entropy to be entered', function(done) {
2439 testEntropyType(done, "01", "binary");
2440 });
2441
2442 // Base 6 entropy can be entered
2443 it('Allows base 6 entropy to be entered', function(done) {
2444 testEntropyType(done, "012345", "base 6");
2445 });
2446
2447 // Base 6 dice entropy can be entered
2448 it('Allows base 6 dice entropy to be entered', function(done) {
2449 testEntropyType(done, "123456", "base 6 (dice)");
2450 });
2451
2452 // Base 10 entropy can be entered
2453 it('Allows base 10 entropy to be entered', function(done) {
2454 testEntropyType(done, "789", "base 10");
2455 });
2456
2457 // Hexadecimal entropy can be entered
2458 it('Allows hexadecimal entropy to be entered', function(done) {
2459 testEntropyType(done, "abcdef", "hexadecimal");
2460 });
2461
2462 // Dice entropy value is shown as the converted base 6 value
2463 // ie 123456 is converted to 123450
2464 it('Shows dice entropy as base 6', function(done) {
2465 driver.findElement(By.css('.use-entropy'))
2466 .click();
2467 driver.findElement(By.css('.entropy'))
2468 .sendKeys("123456");
2469 driver.sleep(generateDelay).then(function() {
2470 driver.findElement(By.css('.entropy-container'))
2471 .getText()
2472 .then(function(text) {
2473 expect(text).toMatch(/Filtered Entropy\s+123450/);
2474 done();
2475 });
2476 });
2477 });
2478
2479 // The number of bits of entropy accumulated is shown
2480 it("Shows the number of bits of entropy for 20 bits of binary", function(done) {
2481 testEntropyBits(done, "0000 0000 0000 0000 0000", "20");
2482 });
2483 it("Shows the number of bits of entropy for 1 bit of binary", function(done) {
2484 testEntropyBits(done, "0", "1");
2485 });
2486 it("Shows the number of bits of entropy for 4 bits of binary", function(done) {
2487 testEntropyBits(done, "0000", "4");
2488 });
2489 it("Shows the number of bits of entropy for 1 character of base 6 (dice)", function(done) {
2490 // 6 in card is 0 in base 6, 0 in base 6 is 2.6 bits (rounded down to 2 bits)
2491 testEntropyBits(done, "6", "2");
2492 });
2493 it("Shows the number of bits of entropy for 1 character of base 10 with 3 bits", function(done) {
2494 // 7 in base 10 is 111 in base 2, no leading zeros
2495 testEntropyBits(done, "7", "3");
2496 });
2497 it("Shows the number of bits of entropy for 1 character of base 10 with 4 bis", function(done) {
2498 testEntropyBits(done, "8", "4");
2499 });
2500 it("Shows the number of bits of entropy for 1 character of hex", function(done) {
2501 testEntropyBits(done, "F", "4");
2502 });
2503 it("Shows the number of bits of entropy for 2 characters of base 10", function(done) {
2504 testEntropyBits(done, "29", "6");
2505 });
2506 it("Shows the number of bits of entropy for 2 characters of hex", function(done) {
2507 testEntropyBits(done, "0A", "8");
2508 });
2509 it("Shows the number of bits of entropy for 2 characters of hex with 3 leading zeros", function(done) {
2510 // hex is always multiple of 4 bits of entropy
2511 testEntropyBits(done, "1A", "8");
2512 });
2513 it("Shows the number of bits of entropy for 2 characters of hex with 2 leading zeros", function(done) {
2514 testEntropyBits(done, "2A", "8");
2515 });
2516 it("Shows the number of bits of entropy for 2 characters of hex with 1 leading zero", function(done) {
2517 testEntropyBits(done, "4A", "8");
2518 });
2519 it("Shows the number of bits of entropy for 2 characters of hex with no leading zeros", function(done) {
2520 testEntropyBits(done, "8A", "8");
2521 });
2522 it("Shows the number of bits of entropy for 2 characters of hex starting with F", function(done) {
2523 testEntropyBits(done, "FA", "8");
2524 });
2525 it("Shows the number of bits of entropy for 4 characters of hex with leading zeros", function(done) {
2526 testEntropyBits(done, "000A", "16");
2527 });
2528 it("Shows the number of bits of entropy for 4 characters of base 6", function(done) {
2529 testEntropyBits(done, "5555", "11");
2530 });
2531 it("Shows the number of bits of entropy for 4 characters of base 6 dice", function(done) {
2532 // uses dice, so entropy is actually 0000 in base 6, which is 4 lots of
2533 // 2.58 bits, which is 10.32 bits (rounded down to 10 bits)
2534 testEntropyBits(done, "6666", "10");
2535 });
2536 it("Shows the number of bits of entropy for 4 charactes of base 10", function(done) {
2537 // Uses base 10, which is 4 lots of 3.32 bits, which is 13.3 bits (rounded
2538 // down to 13)
2539 testEntropyBits(done, "2227", "13");
2540 });
2541 it("Shows the number of bits of entropy for 4 characters of hex with 2 leading zeros", function(done) {
2542 testEntropyBits(done, "222F", "16");
2543 });
2544 it("Shows the number of bits of entropy for 4 characters of hex starting with F", function(done) {
2545 testEntropyBits(done, "FFFF", "16");
2546 });
2547 it("Shows the number of bits of entropy for 10 characters of base 10", function(done) {
2548 // 10 events at 3.32 bits per event
2549 testEntropyBits(done, "0000101017", "33");
2550 });
2551 it("Shows the number of bits of entropy for a full deck of cards", function(done) {
2552 // cards are not replaced, so a full deck is not 52^52 entropy which is 296
2553 // bits, it's 52!, which is 225 bits
2554 testEntropyBits(done, "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks", "225");
2555 });
2556
2557 it("Shows details about the entered entropy", function(done) {
2558 testEntropyFeedback(done,
2559 {
2560 entropy: "A",
2561 filtered: "A",
2562 type: "hexadecimal",
2563 events: "1",
2564 bits: "4",
2565 words: 0,
2566 strength: "less than a second",
2567 }
2568 );
2569 });
2570 it("Shows details about the entered entropy", function(done) {
2571 testEntropyFeedback(done,
2572 {
2573 entropy: "AAAAAAAA",
2574 filtered: "AAAAAAAA",
2575 type: "hexadecimal",
2576 events: "8",
2577 bits: "32",
2578 words: 3,
2579 strength: "less than a second - Repeats like \"aaa\" are easy to guess",
2580 }
2581 );
2582 });
2583 it("Shows details about the entered entropy", function(done) {
2584 testEntropyFeedback(done,
2585 {
2586 entropy: "AAAAAAAA B",
2587 filtered: "AAAAAAAAB",
2588 type: "hexadecimal",
2589 events: "9",
2590 bits: "36",
2591 words: 3,
2592 strength: "less than a second - Repeats like \"aaa\" are easy to guess",
2593 }
2594 );
2595 });
2596 it("Shows details about the entered entropy", function(done) {
2597 testEntropyFeedback(done,
2598 {
2599 entropy: "AAAAAAAA BBBBBBBB",
2600 filtered: "AAAAAAAABBBBBBBB",
2601 type: "hexadecimal",
2602 events: "16",
2603 bits: "64",
2604 words: 6,
2605 strength: "less than a second - Repeats like \"aaa\" are easy to guess",
2606 }
2607 );
2608 });
2609 it("Shows details about the entered entropy", function(done) {
2610 testEntropyFeedback(done,
2611 {
2612 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC",
2613 filtered: "AAAAAAAABBBBBBBBCCCCCCCC",
2614 type: "hexadecimal",
2615 events: "24",
2616 bits: "96",
2617 words: 9,
2618 strength: "less than a second",
2619 }
2620 );
2621 });
2622 it("Shows details about the entered entropy", function(done) {
2623 testEntropyFeedback(done,
2624 {
2625 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD",
2626 filtered: "AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDD",
2627 type: "hexadecimal",
2628 events: "32",
2629 bits: "128",
2630 words: 12,
2631 strength: "2 minutes",
2632 }
2633 );
2634 });
2635 it("Shows details about the entered entropy", function(done) {
2636 testEntropyFeedback(done,
2637 {
2638 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDA",
2639 filtered: "AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDA",
2640 type: "hexadecimal",
2641 events: "32",
2642 bits: "128",
2643 words: 12,
2644 strength: "2 days",
2645 }
2646 );
2647 });
2648 it("Shows details about the entered entropy", function(done) {
2649 testEntropyFeedback(done,
2650 {
2651 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDA EEEEEEEE",
2652 filtered: "AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDAEEEEEEEE",
2653 type: "hexadecimal",
2654 events: "40",
2655 bits: "160",
2656 words: 15,
2657 strength: "3 years",
2658 }
2659 );
2660 });
2661 it("Shows details about the entered entropy", function(done) {
2662 testEntropyFeedback(done,
2663 {
2664 entropy: "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDA EEEEEEEE FFFFFFFF",
2665 filtered: "AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDAEEEEEEEEFFFFFFFF",
2666 type: "hexadecimal",
2667 events: "48",
2668 bits: "192",
2669 words: 18,
2670 strength: "centuries",
2671 }
2672 );
2673 });
2674 it("Shows details about the entered entropy", function(done) {
2675 testEntropyFeedback(done,
2676 {
2677 entropy: "7d",
2678 type: "card",
2679 events: "1",
2680 bits: "4",
2681 words: 0,
2682 strength: "less than a second",
2683 }
2684 );
2685 });
2686 it("Shows details about the entered entropy", function(done) {
2687 testEntropyFeedback(done,
2688 {
2689 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
2690 type: "card (full deck)",
2691 events: "52",
2692 bits: "225",
2693 words: 21,
2694 strength: "centuries",
2695 }
2696 );
2697 });
2698 it("Shows details about the entered entropy", function(done) {
2699 testEntropyFeedback(done,
2700 {
2701 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks3d",
2702 type: "card (full deck, 1 duplicate: 3d)",
2703 events: "53",
2704 bits: "254",
2705 words: 21,
2706 strength: "centuries",
2707 }
2708 );
2709 });
2710 it("Shows details about the entered entropy", function(done) {
2711 testEntropyFeedback(done,
2712 {
2713 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqs3d4d",
2714 type: "card (2 duplicates: 3d 4d, 1 missing: KS)",
2715 events: "53",
2716 bits: "254",
2717 words: 21,
2718 strength: "centuries",
2719 }
2720 );
2721 });
2722 it("Shows details about the entered entropy", function(done) {
2723 testEntropyFeedback(done,
2724 {
2725 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqs3d4d5d6d",
2726 type: "card (4 duplicates: 3d 4d 5d..., 1 missing: KS)",
2727 events: "55",
2728 bits: "264",
2729 words: 24,
2730 strength: "centuries",
2731 }
2732 );
2733 });
2734 it("Shows details about the entered entropy", function(done) {
2735 testEntropyFeedback(done,
2736 // Next test was throwing uncaught error in zxcvbn
2737 // Also tests 451 bits, ie Math.log2(52!)*2 = 225.58 * 2
2738 {
2739 entropy: "ac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsksac2c3c4c5c6c7c8c9ctcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
2740 type: "card (full deck, 52 duplicates: ac 2c 3c...)",
2741 events: "104",
2742 bits: "499",
2743 words: 45,
2744 strength: "centuries",
2745 }
2746 );
2747 });
2748 it("Shows details about the entered entropy", function(done) {
2749 testEntropyFeedback(done,
2750 // Case insensitivity to duplicate cards
2751 {
2752 entropy: "asAS",
2753 type: "card (1 duplicate: AS)",
2754 events: "2",
2755 bits: "9",
2756 words: 0,
2757 strength: "less than a second",
2758 }
2759 );
2760 });
2761 it("Shows details about the entered entropy", function(done) {
2762 testEntropyFeedback(done,
2763 {
2764 entropy: "ASas",
2765 type: "card (1 duplicate: as)",
2766 events: "2",
2767 bits: "9",
2768 words: 0,
2769 strength: "less than a second",
2770 }
2771 );
2772 });
2773 it("Shows details about the entered entropy", function(done) {
2774 testEntropyFeedback(done,
2775 // Missing cards are detected
2776 {
2777 entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d5d6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
2778 type: "card (1 missing: 9C)",
2779 events: "51",
2780 bits: "221",
2781 words: 18,
2782 strength: "centuries",
2783 }
2784 );
2785 });
2786 it("Shows details about the entered entropy", function(done) {
2787 testEntropyFeedback(done,
2788 {
2789 entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d 6d7d8d9dtdjdqdkdah2h3h4h5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
2790 type: "card (2 missing: 9C 5D)",
2791 events: "50",
2792 bits: "216",
2793 words: 18,
2794 strength: "centuries",
2795 }
2796 );
2797 });
2798 it("Shows details about the entered entropy", function(done) {
2799 testEntropyFeedback(done,
2800 {
2801 entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d 6d7d8d9dtdjd kdah2h3h 5h6h7h8h9hthjhqhkhas2s3s4s5s6s7s8s9stsjsqsks",
2802 type: "card (4 missing: 9C 5D QD...)",
2803 events: "48",
2804 bits: "208",
2805 words: 18,
2806 strength: "centuries",
2807 }
2808 );
2809 });
2810 it("Shows details about the entered entropy", function(done) {
2811 testEntropyFeedback(done,
2812 // More than six missing cards does not show message
2813 {
2814 entropy: "ac2c3c4c5c6c7c8c tcjcqckcad2d3d4d 6d 8d9d jd kdah2h3h 5h6h7h8h9hthjhqhkh 2s3s4s5s6s7s8s9stsjsqsks",
2815 type: "card",
2816 events: "45",
2817 bits: "195",
2818 words: 18,
2819 strength: "centuries",
2820 }
2821 );
2822 });
2823 it("Shows details about the entered entropy", function(done) {
2824 testEntropyFeedback(done,
2825 // Multiple decks of cards increases bits per event
2826 {
2827 entropy: "3d",
2828 events: "1",
2829 bits: "4",
2830 bitsPerEvent: "4.34",
2831 }
2832 );
2833 });
2834 it("Shows details about the entered entropy", function(done) {
2835 testEntropyFeedback(done,
2836 {
2837 entropy: "3d3d",
2838 events: "2",
2839 bits: "9",
2840 bitsPerEvent: "4.80",
2841 }
2842 );
2843 });
2844 it("Shows details about the entered entropy", function(done) {
2845 testEntropyFeedback(done,
2846 {
2847 entropy: "3d3d3d",
2848 events: "3",
2849 bits: "15",
2850 bitsPerEvent: "5.01",
2851 }
2852 );
2853 });
2854 it("Shows details about the entered entropy", function(done) {
2855 testEntropyFeedback(done,
2856 {
2857 entropy: "3d3d3d3d",
2858 events: "4",
2859 bits: "20",
2860 bitsPerEvent: "5.14",
2861 }
2862 );
2863 });
2864 it("Shows details about the entered entropy", function(done) {
2865 testEntropyFeedback(done,
2866 {
2867 entropy: "3d3d3d3d3d",
2868 events: "5",
2869 bits: "26",
2870 bitsPerEvent: "5.22",
2871 }
2872 );
2873 });
2874 it("Shows details about the entered entropy", function(done) {
2875 testEntropyFeedback(done,
2876 {
2877 entropy: "3d3d3d3d3d3d",
2878 events: "6",
2879 bits: "31",
2880 bitsPerEvent: "5.28",
2881 }
2882 );
2883 });
2884 it("Shows details about the entered entropy", function(done) {
2885 testEntropyFeedback(done,
2886 {
2887 entropy: "3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d",
2888 events: "33",
2889 bits: "184",
2890 bitsPerEvent: "5.59",
2891 strength: 'less than a second - Repeats like "abcabcabc" are only slightly harder to guess than "abc"',
2892 }
2893 );
2894 });
2895
2896 // Entropy is truncated from the left
2897 it('Truncates entropy from the left', function(done) {
2898 // Truncate from left means 0000 is removed from the start
2899 // which gives mnemonic 'avocado zoo zone'
2900 // not 1111 removed from the end
2901 // which gives the mnemonic 'abstract zoo zoo'
2902 var entropy = "00000000 00000000 00000000 00000000";
2903 entropy += "11111111 11111111 11111111 1111"; // Missing last byte
2904 driver.findElement(By.css('.use-entropy'))
2905 .click();
2906 driver.findElement(By.css('.entropy'))
2907 .sendKeys(entropy);
2908 driver.sleep(generateDelay).then(function() {
2909 driver.findElement(By.css(".phrase"))
2910 .getAttribute("value").then(function(phrase) {
2911 expect(phrase).toBe("avocado zoo zone");
2912 done();
2913 });
2914 });
2915 });
2916
2917 // Very large entropy results in very long mnemonics
2918 it('Converts very long entropy to very long mnemonics', function(done) {
2919 var entropy = "";
2920 for (var i=0; i<33; i++) {
2921 entropy += "AAAAAAAA"; // 3 words * 33 iterations = 99 words
2922 }
2923 driver.findElement(By.css('.use-entropy'))
2924 .click();
2925 driver.findElement(By.css('.entropy'))
2926 .sendKeys(entropy);
2927 driver.sleep(generateDelay).then(function() {
2928 driver.findElement(By.css(".phrase"))
2929 .getAttribute("value").then(function(phrase) {
2930 var wordCount = phrase.split(/\s+/g).length;
2931 expect(wordCount).toBe(99);
2932 done();
2933 });
2934 });
2935 });
2936
2937 // Is compatible with bip32jp entropy
2938 // https://bip32jp.github.io/english/index.html
2939 // NOTES:
2940 // Is incompatible with:
2941 // base 20
2942 it('Is compatible with bip32jp.github.io', function(done) {
2943 var entropy = "543210543210543210543210543210543210543210543210543210543210543210543210543210543210543210543210543";
2944 var expectedPhrase = "train then jungle barely whip fiber purpose puppy eagle cloud clump hospital robot brave balcony utility detect estate old green desk skill multiply virus";
2945 driver.findElement(By.css('.use-entropy'))
2946 .click();
2947 driver.findElement(By.css('.entropy'))
2948 .sendKeys(entropy);
2949 driver.sleep(generateDelay).then(function() {
2950 driver.findElement(By.css(".phrase"))
2951 .getAttribute("value").then(function(phrase) {
2952 expect(phrase).toBe(expectedPhrase);
2953 done();
2954 });
2955 });
2956 });
2957
2958 // Blank entropy does not generate mnemonic or addresses
2959 it('Does not generate mnemonic for blank entropy', function(done) {
2960 driver.findElement(By.css('.use-entropy'))
2961 .click();
2962 driver.findElement(By.css('.entropy'))
2963 .clear();
2964 // check there is no mnemonic
2965 driver.sleep(generateDelay).then(function() {
2966 driver.findElement(By.css(".phrase"))
2967 .getAttribute("value").then(function(phrase) {
2968 expect(phrase).toBe("");
2969 // check there is no mnemonic
2970 driver.findElements(By.css(".address"))
2971 .then(function(addresses) {
2972 expect(addresses.length).toBe(0);
2973 // Check the feedback says 'blank entropy'
2974 driver.findElement(By.css(".feedback"))
2975 .getText()
2976 .then(function(feedbackText) {
2977 expect(feedbackText).toBe("Blank entropy");
2978 done();
2979 });
2980 })
2981 });
2982 });
2983 });
2984
2985 // Mnemonic length can be selected even for weak entropy
2986 it('Allows selection of mnemonic length even for weak entropy', function(done) {
2987 driver.findElement(By.css('.use-entropy'))
2988 .click();
2989 driver.executeScript(function() {
2990 $(".mnemonic-length").val("18").trigger("change");
2991 });
2992 driver.findElement(By.css('.entropy'))
2993 .sendKeys("012345");
2994 driver.sleep(generateDelay).then(function() {
2995 driver.findElement(By.css(".phrase"))
2996 .getAttribute("value").then(function(phrase) {
2997 var wordCount = phrase.split(/\s+/g).length;
2998 expect(wordCount).toBe(18);
2999 done();
3000 });
3001 });
3002 });
3003
3004 // Github issue 33
3005 // https://github.com/iancoleman/bip39/issues/33
3006 // Final cards should contribute entropy
3007 it('Uses as much entropy as possible for the mnemonic', function(done) {
3008 driver.findElement(By.css('.use-entropy'))
3009 .click();
3010 driver.findElement(By.css('.entropy'))
3011 .sendKeys("7S 9H 9S QH 8C KS AS 7D 7C QD 4S 4D TC 2D 5S JS 3D 8S 8H 4C 3C AC 3S QC 9C JC 7H AD TD JD 6D KH 5C QS 2S 6S 6H JH KD 9D-6C TS TH 4H KC 5H 2H AH 2C 8D 3H 5D");
3012 driver.sleep(generateDelay).then(function() {
3013 // Get mnemonic
3014 driver.findElement(By.css(".phrase"))
3015 .getAttribute("value").then(function(originalPhrase) {
3016 // Set the last 12 cards to be AS
3017 driver.findElement(By.css('.entropy'))
3018 .clear();
3019 driver.findElement(By.css('.entropy'))
3020 .sendKeys("7S 9H 9S QH 8C KS AS 7D 7C QD 4S 4D TC 2D 5S JS 3D 8S 8H 4C 3C AC 3S QC 9C JC 7H AD TD JD 6D KH 5C QS 2S 6S 6H JH KD 9D-AS AS AS AS AS AS AS AS AS AS AS AS");
3021 driver.sleep(generateDelay).then(function() {
3022 // Get new mnemonic
3023 driver.findElement(By.css(".phrase"))
3024 .getAttribute("value").then(function(newPhrase) {
3025 expect(originalPhrase).not.toEqual(newPhrase);
3026 done();
3027 });
3028 });
3029 });
3030 });
3031 });
3032
3033 // Github issue 35
3034 // https://github.com/iancoleman/bip39/issues/35
3035 // QR Code support
3036 // TODO this doesn't work in selenium with firefox
3037 // see https://stackoverflow.com/q/40360223
3038 it('Shows a qr code on hover for the phrase', function(done) {
3039 if (browser == "firefox") {
3040 pending("Selenium + Firefox bug for mouseMove, see https://stackoverflow.com/q/40360223");
3041 }
3042 // generate a random mnemonic
3043 var generateEl = driver.findElement(By.css('.generate'));
3044 generateEl.click();
3045 // toggle qr to show (hidden by default)
3046 var phraseEl = driver.findElement(By.css(".phrase"));
3047 phraseEl.click();
3048 var rootKeyEl = driver.findElement(By.css(".root-key"));
3049 driver.sleep(generateDelay).then(function() {
3050 // hover over the root key
3051 driver.actions().mouseMove(rootKeyEl).perform().then(function() {
3052 // check the qr code shows
3053 driver.executeScript(function() {
3054 return $(".qr-container").find("canvas").length > 0;
3055 })
3056 .then(function(qrShowing) {
3057 expect(qrShowing).toBe(true);
3058 // hover away from the phrase
3059 driver.actions().mouseMove(generateEl).perform().then(function() {;
3060 // check the qr code hides
3061 driver.executeScript(function() {
3062 return $(".qr-container").find("canvas").length == 0;
3063 })
3064 .then(function(qrHidden) {
3065 expect(qrHidden).toBe(true);
3066 done();
3067 });
3068 });
3069 });
3070 });
3071 });
3072 });
3073
3074 // BIP44 account extendend private key is shown
3075 // github issue 37 - compatibility with electrum
3076 it('Shows the bip44 account extended private key', function(done) {
3077 driver.findElement(By.css(".phrase"))
3078 .sendKeys("abandon abandon ability");
3079 driver.sleep(generateDelay).then(function() {
3080 driver.findElement(By.css("#bip44 .account-xprv"))
3081 .getAttribute("value")
3082 .then(function(xprv) {
3083 expect(xprv).toBe("xprv9yzrnt4zWVJUr1k2VxSPy9ettKz5PpeDMgaVG7UKedhqnw1tDkxP2UyYNhuNSumk2sLE5ctwKZs9vwjsq3e1vo9egCK6CzP87H2cVYXpfwQ");
3084 done();
3085 });
3086 });
3087 });
3088
3089 // BIP44 account extendend public key is shown
3090 // github issue 37 - compatibility with electrum
3091 it('Shows the bip44 account extended public key', function(done) {
3092 driver.findElement(By.css(".phrase"))
3093 .sendKeys("abandon abandon ability");
3094 driver.sleep(generateDelay).then(function() {
3095 driver.findElement(By.css("#bip44 .account-xpub"))
3096 .getAttribute("value")
3097 .then(function(xprv) {
3098 expect(xprv).toBe("xpub6CzDCPbtLrrn4VpVbyyQLHbdSMpZoHN4iuW64VswCyEpfjM2mJGdaHJ2DyuZwtst96E16VvcERb8BBeJdHSCVmAq9RhtRQg6eAZFrTKCNqf");
3099 done();
3100 });
3101 });
3102 });
3103
3104 // github issue 40
3105 // BIP32 root key can be set as an xpub
3106 it('Generates addresses from xpub as bip32 root key', function(done) {
3107 driver.findElement(By.css('#bip32-tab a'))
3108 .click();
3109 // set xpub for account 0 of bip44 for 'abandon abandon ability'
3110 driver.findElement(By.css("#root-key"))
3111 .sendKeys("xpub6CzDCPbtLrrn4VpVbyyQLHbdSMpZoHN4iuW64VswCyEpfjM2mJGdaHJ2DyuZwtst96E16VvcERb8BBeJdHSCVmAq9RhtRQg6eAZFrTKCNqf");
3112 driver.sleep(generateDelay).then(function() {
3113 // check the addresses are generated
3114 getFirstAddress(function(address) {
3115 expect(address).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug");
3116 // check the xprv key is not set
3117 driver.findElement(By.css(".extended-priv-key"))
3118 .getAttribute("value")
3119 .then(function(xprv) {
3120 expect(xprv).toBe("NA");
3121 // check the private key is not set
3122 driver.findElements(By.css(".privkey"))
3123 .then(function(els) {
3124 els[0]
3125 .getText()
3126 .then(function(privkey) {
3127 expect(xprv).toBe("NA");
3128 done();
3129 });
3130 });
3131 });
3132 });
3133 });
3134 });
3135
3136 // github issue 40
3137 // xpub for bip32 root key will not work with hardened derivation paths
3138 it('Shows error for hardened derivation paths with xpub root key', function(done) {
3139 // set xpub for account 0 of bip44 for 'abandon abandon ability'
3140 driver.findElement(By.css("#root-key"))
3141 .sendKeys("xpub6CzDCPbtLrrn4VpVbyyQLHbdSMpZoHN4iuW64VswCyEpfjM2mJGdaHJ2DyuZwtst96E16VvcERb8BBeJdHSCVmAq9RhtRQg6eAZFrTKCNqf");
3142 driver.sleep(feedbackDelay).then(function() {
3143 // Check feedback is correct
3144 driver.findElement(By.css('.feedback'))
3145 .getText()
3146 .then(function(feedback) {
3147 var msg = "Hardened derivation path is invalid with xpub key";
3148 expect(feedback).toBe(msg);
3149 // Check no addresses are shown
3150 driver.findElements(By.css('.addresses tr'))
3151 .then(function(rows) {
3152 expect(rows.length).toBe(0);
3153 done();
3154 });
3155 });
3156 });
3157 });
3158
3159 // github issue 39
3160 // no root key shows feedback
3161 it('Shows feedback for no root key', function(done) {
3162 // set xpub for account 0 of bip44 for 'abandon abandon ability'
3163 driver.findElement(By.css('#bip32-tab a'))
3164 .click();
3165 driver.sleep(feedbackDelay).then(function() {
3166 // Check feedback is correct
3167 driver.findElement(By.css('.feedback'))
3168 .getText()
3169 .then(function(feedback) {
3170 expect(feedback).toBe("Invalid root key");
3171 done();
3172 });
3173 });
3174 });
3175
3176 // Github issue 44
3177 // display error switching tabs while addresses are generating
3178 it('Can change details while old addresses are still being generated', function(done) {
3179 // Set to generate 199 more addresses.
3180 // This will take a long time allowing a new set of addresses to be
3181 // generated midway through this lot.
3182 // The newly generated addresses should not include any from the old set.
3183 // Any more than 199 will show an alert which needs to be accepted.
3184 driver.findElement(By.css('.rows-to-add'))
3185 .clear();
3186 driver.findElement(By.css('.rows-to-add'))
3187 .sendKeys('199');
3188 // set the prhase
3189 driver.findElement(By.css('.phrase'))
3190 .sendKeys("abandon abandon ability");
3191 driver.sleep(generateDelay).then(function() {
3192 // change tabs which should cancel the previous generating
3193 driver.findElement(By.css('.rows-to-add'))
3194 .clear();
3195 driver.findElement(By.css('.rows-to-add'))
3196 .sendKeys('20');
3197 driver.findElement(By.css('#bip32-tab a'))
3198 .click()
3199 driver.sleep(generateDelay).then(function() {
3200 driver.findElements(By.css('.index'))
3201 .then(function(els) {
3202 // check the derivation paths have the right quantity
3203 expect(els.length).toBe(20);
3204 // check the derivation paths are in order
3205 testRowsAreInCorrectOrder(done);
3206 });
3207 });
3208 });
3209 }, generateDelay + 10000);
3210
3211 // Github issue 49
3212 // padding for binary should give length with multiple of 256
3213 // hashed entropy 1111 is length 252, so requires 4 leading zeros
3214 // prior to issue 49 it would only generate 2 leading zeros, ie missing 2
3215 it('Pads hashed entropy with leading zeros', function(done) {
3216 driver.findElement(By.css('.use-entropy'))
3217 .click();
3218 driver.executeScript(function() {
3219 $(".mnemonic-length").val("15").trigger("change");
3220 });
3221 driver.findElement(By.css('.entropy'))
3222 .sendKeys("1111");
3223 driver.sleep(generateDelay).then(function() {
3224 driver.findElement(By.css('.phrase'))
3225 .getAttribute("value")
3226 .then(function(phrase) {
3227 expect(phrase).toBe("avocado valid quantum cross link predict excuse edit street able flame large galaxy ginger nuclear");
3228 done();
3229 });
3230 });
3231 });
3232
3233 // Github pull request 55
3234 // https://github.com/iancoleman/bip39/pull/55
3235 // Client select
3236 it('Can set the derivation path on bip32 tab for bitcoincore', function(done) {
3237 testClientSelect(done, {
3238 selectValue: "0",
3239 bip32path: "m/0'/0'",
3240 useHardenedAddresses: "true",
3241 });
3242 });
3243 it('Can set the derivation path on bip32 tab for multibit', function(done) {
3244 testClientSelect(done, {
3245 selectValue: "2",
3246 bip32path: "m/0'/0",
3247 useHardenedAddresses: null,
3248 });
3249 });
3250 it('Can set the derivation path on bip32 tab for coinomi/ledger', function(done) {
3251 testClientSelect(done, {
3252 selectValue: "3",
3253 bip32path: "m/44'/0'/0'",
3254 useHardenedAddresses: null,
3255 });
3256 });
3257
3258 // github issue 58
3259 // https://github.com/iancoleman/bip39/issues/58
3260 // bip32 derivation is correct, does not drop leading zeros
3261 // see also
3262 // https://medium.com/@alexberegszaszi/why-do-my-bip32-wallets-disagree-6f3254cc5846
3263 it('Retains leading zeros for bip32 derivation', function(done) {
3264 driver.findElement(By.css(".phrase"))
3265 .sendKeys("fruit wave dwarf banana earth journey tattoo true farm silk olive fence");
3266 driver.findElement(By.css(".passphrase"))
3267 .sendKeys("banana");
3268 driver.sleep(generateDelay).then(function() {
3269 getFirstAddress(function(address) {
3270 // Note that bitcore generates an incorrect address
3271 // 13EuKhffWkBE2KUwcbkbELZb1MpzbimJ3Y
3272 // see the medium.com link above for more details
3273 expect(address).toBe("17rxURoF96VhmkcEGCj5LNQkmN9HVhWb7F");
3274 done();
3275 });
3276 });
3277 });
3278
3279 // github issue 60
3280 // Japanese mnemonics generate incorrect bip32 seed
3281 // BIP39 seed is set from phrase
3282 it('Generates correct seed for Japanese mnemonics', function(done) {
3283 driver.findElement(By.css(".phrase"))
3284 .sendKeys("あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あおぞら");
3285 driver.findElement(By.css(".passphrase"))
3286 .sendKeys("メートルガバヴァぱばぐゞちぢ十人十色");
3287 driver.sleep(generateDelay).then(function() {
3288 driver.findElement(By.css(".seed"))
3289 .getAttribute("value")
3290 .then(function(seed) {
3291 expect(seed).toBe("a262d6fb6122ecf45be09c50492b31f92e9beb7d9a845987a02cefda57a15f9c467a17872029a9e92299b5cbdf306e3a0ee620245cbd508959b6cb7ca637bd55");
3292 done();
3293 });
3294 });
3295 });
3296
3297 // BIP49 official test vectors
3298 // https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki#test-vectors
3299 it('Generates BIP49 addresses matching the official test vectors', function(done) {
3300 driver.findElement(By.css('#bip49-tab a'))
3301 .click();
3302 selectNetwork("BTC - Bitcoin Testnet");
3303 driver.findElement(By.css(".phrase"))
3304 .sendKeys("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about");
3305 driver.sleep(generateDelay).then(function() {
3306 getFirstAddress(function(address) {
3307 expect(address).toBe("2Mww8dCYPUpKHofjgcXcBCEGmniw9CoaiD2");
3308 done();
3309 });
3310 });
3311 });
3312
3313 // BIP49 derivation path is shown
3314 it('Shows the bip49 derivation path', function(done) {
3315 driver.findElement(By.css('#bip49-tab a'))
3316 .click();
3317 driver.findElement(By.css(".phrase"))
3318 .sendKeys("abandon abandon ability");
3319 driver.sleep(generateDelay).then(function() {
3320 driver.findElement(By.css('#bip49 .path'))
3321 .getAttribute("value")
3322 .then(function(path) {
3323 expect(path).toBe("m/49'/0'/0'/0");
3324 done();
3325 });
3326 });
3327 });
3328
3329 // BIP49 extended private key is shown
3330 it('Shows the bip49 extended private key', function(done) {
3331 driver.findElement(By.css('#bip49-tab a'))
3332 .click();
3333 driver.findElement(By.css(".phrase"))
3334 .sendKeys("abandon abandon ability");
3335 driver.sleep(generateDelay).then(function() {
3336 driver.findElement(By.css('.extended-priv-key'))
3337 .getAttribute("value")
3338 .then(function(xprv) {
3339 expect(xprv).toBe("yprvALYB4DYRG6CzzVgzQZwwqjAA2wjBGC3iEd7KYYScpoDdmf75qMRWZWxoFcRXBJjgEXdFqJ9vDRGRLJQsrL22Su5jMbNFeM9vetaGVqy9Qy2");
3340 done();
3341 });
3342 });
3343 });
3344
3345 // BIP49 extended public key is shown
3346 it('Shows the bip49 extended public key', function(done) {
3347 driver.findElement(By.css('#bip49-tab a'))
3348 .click();
3349 driver.findElement(By.css(".phrase"))
3350 .sendKeys("abandon abandon ability");
3351 driver.sleep(generateDelay).then(function() {
3352 driver.findElement(By.css('.extended-pub-key'))
3353 .getAttribute("value")
3354 .then(function(xprv) {
3355 expect(xprv).toBe("ypub6ZXXTj5K6TmJCymTWbUxCs6tayZffemZbr2vLvrEP8kceTSENtjm7KHH6thvAKxVar9fGe8rgsPEX369zURLZ68b4f7Vexz7RuXsjQ69YDt");
3356 done();
3357 });
3358 });
3359 });
3360
3361 // BIP49 account field changes address list
3362 it('Can set the bip49 account field', function(done) {
3363 driver.findElement(By.css('#bip49-tab a'))
3364 .click();
3365 driver.findElement(By.css('#bip49 .account'))
3366 .clear();
3367 driver.findElement(By.css('#bip49 .account'))
3368 .sendKeys("1");
3369 driver.findElement(By.css(".phrase"))
3370 .sendKeys("abandon abandon ability");
3371 driver.sleep(generateDelay).then(function() {
3372 getFirstAddress(function(address) {
3373 expect(address).toBe("381wg1GGN4rP88rNC9v7QWsiww63yLVPsn");
3374 done();
3375 });
3376 });
3377 });
3378
3379 // BIP49 change field changes address list
3380 it('Can set the bip49 change field', function(done) {
3381 driver.findElement(By.css('#bip49-tab a'))
3382 .click();
3383 driver.findElement(By.css('#bip49 .change'))
3384 .clear();
3385 driver.findElement(By.css('#bip49 .change'))
3386 .sendKeys("1");
3387 driver.findElement(By.css(".phrase"))
3388 .sendKeys("abandon abandon ability");
3389 driver.sleep(generateDelay).then(function() {
3390 getFirstAddress(function(address) {
3391 expect(address).toBe("3PEM7MiKed5konBoN66PQhK8r3hjGhy9dT");
3392 done();
3393 });
3394 });
3395 });
3396
3397 // BIP49 account extendend private key is shown
3398 it('Shows the bip49 account extended private key', function(done) {
3399 driver.findElement(By.css('#bip49-tab a'))
3400 .click();
3401 driver.findElement(By.css(".phrase"))
3402 .sendKeys("abandon abandon ability");
3403 driver.sleep(generateDelay).then(function() {
3404 driver.findElement(By.css('#bip49 .account-xprv'))
3405 .getAttribute("value")
3406 .then(function(xprv) {
3407 expect(xprv).toBe("yprvAHtB1M5Wp675aLzFy9TJYK2mSsLkg6mcBRh5DZTR7L4EnYSmYPaL63KFA4ycg1PngW5LfkmejxzosCs17TKZMpRFKc3z5SJar6QAKaFcaZL");
3408 done();
3409 });
3410 });
3411 });
3412
3413 // BIP49 account extendend public key is shown
3414 it('Shows the bip49 account extended public key', function(done) {
3415 driver.findElement(By.css('#bip49-tab a'))
3416 .click();
3417 driver.findElement(By.css(".phrase"))
3418 .sendKeys("abandon abandon ability");
3419 driver.sleep(generateDelay).then(function() {
3420 driver.findElement(By.css('#bip49 .account-xpub'))
3421 .getAttribute("value")
3422 .then(function(xprv) {
3423 expect(xprv).toBe("ypub6WsXQrcQeTfNnq4j5AzJuSyVzuBF5ZVTYecg1ws2ffbDfLmv5vtadqdj1NgR6C6gufMpMfJpHxvb6JEQKvETVNWCRanNedfJtnTchZiJtsL");
3424 done();
3425 });
3426 });
3427 });
3428
3429 // Test selecting coin where bip49 is unavailable (eg CLAM)
3430 it('Shows an error on bip49 tab for coins without bip49', function(done) {
3431 driver.findElement(By.css('#bip49-tab a'))
3432 .click();
3433 driver.findElement(By.css(".phrase"))
3434 .sendKeys("abandon abandon ability");
3435 driver.sleep(generateDelay).then(function() {
3436 selectNetwork("CLAM - Clams");
3437 // bip49 available is hidden
3438 driver.findElement(By.css('#bip49 .available'))
3439 .getAttribute("class")
3440 .then(function(classes) {
3441 expect(classes).toContain("hidden");
3442 // bip49 unavailable is shown
3443 driver.findElement(By.css('#bip49 .unavailable'))
3444 .getAttribute("class")
3445 .then(function(classes) {
3446 expect(classes).not.toContain("hidden");
3447 // check there are no addresses shown
3448 driver.findElements(By.css('.addresses tr'))
3449 .then(function(rows) {
3450 expect(rows.length).toBe(0);
3451 // check the derived private key is blank
3452 driver.findElement(By.css('.extended-priv-key'))
3453 .getAttribute("value")
3454 .then(function(xprv) {
3455 expect(xprv).toBe('');
3456 // check the derived public key is blank
3457 driver.findElement(By.css('.extended-pub-key'))
3458 .getAttribute("value")
3459 .then(function(xpub) {
3460 expect(xpub).toBe('');
3461 done();
3462 });
3463 });
3464 })
3465 });
3466 });
3467 });
3468 });
3469
3470 // github issue 43
3471 // Cleared mnemonic and root key still allows addresses to be generated
3472 // https://github.com/iancoleman/bip39/issues/43
3473 it('Clears old root keys from memory when mnemonic is cleared', function(done) {
3474 // set the phrase
3475 driver.findElement(By.css(".phrase"))
3476 .sendKeys("abandon abandon ability");
3477 driver.sleep(generateDelay).then(function() {
3478 // clear the mnemonic and root key
3479 // using selenium .clear() doesn't seem to trigger the 'input' event
3480 // so clear it using keys instead
3481 driver.findElement(By.css('.phrase'))
3482 .sendKeys(Key.CONTROL,"a");
3483 driver.findElement(By.css('.phrase'))
3484 .sendKeys(Key.DELETE);
3485 driver.findElement(By.css('.root-key'))
3486 .sendKeys(Key.CONTROL,"a");
3487 driver.findElement(By.css('.root-key'))
3488 .sendKeys(Key.DELETE);
3489 driver.sleep(generateDelay).then(function() {
3490 // try to generate more addresses
3491 driver.findElement(By.css('.more'))
3492 .click();
3493 driver.sleep(generateDelay).then(function() {
3494 driver.findElements(By.css(".addresses tr"))
3495 .then(function(els) {
3496 // check there are no addresses shown
3497 expect(els.length).toBe(0);
3498 done();
3499 });
3500 });
3501 });
3502 });
3503 });
3504
3505 // Github issue 95
3506 // error trying to generate addresses from xpub with hardened derivation
3507 it('Shows error for hardened addresses with xpub root key', function(done) {
3508 driver.findElement(By.css('#bip32-tab a'))
3509 .click()
3510 driver.executeScript(function() {
3511 $(".hardened-addresses").prop("checked", true);
3512 });
3513 // set xpub for account 0 of bip44 for 'abandon abandon ability'
3514 driver.findElement(By.css("#root-key"))
3515 .sendKeys("xpub6CzDCPbtLrrn4VpVbyyQLHbdSMpZoHN4iuW64VswCyEpfjM2mJGdaHJ2DyuZwtst96E16VvcERb8BBeJdHSCVmAq9RhtRQg6eAZFrTKCNqf");
3516 driver.sleep(feedbackDelay).then(function() {
3517 // Check feedback is correct
3518 driver.findElement(By.css('.feedback'))
3519 .getText()
3520 .then(function(feedback) {
3521 var msg = "Hardened derivation path is invalid with xpub key";
3522 expect(feedback).toBe(msg);
3523 done();
3524 });
3525 });
3526 });
3527
3528 // Litecoin uses ltub by default, and can optionally be set to xprv
3529 // github issue 96
3530 // https://github.com/iancoleman/bip39/issues/96
3531 // Issue with extended keys on Litecoin
3532 it('Uses ltub by default for litecoin, but can be set to xprv', function(done) {
3533 driver.findElement(By.css('.phrase'))
3534 .sendKeys("abandon abandon ability");
3535 selectNetwork("LTC - Litecoin");
3536 driver.sleep(generateDelay).then(function() {
3537 // check the extended key is generated correctly
3538 driver.findElement(By.css('.root-key'))
3539 .getAttribute("value")
3540 .then(function(rootKey) {
3541 expect(rootKey).toBe("Ltpv71G8qDifUiNesiPqf6h5V6eQ8ic77oxQiYtawiACjBEx3sTXNR2HGDGnHETYxESjqkMLFBkKhWVq67ey1B2MKQXannUqNy1RZVHbmrEjnEU");
3542 // set litecoin to use ltub
3543 driver.executeScript(function() {
3544 $(".litecoin-use-ltub").prop("checked", false);
3545 $(".litecoin-use-ltub").trigger("change");
3546 });
3547 driver.sleep(generateDelay).then(function() {
3548 driver.findElement(By.css('.root-key'))
3549 .getAttribute("value")
3550 .then(function(rootKey) {
3551 expect(rootKey).toBe("xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi");
3552 done();
3553 });
3554 })
3555 });
3556 });
3557 });
3558
3559 // github issue 99
3560 // https://github.com/iancoleman/bip39/issues/99#issuecomment-327094159
3561 // "warn me emphatically when they have detected invalid input" to the entropy field
3562 // A warning is shown when entropy is filtered and discarded
3563 it('Warns when entropy is filtered and discarded', function(done) {
3564 driver.findElement(By.css('.use-entropy'))
3565 .click();
3566 // set entropy to have no filtered content
3567 driver.findElement(By.css('.entropy'))
3568 .sendKeys("00000000 00000000 00000000 00000000");
3569 driver.sleep(generateDelay).then(function() {
3570 // check the filter warning does not show
3571 driver.findElement(By.css('.entropy-container .filter-warning'))
3572 .getAttribute("class")
3573 .then(function(classes) {
3574 expect(classes).toContain("hidden");
3575 // set entropy to have some filtered content
3576 driver.findElement(By.css('.entropy'))
3577 .sendKeys("10000000 zxcvbn 00000000 00000000 00000000");
3578 driver.sleep(entropyFeedbackDelay).then(function() {
3579 // check the filter warning shows
3580 driver.findElement(By.css('.entropy-container .filter-warning'))
3581 .getAttribute("class")
3582 .then(function(classes) {
3583 expect(classes).not.toContain("hidden");
3584 done();
3585 });
3586 });
3587 });
3588 });
3589 });
3590
3591 // Bitcoin Cash address can be set to use cashaddr format
3592 it('Can use cashaddr format for bitcoin cash addresses', function(done) {
3593 driver.executeScript(function() {
3594 $(".use-bch-cashaddr-addresses").prop("checked", true);
3595 });
3596 driver.findElement(By.css('.phrase'))
3597 .sendKeys("abandon abandon ability");
3598 selectNetwork("BCH - Bitcoin Cash");
3599 driver.sleep(generateDelay).then(function() {
3600 getFirstAddress(function(address) {
3601 expect(address).toBe("bitcoincash:qzlquk7w4hkudxypl4fgv8x279r754dkvur7jpcsps");
3602 done();
3603 });
3604 });
3605 });
3606
3607 // Bitcoin Cash address can be set to use bitpay format
3608 it('Can use bitpay format for bitcoin cash addresses', function(done) {
3609 driver.executeScript(function() {
3610 $(".use-bch-bitpay-addresses").prop("checked", true);
3611 });
3612 driver.findElement(By.css('.phrase'))
3613 .sendKeys("abandon abandon ability");
3614 selectNetwork("BCH - Bitcoin Cash");
3615 driver.sleep(generateDelay).then(function() {
3616 getFirstAddress(function(address) {
3617 expect(address).toBe("CZnpA9HPmvhuhLLPWJP8rNDpLUYXy1LXFk");
3618 done();
3619 });
3620 });
3621 });
3622
3623 // Bitcoin Cash address can be set to use legacy format
3624 it('Can use legacy format for bitcoin cash addresses', function(done) {
3625 driver.executeScript(function() {
3626 $(".use-bch-legacy-addresses").prop("checked", true);
3627 });
3628 driver.findElement(By.css('.phrase'))
3629 .sendKeys("abandon abandon ability");
3630 selectNetwork("BCH - Bitcoin Cash");
3631 driver.sleep(generateDelay).then(function() {
3632 getFirstAddress(function(address) {
3633 expect(address).toBe("1JKvb6wKtsjNoCRxpZ4DGrbniML7z5U16A");
3634 done();
3635 });
3636 });
3637 });
3638
3639 // End of tests ported from old suit, so no more comments above each test now
3640
3641 it('Can generate more addresses from a custom index', function(done) {
3642 var expectedIndexes = [
3643 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
3644 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59
3645 ];
3646 driver.findElement(By.css('.phrase'))
3647 .sendKeys("abandon abandon ability");
3648 driver.sleep(generateDelay).then(function() {
3649 // Set start of next lot of rows to be from index 40
3650 // which means indexes 20-39 will not be in the table.
3651 driver.findElement(By.css('.more-rows-start-index'))
3652 .sendKeys("40");
3653 driver.findElement(By.css('.more'))
3654 .click();
3655 driver.sleep(generateDelay).then(function() {
3656 // Check actual indexes in the table match the expected pattern
3657 driver.findElements(By.css(".index"))
3658 .then(function(els) {
3659 expect(els.length).toBe(expectedIndexes.length);
3660 var testRowAtIndex = function(i) {
3661 if (i >= expectedIndexes.length) {
3662 done();
3663 }
3664 else {
3665 els[i].getText()
3666 .then(function(actualPath) {
3667 var noHardened = actualPath.replace(/'/g, "");
3668 var pathBits = noHardened.split("/")
3669 var lastBit = pathBits[pathBits.length-1];
3670 var actualIndex = parseInt(lastBit);
3671 var expectedIndex = expectedIndexes[i];
3672 expect(actualIndex).toBe(expectedIndex);
3673 testRowAtIndex(i+1);
3674 });
3675 }
3676 }
3677 testRowAtIndex(0);
3678 });
3679 });
3680 });
3681 });
3682
3683 it('Can generate BIP141 addresses with P2WPKH-in-P2SH semanitcs', function(done) {
3684 // Sourced from BIP49 official test specs
3685 driver.findElement(By.css('#bip141-tab a'))
3686 .click();
3687 driver.findElement(By.css('.bip141-path'))
3688 .clear();
3689 driver.findElement(By.css('.bip141-path'))
3690 .sendKeys("m/49'/1'/0'/0");
3691 selectNetwork("BTC - Bitcoin Testnet");
3692 driver.findElement(By.css(".phrase"))
3693 .sendKeys("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about");
3694 driver.sleep(generateDelay).then(function() {
3695 getFirstAddress(function(address) {
3696 expect(address).toBe("2Mww8dCYPUpKHofjgcXcBCEGmniw9CoaiD2");
3697 done();
3698 });
3699 });
3700 });
3701
3702 it('Can generate BIP141 addresses with P2WSH semanitcs', function(done) {
3703 driver.findElement(By.css('#bip141-tab a'))
3704 .click();
3705 // Choose P2WSH
3706 driver.executeScript(function() {
3707 $(".bip141-semantics option[selected]").removeAttr("selected");
3708 $(".bip141-semantics option").filter(function(i,e) {
3709 return $(e).html() == "P2WSH (1-of-1 multisig)";
3710 }).prop("selected", true);
3711 $(".bip141-semantics").trigger("change");
3712 });
3713 driver.findElement(By.css(".phrase"))
3714 .sendKeys("abandon abandon ability");
3715 driver.sleep(generateDelay).then(function() {
3716 driver.findElement(By.css("#root-key"))
3717 .getAttribute("value")
3718 .then(function(rootKey) {
3719 expect(rootKey).toBe("ZprvAhadJRUYsNge9uHspaggavxU1BUQ8QwfT4Z9UGq5sKF2mSt1mVy8EckLAaoBdmLHyP5eYDJ3LxtmzMNnLg2MRFe7QN2ueF4NCH4s5PrCDR6");
3720 getFirstAddress(function(address) {
3721 expect(address).toBe("bc1q2qhee847pv438tgg8hc7mjy38n8dklleshettn344l0tgs0kj5hskz9p9r");
3722 done();
3723 });
3724 })
3725 });
3726 });
3727
3728 it('Can generate BIP141 addresses with P2WSH-in-P2SH semanitcs', function(done) {
3729 driver.findElement(By.css('#bip141-tab a'))
3730 .click();
3731 // Choose P2WSH-in-P2SH
3732 driver.executeScript(function() {
3733 $(".bip141-semantics option[selected]").removeAttr("selected");
3734 $(".bip141-semantics option").filter(function(i,e) {
3735 return $(e).html() == "P2WSH nested in P2SH (1-of-1 multisig)";
3736 }).prop("selected", true);
3737 $(".bip141-semantics").trigger("change");
3738 });
3739 driver.findElement(By.css(".phrase"))
3740 .sendKeys("abandon abandon ability");
3741 driver.sleep(generateDelay).then(function() {
3742 driver.findElement(By.css("#root-key"))
3743 .getAttribute("value")
3744 .then(function(rootKey) {
3745 expect(rootKey).toBe("YprvANkMzkodih9AJc6kzDu4NqrxqDKxBnxAXx2vgswCVJs9iM4nWqoZcZ6C9NqbdrgNZjxqnjhUtJYE74mDcycLd1xWY2LV4LEsvZ1DgqxuAKe");
3746 getFirstAddress(function(address) {
3747 expect(address).toBe("343DLC4vGDyHBbBr9myL8zzZA1MdN9TM1G");
3748 done();
3749 });
3750 })
3751 });
3752 });
3753
3754 it('Uses Vprv for bitcoin testnet p2wsh', function(done) {
3755 selectNetwork("BTC - Bitcoin Testnet");
3756 driver.findElement(By.css('#bip141-tab a'))
3757 .click()
3758 // Choose P2WSH
3759 driver.executeScript(function() {
3760 $(".bip141-semantics option[selected]").removeAttr("selected");
3761 $(".bip141-semantics option").filter(function(i,e) {
3762 return $(e).html() == "P2WSH (1-of-1 multisig)";
3763 }).prop("selected", true);
3764 $(".bip141-semantics").trigger("change");
3765 });
3766 driver.findElement(By.css('.phrase'))
3767 .sendKeys('abandon abandon ability');
3768 driver.sleep(generateDelay).then(function() {
3769 driver.findElement(By.css('.root-key'))
3770 .getAttribute("value")
3771 .then(function(path) {
3772 expect(path).toBe("Vprv16YtLrHXxePM5ja5hXQbiJs5JKDAc4WcaXo5rZcrVMU6bMhUg1oY7fpPku3i819gvMcHvq1h8aELDsyfCEs19vj1Q3iDHRrESWyJConkoT1");
3773 done();
3774 })
3775 });
3776 });
3777
3778 it('Uses Uprv for bitcoin testnet p2wsh-in-p2sh', function(done) {
3779 selectNetwork("BTC - Bitcoin Testnet");
3780 driver.findElement(By.css('#bip141-tab a'))
3781 .click()
3782 // Choose P2WSH-in-P2SH
3783 driver.executeScript(function() {
3784 $(".bip141-semantics option[selected]").removeAttr("selected");
3785 $(".bip141-semantics option").filter(function(i,e) {
3786 return $(e).html() == "P2WSH nested in P2SH (1-of-1 multisig)";
3787 }).prop("selected", true);
3788 $(".bip141-semantics").trigger("change");
3789 });
3790 driver.findElement(By.css('.phrase'))
3791 .sendKeys('abandon abandon ability');
3792 driver.sleep(generateDelay).then(function() {
3793 driver.findElement(By.css('.root-key'))
3794 .getAttribute("value")
3795 .then(function(path) {
3796 expect(path).toBe("Uprv95RJn67y7xyEuRLHenkZYVUx9LkARJzAsVx3ZJMeyHMdVwosWD9K8JTe4Z1FeE4gwBVcnqKF3f82ZvJxkBxHS5E74fYnigxvqeke8ZV3Fp2");
3797 done();
3798 })
3799 });
3800 });
3801
3802 it('Can generate BIP141 addresses with P2WPKH semanitcs', function(done) {
3803 // This result tested against bitcoinjs-lib test spec for segwit address
3804 // using the first private key of this mnemonic and default path m/0
3805 // https://github.com/bitcoinjs/bitcoinjs-lib/blob/9c8503cab0c6c30a95127042703bc18e8d28c76d/test/integration/addresses.js#L50
3806 // so whilst not directly comparable, substituting the private key produces
3807 // identical results between this tool and the bitcoinjs-lib test.
3808 // Private key generated is:
3809 // L3L8Nu9whawPBNLGtFqDhKut9DKKfG3CQoysupT7BimqVCZsLFNP
3810 driver.findElement(By.css('#bip141-tab a'))
3811 .click();
3812 // Choose P2WPKH
3813 driver.executeScript(function() {
3814 $(".bip141-semantics option[selected]").removeAttr("selected");
3815 $(".bip141-semantics option").filter(function(i,e) {
3816 return $(e).html() == "P2WPKH";
3817 }).prop("selected", true);
3818 $(".bip141-semantics").trigger("change");
3819 });
3820 driver.findElement(By.css(".phrase"))
3821 .sendKeys("abandon abandon ability");
3822 driver.sleep(generateDelay).then(function() {
3823 getFirstAddress(function(address) {
3824 expect(address).toBe("bc1qfwu6a5a3evygrk8zvdxxvz4547lmpyx5vsfxe9");
3825 done();
3826 });
3827 });
3828 });
3829
3830 it('Shows the entropy used by the PRNG when clicking generate', function(done) {
3831 driver.findElement(By.css('.generate')).click();
3832 driver.sleep(generateDelay).then(function() {
3833 driver.findElement(By.css('.entropy'))
3834 .getAttribute("value")
3835 .then(function(entropy) {
3836 expect(entropy).not.toBe("");
3837 done();
3838 });
3839 });
3840 });
3841
3842 it('Shows the index of each word in the mnemonic', function(done) {
3843 driver.findElement(By.css('.phrase'))
3844 .sendKeys("abandon abandon ability");
3845 driver.sleep(generateDelay).then(function() {
3846 driver.findElement(By.css('.use-entropy'))
3847 .click();
3848 driver.findElement(By.css('.word-indexes'))
3849 .getText()
3850 .then(function(indexes) {
3851 expect(indexes).toBe("0, 0, 1");
3852 done();
3853 });
3854 });
3855 });
3856
3857 it('Shows the derivation path for bip84 tab', function(done) {
3858 driver.findElement(By.css('#bip84-tab a'))
3859 .click()
3860 driver.findElement(By.css('.phrase'))
3861 .sendKeys('abandon abandon ability');
3862 driver.sleep(generateDelay).then(function() {
3863 driver.findElement(By.css('#bip84 .path'))
3864 .getAttribute("value")
3865 .then(function(path) {
3866 expect(path).toBe("m/84'/0'/0'/0");
3867 done();
3868 })
3869 });
3870 });
3871
3872 it('Shows the extended private key for bip84 tab', function(done) {
3873 driver.findElement(By.css('#bip84-tab a'))
3874 .click()
3875 driver.findElement(By.css('.phrase'))
3876 .sendKeys('abandon abandon ability');
3877 driver.sleep(generateDelay).then(function() {
3878 driver.findElement(By.css('.extended-priv-key'))
3879 .getAttribute("value")
3880 .then(function(path) {
3881 expect(path).toBe("zprvAev3RKrZ3QVKiUFCfdeMRen1BPDJgdNt1XpxiDy8acSs4kkAGTCvq7HeRYRNNpo8EtEjCFQBWavJwtCUR29y4TUCH4X5RXMcyq48uN8y9BP");
3882 done();
3883 })
3884 });
3885 });
3886
3887 it('Shows the extended public key for bip84 tab', function(done) {
3888 driver.findElement(By.css('#bip84-tab a'))
3889 .click()
3890 driver.findElement(By.css('.phrase'))
3891 .sendKeys('abandon abandon ability');
3892 driver.sleep(generateDelay).then(function() {
3893 driver.findElement(By.css('.extended-pub-key'))
3894 .getAttribute("value")
3895 .then(function(path) {
3896 expect(path).toBe("zpub6suPpqPSsn3cvxKfmfBMnnijjR3o666jNkkZWcNk8wyqwZ5JozXBNuc8Gs7DB3uLwTDvGVTspVEAUQcEjKF3pZHgywVbubdTqbXTUg7usyx");
3897 done();
3898 })
3899 });
3900 });
3901
3902 it('Changes the address list if bip84 account is changed', function(done) {
3903 driver.findElement(By.css('#bip84-tab a'))
3904 .click()
3905 driver.findElement(By.css('#bip84 .account'))
3906 .sendKeys('1');
3907 driver.findElement(By.css('.phrase'))
3908 .sendKeys('abandon abandon ability');
3909 driver.sleep(generateDelay).then(function() {
3910 getFirstAddress(function(address) {
3911 expect(address).toBe("bc1qp7vv669t2fy965jdzvqwrraana89ctd5ewc662");
3912 done();
3913 });
3914 });
3915 });
3916
3917 it('Changes the address list if bip84 change is changed', function(done) {
3918 driver.findElement(By.css('#bip84-tab a'))
3919 .click()
3920 driver.findElement(By.css('#bip84 .change'))
3921 .sendKeys('1');
3922 driver.findElement(By.css('.phrase'))
3923 .sendKeys('abandon abandon ability');
3924 driver.sleep(generateDelay).then(function() {
3925 getFirstAddress(function(address) {
3926 expect(address).toBe("bc1qr39vj6rh06ff05m53uxq8uazehwhccswylhrs2");
3927 done();
3928 });
3929 });
3930 });
3931
3932 it('Passes the official BIP84 test spec for rootpriv', function(done) {
3933 driver.findElement(By.css('#bip84-tab a'))
3934 .click()
3935 driver.findElement(By.css('.phrase'))
3936 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3937 driver.sleep(generateDelay).then(function() {
3938 driver.findElement(By.css(".root-key"))
3939 .getAttribute("value")
3940 .then(function(rootKey) {
3941 expect(rootKey).toBe("zprvAWgYBBk7JR8Gjrh4UJQ2uJdG1r3WNRRfURiABBE3RvMXYSrRJL62XuezvGdPvG6GFBZduosCc1YP5wixPox7zhZLfiUm8aunE96BBa4Kei5");
3942 done();
3943 })
3944 });
3945 });
3946
3947 it('Passes the official BIP84 test spec for account 0 xprv', function(done) {
3948 driver.findElement(By.css('#bip84-tab a'))
3949 .click()
3950 driver.findElement(By.css('.phrase'))
3951 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3952 driver.sleep(generateDelay).then(function() {
3953 driver.findElement(By.css("#bip84 .account-xprv"))
3954 .getAttribute("value")
3955 .then(function(rootKey) {
3956 expect(rootKey).toBe("zprvAdG4iTXWBoARxkkzNpNh8r6Qag3irQB8PzEMkAFeTRXxHpbF9z4QgEvBRmfvqWvGp42t42nvgGpNgYSJA9iefm1yYNZKEm7z6qUWCroSQnE");
3957 done();
3958 })
3959 });
3960 });
3961
3962 it('Passes the official BIP84 test spec for account 0 xpub', function(done) {
3963 driver.findElement(By.css('#bip84-tab a'))
3964 .click()
3965 driver.findElement(By.css('.phrase'))
3966 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3967 driver.sleep(generateDelay).then(function() {
3968 driver.findElement(By.css("#bip84 .account-xpub"))
3969 .getAttribute("value")
3970 .then(function(rootKey) {
3971 expect(rootKey).toBe("zpub6rFR7y4Q2AijBEqTUquhVz398htDFrtymD9xYYfG1m4wAcvPhXNfE3EfH1r1ADqtfSdVCToUG868RvUUkgDKf31mGDtKsAYz2oz2AGutZYs");
3972 done();
3973 })
3974 });
3975 });
3976
3977 it('Passes the official BIP84 test spec for account 0 first address', function(done) {
3978 driver.findElement(By.css('#bip84-tab a'))
3979 .click()
3980 driver.findElement(By.css('.phrase'))
3981 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3982 driver.sleep(generateDelay).then(function() {
3983 getFirstAddress(function(address) {
3984 expect(address).toBe("bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu");
3985 done();
3986 });
3987 });
3988 });
3989
3990 it('Passes the official BIP84 test spec for account 0 first change address', function(done) {
3991 driver.findElement(By.css('#bip84-tab a'))
3992 .click()
3993 driver.findElement(By.css('.phrase'))
3994 .sendKeys('abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about');
3995 driver.findElement(By.css('#bip84 .change'))
3996 .sendKeys('1');
3997 driver.sleep(generateDelay).then(function() {
3998 getFirstAddress(function(address) {
3999 expect(address).toBe("bc1q8c6fshw2dlwun7ekn9qwf37cu2rn755upcp6el");
4000 done();
4001 });
4002 });
4003 });
4004
4005 it('Can display the table as csv', function(done) {
4006 var headings = "path,address,public key,private key";
4007 var row1 = "m/44'/0'/0'/0/0,1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug,033f5aed5f6cfbafaf223188095b5980814897295f723815fea5d3f4b648d0d0b3,L26cVSpWFkJ6aQkPkKmTzLqTdLJ923e6CzrVh9cmx21QHsoUmrEE";
4008 var row20 = "m/44'/0'/0'/0/19,1KhBy28XLAciXnnRvm71PvQJaETyrxGV55,02b4b3e396434d8cdd20c03ac4aaa07387784d5d867b75987f516f5705ee68cb3a,L4GrDrjReMsCAu5DkLXn79jSb95qR7Zfx7eshybCQZ1qL32MXJab";
4009 driver.findElement(By.css('.phrase'))
4010 .sendKeys('abandon abandon ability');
4011 driver.sleep(generateDelay).then(function() {
4012 driver.findElement(By.css('.csv'))
4013 .getAttribute("value")
4014 .then(function(csv) {
4015 expect(csv).toContain(headings);
4016 expect(csv).toContain(row1);
4017 expect(csv).toContain(row20);
4018 done();
4019 });
4020 });
4021 });
4022
4023 it('LeftPads ethereum keys that are less than 32 bytes', function(done) {
4024 // see https://github.com/iancoleman/bip39/issues/155
4025 selectNetwork("ETH - Ethereum");
4026 driver.findElement(By.css('#bip32-tab a'))
4027 .click()
4028 driver.findElement(By.css('#bip32-path'))
4029 .clear();
4030 driver.findElement(By.css('#bip32-path'))
4031 .sendKeys("m/44'/60'/0'");
4032 driver.findElement(By.css('.phrase'))
4033 .sendKeys('scout sort custom elite radar rare vivid thing trophy gesture cover snake change narrow kite list nation sustain buffalo erode open balance system young');
4034 driver.sleep(generateDelay).then(function() {
4035 getFirstAddress(function(address) {
4036 expect(address).toBe("0x8943E785B4a5714FC87a3aFAad1eB1FeB602B118");
4037 done();
4038 });
4039 });
4040 });
4041
4042 it('Can encrypt private keys using BIP38', function(done) {
4043 // see https://github.com/iancoleman/bip39/issues/140
4044 driver.executeScript(function() {
4045 $(".use-bip38").prop("checked", true);
4046 });
4047 driver.findElement(By.css('.bip38-password'))
4048 .sendKeys('bip38password');
4049 driver.findElement(By.css('.rows-to-add'))
4050 .clear();
4051 driver.findElement(By.css('.rows-to-add'))
4052 .sendKeys('1');
4053 driver.findElement(By.css('.phrase'))
4054 .sendKeys('abandon abandon ability');
4055 driver.sleep(bip38delay).then(function() {
4056 // address
4057 getFirstRowValue(function(address) {
4058 expect(address).toBe("1NCvSdumA3ngMM9c4aqU56AM6rqXddfuXB");
4059 // pubkey
4060 getFirstRowValue(function(pubkey) {
4061 expect(pubkey).toBe("043f5aed5f6cfbafaf223188095b5980814897295f723815fea5d3f4b648d0d0b3884a74447ea901729b1e73a999b7520e7cb55b4120e6432c64153ccab8a848e1");
4062 // privkey
4063 getFirstRowValue(function(privkey) {
4064 expect(privkey).toBe("6PRNRiFnj1RoR3sXhymdCvoZCgnUHQpfupNdKkFbWJkwWQEKesWt1EDMDM");
4065 done();
4066 }, ".privkey");
4067 }, ".pubkey");
4068 }, ".address");
4069 });
4070 }, bip38delay + 5000);
4071
4072 it('Shows the checksum for the entropy', function(done) {
4073 driver.findElement(By.css('.use-entropy'))
4074 .click();
4075 driver.findElement(By.css('.entropy'))
4076 .sendKeys("00000000000000000000000000000000");
4077 driver.sleep(generateDelay).then(function() {
4078 driver.findElement(By.css('.checksum'))
4079 .getText()
4080 .then(function(text) {
4081 expect(text).toBe("1");
4082 done();
4083 });
4084 });
4085 });
4086
4087 it('Shows the checksum for the entropy with the correct groupings', function(done) {
4088 driver.findElement(By.css('.use-entropy'))
4089 .click();
4090 // create a checksum of 20 bits, which spans multiple words
4091 driver.findElement(By.css('.entropy'))
4092 .sendKeys("F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
4093 driver.sleep(generateDelay).then(function() {
4094 driver.findElement(By.css('.checksum'))
4095 .getText()
4096 .then(function(text) {
4097 // first group is 9 bits, second group is 11
4098 expect(text).toBe("011010111 01110000110");
4099 done();
4100 });
4101 });
4102 });
4103
4104 it('Uses vprv for bitcoin testnet p2wpkh', function(done) {
4105 selectNetwork("BTC - Bitcoin Testnet");
4106 driver.findElement(By.css('#bip84-tab a'))
4107 .click()
4108 driver.findElement(By.css('.phrase'))
4109 .sendKeys('abandon abandon ability');
4110 driver.sleep(generateDelay).then(function() {
4111 driver.findElement(By.css('.root-key'))
4112 .getAttribute("value")
4113 .then(function(path) {
4114 expect(path).toBe("vprv9DMUxX4ShgxML9N2YV5CvWEebWrM9aJ5ULpbRRyzyWu6vs4BzTvbfFFrH41N5hVi7MYSfiugd765L3JmAfDM5po36Y8ouCKRDeYQwByCmS7");
4115 done();
4116 })
4117 });
4118 });
4119
4120 it('Shows a warning if generating weak mnemonics', function(done) {
4121 driver.executeScript(function() {
4122 $(".strength option[selected]").removeAttr("selected");
4123 $(".strength option[value=6]").prop("selected", true);
4124 $(".strength").trigger("change");
4125 });
4126 driver.findElement(By.css(".generate-container .warning"))
4127 .getAttribute("class")
4128 .then(function(classes) {
4129 expect(classes).not.toContain("hidden");
4130 done();
4131 });
4132 });
4133
4134 it('Does not show a warning if generating strong mnemonics', function(done) {
4135 driver.executeScript(function() {
4136 $(".strength option[selected]").removeAttr("selected");
4137 $(".strength option[value=12]").prop("selected", true);
4138 });
4139 driver.findElement(By.css(".generate-container .warning"))
4140 .getAttribute("class")
4141 .then(function(classes) {
4142 expect(classes).toContain("hidden");
4143 done();
4144 });
4145 });
4146
4147 it('Shows a warning if overriding weak entropy with longer mnemonics', function(done) {
4148 driver.findElement(By.css('.use-entropy'))
4149 .click();
4150 driver.findElement(By.css('.entropy'))
4151 .sendKeys("0123456789abcdef"); // 6 words
4152 driver.executeScript(function() {
4153 $(".mnemonic-length").val("12").trigger("change");
4154 });
4155 driver.findElement(By.css(".weak-entropy-override-warning"))
4156 .getAttribute("class")
4157 .then(function(classes) {
4158 expect(classes).not.toContain("hidden");
4159 done();
4160 });
4161 });
4162
4163 it('Does not show a warning if entropy is stronger than mnemonic length', function(done) {
4164 driver.findElement(By.css('.use-entropy'))
4165 .click();
4166 driver.findElement(By.css('.entropy'))
4167 .sendKeys("0123456789abcdef0123456789abcdef0123456789abcdef"); // 18 words
4168 driver.executeScript(function() {
4169 $(".mnemonic-length").val("12").trigger("change");
4170 });
4171 driver.findElement(By.css(".weak-entropy-override-warning"))
4172 .getAttribute("class")
4173 .then(function(classes) {
4174 expect(classes).toContain("hidden");
4175 done();
4176 });
4177 });
4178
4179 it('Shows litecoin BIP49 addresses', function(done) {
4180 driver.findElement(By.css('.phrase'))
4181 .sendKeys('abandon abandon ability');
4182 selectNetwork("LTC - Litecoin");
4183 driver.findElement(By.css('#bip49-tab a'))
4184 .click()
4185 // bip49 addresses are shown
4186 driver.sleep(generateDelay).then(function() {
4187 driver.findElement(By.css('#bip49 .available'))
4188 .getAttribute("class")
4189 .then(function(classes) {
4190 expect(classes).not.toContain("hidden");
4191 // check first address
4192 getFirstAddress(function(address) {
4193 expect(address).toBe("MFwLPhsXoBuSLL8cLmW9uK6tChkzduV8qN");
4194 done();
4195 });
4196 });
4197 });
4198 });
4199
4200 it('Shows Groestlcoin BIP49 addresses', function(done) {
4201 driver.findElement(By.css('.phrase'))
4202 .sendKeys('abandon abandon ability');
4203 selectNetwork("GRS - Groestlcoin");
4204 driver.findElement(By.css('#bip49-tab a'))
4205 .click()
4206 // bip49 addresses are shown
4207 driver.sleep(generateDelay).then(function() {
4208 driver.findElement(By.css('#bip49 .available'))
4209 .getAttribute("class")
4210 .then(function(classes) {
4211 expect(classes).not.toContain("hidden");
4212 // check first address
4213 getFirstAddress(function(address) {
4214 expect(address).toBe("3HXSCZwCypLyixMsF4Z1sN49noJtrm8gnX");
4215 done();
4216 });
4217 });
4218 });
4219 });
4220
4221 it('Can use root keys to generate segwit table rows', function(done) {
4222 // segwit uses ypub / zpub instead of xpub but the root key should still
4223 // be valid regardless of the encoding used to import that key.
4224 // Maybe this breaks the reason for the different extended key prefixes, but
4225 // since the parsed root key is used behind the scenes anyhow this should be
4226 // allowed.
4227 driver.findElement(By.css('#root-key'))
4228 .sendKeys('xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi');
4229 driver.findElement(By.css('#bip49-tab a'))
4230 .click()
4231 // bip49 addresses are shown
4232 driver.sleep(generateDelay).then(function() {
4233 getFirstAddress(function(address) {
4234 expect(address).toBe("3QG2Y9AA4xZ846gKHZqNf7mvVKbLqMKxr2");
4235 done();
4236 });
4237 });
4238 });
4239
4240 // Pull Request 271
4241 // Allow converting mnemonic back to raw entropy value
4242 it('Converts mnemonics into raw entropy', function(done) {
4243 driver.findElement(By.css('.phrase'))
4244 .sendKeys('abandon abandon about');
4245 driver.sleep(generateDelay).then(function() {
4246 driver.findElement(By.css('.use-entropy'))
4247 .click();
4248 driver.findElement(By.css('.entropy'))
4249 .getAttribute("value")
4250 .then(function(entropy) {
4251 expect(entropy).toBe("00000001");
4252 driver.findElement(By.css('.phrase'))
4253 .getAttribute("value")
4254 .then(function(phrase) {
4255 expect(phrase).toBe("abandon abandon about");
4256 done();
4257 });
4258 });
4259 });
4260 });
4261
4262 // Pull Request 279
4263 // Added Split Phrase Card Output
4264 it('Shows split prase cards', function(done) {
4265 var originalPhrase = "ugly charge strong giant once anchor capable october thumb inject dwarf legal alley mixture shoot";
4266 var originalWords = originalPhrase.split(' ');
4267 driver.findElement(By.css('.phrase'))
4268 .sendKeys(originalPhrase);
4269 driver.sleep(generateDelay).then(function() {
4270 driver.findElement(By.css('.phraseSplit'))
4271 .getAttribute("value")
4272 .then(function(cardsStr) {
4273 var cards = cardsStr.split("\n");
4274 expect(cards.length).toBe(3);
4275 // test all 2-of-3 combos can be used to form full phrase
4276 var combos = [[0,1],[0,2],[1,2]];
4277 for (var i=0; i<combos.length; i++) {
4278 var combo = combos[i];
4279 var a = combo[0];
4280 var b = combo[1];
4281 var phrase = cards[a] + " " + cards[b];
4282 // check all original words are present
4283 for (var j=0; j<originalWords.length; j++) {
4284 var originalWord = originalWords[j];
4285 expect(phrase).toContain(originalWord);
4286 }
4287 }
4288 done();
4289 });
4290 });
4291 });
4292
4293 // It allows manually specifying the entropy type
4294 it('Allows entropy type to be manually selected', function(done) {
4295 driver.findElement(By.css('.use-entropy'))
4296 .click();
4297 // use decimal entropy
4298 driver.findElement(By.css('.entropy'))
4299 .sendKeys("91");
4300 // manually change to binary entropy
4301 driver.executeScript(function() {
4302 $(".entropy-container input[value='binary']").click();
4303 });
4304 driver.sleep(entropyFeedbackDelay).then(function() {
4305 driver.findElement(By.css('.entropy-container'))
4306 .getText()
4307 .then(function(text) {
4308 // overide 91 to be just 1
4309 var key = "Filtered Entropy";
4310 var value = "1";
4311 var reText = key + "\\s+" + value;
4312 var re = new RegExp(reText);
4313 expect(text).toMatch(re);
4314 // overide automatic decimal to binary
4315 var key = "Entropy Type";
4316 var value = "binary";
4317 var reText = key + "\\s+" + value;
4318 var re = new RegExp(reText);
4319 expect(text).toMatch(re);
4320 // overide 2 events to 1
4321 var key = "Event Count";
4322 var value = 1;
4323 var reText = key + "\\s+" + value;
4324 var re = new RegExp(reText);
4325 expect(text).toMatch(re);
4326 // overide log2(10)*2 bits to 1 bit
4327 var key = "Total Bits";
4328 var value = 1;
4329 var reText = key + "\\s+" + value;
4330 var re = new RegExp(reText);
4331 expect(text).toMatch(re);
4332 done();
4333 });
4334 });
4335 });
4336
4337 // https://github.com/iancoleman/bip39/issues/388
4338 // Make field for bip39 seed editable
4339 it('Generates addresses when seed is set', function(done) {
4340 driver.findElement(By.css('.seed'))
4341 .sendKeys("20da140d3dd1df8713cefcc4d54ce0e445b4151027a1ab567b832f6da5fcc5afc1c3a3f199ab78b8e0ab4652efd7f414ac2c9a3b81bceb879a70f377aa0a58f3");
4342 driver.sleep(generateDelay).then(function() {
4343 getFirstAddress(function(address) {
4344 expect(address).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug");
4345 done();
4346 });
4347 });
4348 });
4349
4350 // https://github.com/iancoleman/bip39/issues/169
4351 it('Generates ethereum addresses from a public key', function(done) {
4352 var pubkey = "xpub68UK3hrMEp2jLPxPASgXSiqiUsQsUWZHCeuu6NqcJLt259LMeWzwDyufXLN1QmjLeLRY5he4QfArDDLbsXiw3xN3kFcYtyDy74BY73RPhhW";
4353 driver.findElement(By.css('.root-key'))
4354 .sendKeys(pubkey);
4355 driver.findElement(By.css('#bip32-tab a'))
4356 .click()
4357 selectNetwork('ETH - Ethereum');
4358 driver.sleep(generateDelay).then(function() {
4359 getFirstAddress(function(address) {
4360 expect(address).toBe("0x1Bd54748903438C7E386b4a3fCbe16237A316a98");
4361 done();
4362 });
4363 });
4364 });
4365
4366 });