function() {
page.open(url, function(status) {
// set the length to 6
- var expectedLength = 6;
+ var expectedLength = "6";
page.evaluate(function() {
- $(".strength").val(expectedLength);
+ $(".strength option[selected]").removeAttr("selected");
+ $(".strength option[value=6]").prop("selected", true);
});
// press the 'generate' button
page.evaluate(function() {
console.log("Actual: " + actualLength);
fail();
}
- }, 200);
- next();
+ next();
+ }, 1000);
});
},
-// TODO finish these tests
-
// Passphrase can be set
+function() {
+page.open(url, function(status) {
+ // set the phrase and passphrase
+ var expected = "15pJzUWPGzR7avffV9nY5by4PSgSKG9rba";
+ page.evaluate(function() {
+ $(".phrase").val("abandon abandon ability");
+ $(".passphrase").val("secure_passphrase").trigger("input");
+ });
+ // check the address is generated correctly
+ setTimeout(function() {
+ var actual = page.evaluate(function() {
+ return $(".address:first").text();
+ });
+ if (actual != expected) {
+ console.log("Passphrase results in wrong address");
+ console.log("Expected: " + expected);
+ console.log("Actual: " + actual);
+ fail();
+ }
+ next();
+ }, 1000);
+});
+},
+
// Network can be set to bitcoin testnet
+function() {
+page.open(url, function(status) {
+ // set the phrase and coin
+ var expected = "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi";
+ page.evaluate(function() {
+ $(".phrase").val("abandon abandon ability");
+ $(".phrase").trigger("input");
+ $(".network option[selected]").removeAttr("selected");
+ $(".network option[value=1]").prop("selected", true);
+ $(".network").trigger("change");
+ });
+ // check the address is generated correctly
+ setTimeout(function() {
+ var actual = page.evaluate(function() {
+ return $(".address:first").text();
+ });
+ if (actual != expected) {
+ console.log("Bitcoin testnet address is incorrect");
+ console.log("Expected: " + expected);
+ console.log("Actual: " + actual);
+ fail();
+ }
+ next();
+ }, 1000);
+});
+},
+
// Network can be set to litecoin
+function() {
+page.open(url, function(status) {
+ // set the phrase and coin
+ var expected = "LQ4XU8RX2ULPmPq9FcUHdVmPVchP9nwXdn";
+ page.evaluate(function() {
+ $(".phrase").val("abandon abandon ability");
+ $(".phrase").trigger("input");
+ $(".network option[selected]").removeAttr("selected");
+ $(".network option[value=2]").prop("selected", true);
+ $(".network").trigger("change");
+ });
+ // check the address is generated correctly
+ setTimeout(function() {
+ var actual = page.evaluate(function() {
+ return $(".address:first").text();
+ });
+ if (actual != expected) {
+ console.log("Litecoin address is incorrect");
+ console.log("Expected: " + expected);
+ console.log("Actual: " + actual);
+ fail();
+ }
+ next();
+ }, 1000);
+});
+},
+
// Network can be set to dogecoin
+function() {
+page.open(url, function(status) {
+ // set the phrase and coin
+ var expected = "DPQH2AtuzkVSG6ovjKk4jbUmZ6iXLpgbJA";
+ page.evaluate(function() {
+ $(".phrase").val("abandon abandon ability");
+ $(".phrase").trigger("input");
+ $(".network option[selected]").removeAttr("selected");
+ $(".network option[value=3]").prop("selected", true);
+ $(".network").trigger("change");
+ });
+ // check the address is generated correctly
+ setTimeout(function() {
+ var actual = page.evaluate(function() {
+ return $(".address:first").text();
+ });
+ if (actual != expected) {
+ console.log("Dogecoin address is incorrect");
+ console.log("Expected: " + expected);
+ console.log("Actual: " + actual);
+ fail();
+ }
+ next();
+ }, 1000);
+});
+},
+
// Network can be set to shadowcash
+function() {
+page.open(url, function(status) {
+ // set the phrase and coin
+ var expected = "SiSZtfYAXEFvMm3XM8hmtkGDyViRwErtCG";
+ page.evaluate(function() {
+ $(".phrase").val("abandon abandon ability");
+ $(".phrase").trigger("input");
+ $(".network option[selected]").removeAttr("selected");
+ $(".network option[value=4]").prop("selected", true);
+ $(".network").trigger("change");
+ });
+ // check the address is generated correctly
+ setTimeout(function() {
+ var actual = page.evaluate(function() {
+ return $(".address:first").text();
+ });
+ if (actual != expected) {
+ console.log("Shadowcash address is incorrect");
+ console.log("Expected: " + expected);
+ console.log("Actual: " + actual);
+ fail();
+ }
+ next();
+ }, 1000);
+});
+},
+
// Network can be set to shadowcash testnet
+function() {
+page.open(url, function(status) {
+ // set the phrase and coin
+ var expected = "tM2EDpVKaTiEg2NZg3yKg8eqjLr55BErHe";
+ page.evaluate(function() {
+ $(".phrase").val("abandon abandon ability");
+ $(".phrase").trigger("input");
+ $(".network option[selected]").removeAttr("selected");
+ $(".network option[value=5]").prop("selected", true);
+ $(".network").trigger("change");
+ });
+ // check the address is generated correctly
+ setTimeout(function() {
+ var actual = page.evaluate(function() {
+ return $(".address:first").text();
+ });
+ if (actual != expected) {
+ console.log("Shadowcash testnet address is incorrect");
+ console.log("Expected: " + expected);
+ console.log("Actual: " + actual);
+ fail();
+ }
+ next();
+ }, 1000);
+});
+},
+
// Network can be set to viacoin
+function() {
+page.open(url, function(status) {
+ // set the phrase and coin
+ var expected = "Vq9Eq4N5SQnjqZvxtxzo7hZPW5XnyJsmXT";
+ page.evaluate(function() {
+ $(".phrase").val("abandon abandon ability");
+ $(".phrase").trigger("input");
+ $(".network option[selected]").removeAttr("selected");
+ $(".network option[value=6]").prop("selected", true);
+ $(".network").trigger("change");
+ });
+ // check the address is generated correctly
+ setTimeout(function() {
+ var actual = page.evaluate(function() {
+ return $(".address:first").text();
+ });
+ if (actual != expected) {
+ console.log("Viacoin address is incorrect");
+ console.log("Expected: " + expected);
+ console.log("Actual: " + actual);
+ fail();
+ }
+ next();
+ }, 1000);
+});
+},
+
// Network can be set to viacoin testnet
+function() {
+page.open(url, function(status) {
+ // set the phrase and coin
+ var expected = "tM2EDpVKaTiEg2NZg3yKg8eqjLr55BErHe";
+ page.evaluate(function() {
+ $(".phrase").val("abandon abandon ability");
+ $(".phrase").trigger("input");
+ $(".network option[selected]").removeAttr("selected");
+ $(".network option[value=7]").prop("selected", true);
+ $(".network").trigger("change");
+ });
+ // check the address is generated correctly
+ setTimeout(function() {
+ var actual = page.evaluate(function() {
+ return $(".address:first").text();
+ });
+ if (actual != expected) {
+ console.log("Viacoin testnet address is incorrect");
+ console.log("Expected: " + expected);
+ console.log("Actual: " + actual);
+ fail();
+ }
+ next();
+ }, 1000);
+});
+},
+
// Network can be set to jumbucks
+function() {
+page.open(url, function(status) {
+ // set the phrase and coin
+ var expected = "JLEXccwDXADK4RxBPkRez7mqsHVoJBEUew";
+ page.evaluate(function() {
+ $(".phrase").val("abandon abandon ability");
+ $(".phrase").trigger("input");
+ $(".network option[selected]").removeAttr("selected");
+ $(".network option[value=8]").prop("selected", true);
+ $(".network").trigger("change");
+ });
+ // check the address is generated correctly
+ setTimeout(function() {
+ var actual = page.evaluate(function() {
+ return $(".address:first").text();
+ });
+ if (actual != expected) {
+ console.log("Jumbucks address is incorrect");
+ console.log("Expected: " + expected);
+ console.log("Actual: " + actual);
+ fail();
+ }
+ next();
+ }, 1000);
+});
+},
+
// Network can be set to clam
+function() {
+page.open(url, function(status) {
+ // set the phrase and coin
+ var expected = "xCp4sakjVx4pUAZ6cBCtuin8Ddb6U1sk9y";
+ page.evaluate(function() {
+ $(".phrase").val("abandon abandon ability");
+ $(".phrase").trigger("input");
+ $(".network option[selected]").removeAttr("selected");
+ $(".network option[value=9]").prop("selected", true);
+ $(".network").trigger("change");
+ });
+ // check the address is generated correctly
+ setTimeout(function() {
+ var actual = page.evaluate(function() {
+ return $(".address:first").text();
+ });
+ if (actual != expected) {
+ console.log("CLAM address is incorrect");
+ console.log("Expected: " + expected);
+ console.log("Actual: " + actual);
+ fail();
+ }
+ next();
+ }, 1000);
+});
+},
+
+// TODO finish these tests
// BIP39 seed is set from phrase
// BIP32 root key is set from phrase
// Additional addresses are shown in order of derivation path
// BIP32 root key can be set by the user
-// Setting BIP32 clears the existing phrase, passphrase and seed
+// Setting BIP32 root key clears the existing phrase, passphrase and seed
+// Clearing of phrase, passphrase and seed can be cancelled by user
// Custom BIP32 root key is used when changing the derivation path
// Incorrect mnemonic shows error