X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fspec%2Ftests.js;h=94fc67225bde24ff689efb227a63a1f7c8bdd8cc;hb=c147cb5e4f40297c2377ecb5b03975b3f04d75bd;hp=571047f340fcbf12960797ba2090bcbbf6829a3b;hpb=85f762c905ce27b728e5e9729bc658f5f6f8d5f3;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git diff --git a/tests/spec/tests.js b/tests/spec/tests.js index 571047f..94fc672 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js @@ -553,7 +553,7 @@ it('Allows selection of slimcoin testnet', function(done) { it('Allows selection of bitcoin cash', function(done) { var params = { selectText: "BCH - Bitcoin Cash", - firstAddress: "1JKvb6wKtsjNoCRxpZ4DGrbniML7z5U16A", + firstAddress: "bitcoincash:qzlquk7w4hkudxypl4fgv8x279r754dkvur7jpcsps", }; testNetwork(done, params); }); @@ -690,6 +690,20 @@ it('Allows selection of Bitcoinplus', function(done) { }; testNetwork(done, params); }); +it('Allows selection of Bitcoin Private', function(done) { + var params = { + selectText: "BTCP - Bitcoin Private", + firstAddress: "b1M3PbiXXyN6Hdivdw5rJv5VKpLjPzhm4jM", + }; + testNetwork(done, params); +}); +it('Allows selection of Bitcoinz', function(done) { + var params = { + selectText: "BTCZ - Bitcoinz", + firstAddress: "t1X2YQoxs8cYRo2oaBYgVEwW5QNjCC59NYc", + }; + testNetwork(done, params); +}); it('Allows selection of Bitcore', function(done) { var params = { selectText: "BTX - Bitcore", @@ -900,6 +914,13 @@ it('Allows selection of Ixcoin', function(done) { }; testNetwork(done, params); }); +it('Allows selection of Kobocoin', function(done) { + var params = { + selectText: "KOBO - Kobocoin", + firstAddress: "FTVoNJETXDAM8x7MnmdE8RwWndSr9PQWhy", + }; + testNetwork(done, params); +}); it('Allows selection of Landcoin', function(done) { var params = { selectText: "LDCN - Landcoin", @@ -1159,6 +1180,34 @@ it('Allows selection of Zcoin', function(done) { }; testNetwork(done, params); }); +it('Allows selection of Zcash', function(done) { + var params = { + selectText: "ZEC - Zcash", + firstAddress: "t1Sz8AneMcVuzUg3tPJ8et5AS5LFJ7K2EF9", + }; + testNetwork(done, params); +}); +it('Allows selection of Zclassic', function(done) { + var params = { + selectText: "ZCL - Zclassic", + firstAddress: "t1TBMxTvVJRybUbMLGWq8H4A8F4VUL7czEc", + }; + testNetwork(done, params); +}); +it('Allows selection of Zencash', function(done) { + var params = { + selectText: "ZEN - Zencash", + firstAddress: "znWh9XASyW2dZq5tck84wFjiwuqVysi7q3p", + }; + testNetwork(done, params); +}); +it('Allows selection of Energi', function(done) { + var params = { + selectText: "NRG - Energi", + firstAddress: "EejRy4t4nidzhGGzkJUgFP3z4HYBjhTsRt", + }; + testNetwork(done, params); +}); // BIP39 seed is set from phrase @@ -3106,10 +3155,26 @@ it('Warns when entropy is filtered and discarded', function(done) { }); }); +// Bitcoin Cash address can be set to use cashaddr format +it('Can use cashaddr format for bitcoin cash addresses', function(done) { + driver.executeScript(function() { + $(".use-bch-cashaddr-addresses").prop("checked", true); + }); + driver.findElement(By.css('.phrase')) + .sendKeys("abandon abandon ability"); + selectNetwork("BCH - Bitcoin Cash"); + driver.sleep(generateDelay).then(function() { + getFirstAddress(function(address) { + expect(address).toBe("bitcoincash:qzlquk7w4hkudxypl4fgv8x279r754dkvur7jpcsps"); + done(); + }); + }); +}); + // Bitcoin Cash address can be set to use bitpay format it('Can use bitpay format for bitcoin cash addresses', function(done) { driver.executeScript(function() { - $(".use-bitpay-addresses").prop("checked", true); + $(".use-bch-bitpay-addresses").prop("checked", true); }); driver.findElement(By.css('.phrase')) .sendKeys("abandon abandon ability"); @@ -3122,6 +3187,22 @@ it('Can use bitpay format for bitcoin cash addresses', function(done) { }); }); +// Bitcoin Cash address can be set to use legacy format +it('Can use legacy format for bitcoin cash addresses', function(done) { + driver.executeScript(function() { + $(".use-bch-legacy-addresses").prop("checked", true); + }); + driver.findElement(By.css('.phrase')) + .sendKeys("abandon abandon ability"); + selectNetwork("BCH - Bitcoin Cash"); + driver.sleep(generateDelay).then(function() { + getFirstAddress(function(address) { + expect(address).toBe("1JKvb6wKtsjNoCRxpZ4DGrbniML7z5U16A"); + done(); + }); + }); +}); + // End of tests ported from old suit, so no more comments above each test now it('Can generate more addresses from a custom index', function(done) { @@ -3503,4 +3584,63 @@ it('Uses vprv for bitcoin testnet p2wpkh', function(done) { }); }); +it('Shows a warning if generating weak mnemonics', function(done) { + driver.executeScript(function() { + $(".strength option[selected]").removeAttr("selected"); + $(".strength option[value=6]").prop("selected", true); + $(".strength").trigger("change"); + }); + driver.findElement(By.css(".generate-container .warning")) + .getAttribute("class") + .then(function(classes) { + expect(classes).not.toContain("hidden"); + done(); + }); +}); + +it('Does not show a warning if generating strong mnemonics', function(done) { + driver.executeScript(function() { + $(".strength option[selected]").removeAttr("selected"); + $(".strength option[value=12]").prop("selected", true); + }); + driver.findElement(By.css(".generate-container .warning")) + .getAttribute("class") + .then(function(classes) { + expect(classes).toContain("hidden"); + done(); + }); +}); + +it('Shows a warning if overriding weak entropy with longer mnemonics', function(done) { + driver.findElement(By.css('.use-entropy')) + .click(); + driver.findElement(By.css('.entropy')) + .sendKeys("0123456789abcdef"); // 6 words + driver.executeScript(function() { + $(".mnemonic-length").val("12").trigger("change"); + }); + driver.findElement(By.css(".weak-entropy-override-warning")) + .getAttribute("class") + .then(function(classes) { + expect(classes).not.toContain("hidden"); + done(); + }); +}); + +it('Does not show a warning if entropy is stronger than mnemonic length', function(done) { + driver.findElement(By.css('.use-entropy')) + .click(); + driver.findElement(By.css('.entropy')) + .sendKeys("0123456789abcdef0123456789abcdef0123456789abcdef"); // 18 words + driver.executeScript(function() { + $(".mnemonic-length").val("12").trigger("change"); + }); + driver.findElement(By.css(".weak-entropy-override-warning")) + .getAttribute("class") + .then(function(classes) { + expect(classes).toContain("hidden"); + done(); + }); +}); + });