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