+// Pull Request 271
+// Allow converting mnemonic back to raw entropy value
+it('Converts mnemonics into raw entropy', function(done) {
+ driver.findElement(By.css('.phrase'))
+ .sendKeys('abandon abandon about');
+ driver.sleep(generateDelay).then(function() {
+ driver.findElement(By.css('.use-entropy'))
+ .click();
+ driver.findElement(By.css('.entropy'))
+ .getAttribute("value")
+ .then(function(entropy) {
+ expect(entropy).toBe("00000001");
+ driver.findElement(By.css('.phrase'))
+ .getAttribute("value")
+ .then(function(phrase) {
+ expect(phrase).toBe("abandon abandon about");
+ done();
+ });
+ });
+ });
+});
+
+// Pull Request 279
+// Added Split Phrase Card Output
+it('Shows split prase cards', function(done) {
+ var originalPhrase = "ugly charge strong giant once anchor capable october thumb inject dwarf legal alley mixture shoot";
+ var originalWords = originalPhrase.split(' ');
+ driver.findElement(By.css('.phrase'))
+ .sendKeys(originalPhrase);
+ driver.sleep(generateDelay).then(function() {
+ driver.findElement(By.css('.phraseSplit'))
+ .getAttribute("value")
+ .then(function(cardsStr) {
+ var cards = cardsStr.split("\n");
+ expect(cards.length).toBe(3);
+ // test all 2-of-3 combos can be used to form full phrase
+ var combos = [[0,1],[0,2],[1,2]];
+ for (var i=0; i<combos.length; i++) {
+ var combo = combos[i];
+ var a = combo[0];
+ var b = combo[1];
+ var phrase = cards[a] + " " + cards[b];
+ // check all original words are present
+ for (var j=0; j<originalWords.length; j++) {
+ var originalWord = originalWords[j];
+ expect(phrase).toContain(originalWord);
+ }
+ }
+ done();
+ });
+ });
+});
+
+// It allows manually specifying the entropy type
+it('Allows entropy type to be manually selected', function(done) {
+ driver.findElement(By.css('.use-entropy'))
+ .click();
+ // use decimal entropy
+ driver.findElement(By.css('.entropy'))
+ .sendKeys("91");
+ // manually change to binary entropy
+ driver.executeScript(function() {
+ $(".entropy-container input[value='binary']").click();
+ });
+ driver.sleep(entropyFeedbackDelay).then(function() {
+ driver.findElement(By.css('.entropy-container'))
+ .getText()
+ .then(function(text) {
+ // overide 91 to be just 1
+ var key = "Filtered Entropy";
+ var value = "1";
+ var reText = key + "\\s+" + value;
+ var re = new RegExp(reText);
+ expect(text).toMatch(re);
+ // overide automatic decimal to binary
+ var key = "Entropy Type";
+ var value = "binary";
+ var reText = key + "\\s+" + value;
+ var re = new RegExp(reText);
+ expect(text).toMatch(re);
+ // overide 2 events to 1
+ var key = "Event Count";
+ var value = 1;
+ var reText = key + "\\s+" + value;
+ var re = new RegExp(reText);
+ expect(text).toMatch(re);
+ // overide log2(10)*2 bits to 1 bit
+ var key = "Total Bits";
+ var value = 1;
+ var reText = key + "\\s+" + value;
+ var re = new RegExp(reText);
+ expect(text).toMatch(re);
+ done();
+ });
+ });
+});
+
+// https://github.com/iancoleman/bip39/issues/388
+// Make field for bip39 seed editable
+it('Generates addresses when seed is set', function(done) {
+ driver.findElement(By.css('.seed'))
+ .sendKeys("20da140d3dd1df8713cefcc4d54ce0e445b4151027a1ab567b832f6da5fcc5afc1c3a3f199ab78b8e0ab4652efd7f414ac2c9a3b81bceb879a70f377aa0a58f3");
+ driver.sleep(generateDelay).then(function() {
+ getFirstAddress(function(address) {
+ expect(address).toBe("1Di3Vp7tBWtyQaDABLAjfWtF6V7hYKJtug");
+ done();
+ });
+ });
+});
+
+// https://github.com/iancoleman/bip39/issues/169
+it('Generates ethereum addresses from a public key', function(done) {
+ var pubkey = "xpub68UK3hrMEp2jLPxPASgXSiqiUsQsUWZHCeuu6NqcJLt259LMeWzwDyufXLN1QmjLeLRY5he4QfArDDLbsXiw3xN3kFcYtyDy74BY73RPhhW";
+ driver.findElement(By.css('.root-key'))
+ .sendKeys(pubkey);
+ driver.findElement(By.css('#bip32-tab a'))
+ .click()
+ selectNetwork('ETH - Ethereum');
+ driver.sleep(generateDelay).then(function() {
+ getFirstAddress(function(address) {
+ expect(address).toBe("0x1Bd54748903438C7E386b4a3fCbe16237A316a98");
+ done();
+ });
+ });
+});
+