X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fspec%2Ftests.js;h=9e780162c73e65ff8b8cf7ec567128669c16fb7b;hb=048721a6ff08555de71626d9868aa5054b46cfda;hp=29e45f5dc7d195be651dd0945fb0e4f7fe5dddc9;hpb=423fb969c6bb8384178b9e503bf11cd5f2df488d;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git diff --git a/tests/spec/tests.js b/tests/spec/tests.js index 29e45f5..9e78016 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js @@ -33,6 +33,7 @@ var driver = null; var generateDelay = 1500; var feedbackDelay = 500; var entropyFeedbackDelay = 500; +var bip38delay = 15000; // url uses file:// scheme var path = require('path') @@ -422,6 +423,13 @@ it('Allows selection of dogecoin', function(done) { }; testNetwork(done, params); }); +it('Allows selection of denarius', function(done) { + var params = { + selectText: "DNR - Denarius", + firstAddress: "D9feDKo88SHir79b2Kqhk7JAtaddmxDjNV", + }; + testNetwork(done, params); +}); it('Allows selection of shadowcash', function(done) { var params = { selectText: "SDC - ShadowCash", @@ -612,6 +620,13 @@ it('Allows selection of AXE', function(done) { }; testNetwork(done, params); }); +it('Allows selection of BlackCoin', function(done) { + var params = { + selectText: "BLK - BlackCoin", + firstAddress: "B5MznAKwj7uQ42vDz3w4onhBXPcqhTwJ9z", + }; + testNetwork(done, params); +}); // BIP39 seed is set from phrase it('Sets the bip39 seed from the prhase', function(done) { @@ -940,13 +955,13 @@ it('Can generate more rows in the table', function(done) { // A custom number of additional addresses can be generated it('Can generate more rows in the table', function(done) { - driver.findElement(By.css('.rows-to-add')) - .clear(); - driver.findElement(By.css('.rows-to-add')) - .sendKeys('1'); driver.findElement(By.css('.phrase')) .sendKeys('abandon abandon ability'); driver.sleep(generateDelay).then(function() { + driver.findElement(By.css('.rows-to-add')) + .clear(); + driver.findElement(By.css('.rows-to-add')) + .sendKeys('1'); driver.findElement(By.css('.more')) .click(); driver.sleep(generateDelay).then(function() { @@ -2166,10 +2181,11 @@ it('Can change details while old addresses are still being generated', function( driver.findElement(By.css('.phrase')) .sendKeys("abandon abandon ability"); driver.sleep(generateDelay).then(function() { - // generate more addresses - driver.findElement(By.css('.more')) - .click(); // change tabs which should cancel the previous generating + driver.findElement(By.css('.rows-to-add')) + .clear(); + driver.findElement(By.css('.rows-to-add')) + .sendKeys('20'); driver.findElement(By.css('#bip32-tab a')) .click() driver.sleep(generateDelay).then(function() { @@ -2182,7 +2198,7 @@ it('Can change details while old addresses are still being generated', function( }); }); }); -}); +}, generateDelay + 5000); // Github issue 49 // padding for binary should give length with multiple of 256 @@ -2869,17 +2885,41 @@ it('LeftPads ethereum keys that are less than 32 bytes', function(done) { driver.findElement(By.css('.phrase')) .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'); driver.sleep(generateDelay).then(function() { - driver.findElement(By.css(".address")) - .getText() - .then(function(address) { - expect(address).toBe("0x8943E785B4a5714FC87a3aFAad1eB1FeB602B118"); - done(); - }); - //getFirstAddress(function(address) { - // expect(address).toBe("0x8943E785B4a5714FC87a3aFAad1eB1FeB602B118"); - // done(); - //}); + getFirstAddress(function(address) { + expect(address).toBe("0x8943E785B4a5714FC87a3aFAad1eB1FeB602B118"); + done(); + }); }); }); +it('Can encrypt private keys using BIP38', function(done) { + // see https://github.com/iancoleman/bip39/issues/140 + driver.executeScript(function() { + $(".use-bip38").prop("checked", true); + }); + driver.findElement(By.css('.bip38-password')) + .sendKeys('bip38password'); + driver.findElement(By.css('.rows-to-add')) + .clear(); + driver.findElement(By.css('.rows-to-add')) + .sendKeys('1'); + driver.findElement(By.css('.phrase')) + .sendKeys('abandon abandon ability'); + driver.sleep(bip38delay).then(function() { + // address + getFirstRowValue(function(address) { + expect(address).toBe("1NCvSdumA3ngMM9c4aqU56AM6rqXddfuXB"); + // pubkey + getFirstRowValue(function(pubkey) { + expect(pubkey).toBe("043f5aed5f6cfbafaf223188095b5980814897295f723815fea5d3f4b648d0d0b3884a74447ea901729b1e73a999b7520e7cb55b4120e6432c64153ccab8a848e1"); + // privkey + getFirstRowValue(function(privkey) { + expect(privkey).toBe("6PRNRiFnj1RoR3sXhymdCvoZCgnUHQpfupNdKkFbWJkwWQEKesWt1EDMDM"); + done(); + }, ".privkey"); + }, ".pubkey"); + }, ".address"); + }); +}, bip38delay + 5000); + });