diff options
-rw-r--r-- | tests.js | 105 |
1 files changed, 104 insertions, 1 deletions
@@ -978,7 +978,6 @@ page.open(url, function(status) { | |||
978 | $(".phrase").val("abandon abandon ability"); | 978 | $(".phrase").val("abandon abandon ability"); |
979 | $(".phrase").trigger("input"); | 979 | $(".phrase").trigger("input"); |
980 | }); | 980 | }); |
981 | // check the path is not shown | ||
982 | waitForGenerate(function() { | 981 | waitForGenerate(function() { |
983 | // toggle path visibility | 982 | // toggle path visibility |
984 | page.evaluate(function() { | 983 | page.evaluate(function() { |
@@ -1022,9 +1021,113 @@ page.open(url, function(status) { | |||
1022 | }, | 1021 | }, |
1023 | 1022 | ||
1024 | // Addresses are shown in order of derivation path | 1023 | // Addresses are shown in order of derivation path |
1024 | function() { | ||
1025 | page.open(url, function(status) { | ||
1026 | // set the phrase | ||
1027 | page.evaluate(function() { | ||
1028 | $(".phrase").val("abandon abandon ability").trigger("input"); | ||
1029 | }); | ||
1030 | // get the derivation paths | ||
1031 | waitForGenerate(function() { | ||
1032 | var paths = page.evaluate(function() { | ||
1033 | return $(".index").map(function(i, e) { | ||
1034 | return $(e).text(); | ||
1035 | }); | ||
1036 | }); | ||
1037 | if (paths.length != 20) { | ||
1038 | console.log("Total paths is less than expected: " + paths.length); | ||
1039 | fail(); | ||
1040 | } | ||
1041 | for (var i=0; i<paths.length; i++) { | ||
1042 | var expected = "m/44'/0'/0'/0/" + i; | ||
1043 | var actual = paths[i]; | ||
1044 | if (actual != expected) { | ||
1045 | console.log("Path " + i + " is incorrect"); | ||
1046 | console.log("Expected: " + expected); | ||
1047 | console.log("Actual: " + actual); | ||
1048 | fail(); | ||
1049 | } | ||
1050 | } | ||
1051 | next(); | ||
1052 | }); | ||
1053 | }); | ||
1054 | }, | ||
1055 | |||
1025 | // Address visibility can be toggled | 1056 | // Address visibility can be toggled |
1057 | function() { | ||
1058 | page.open(url, function(status) { | ||
1059 | // set the phrase | ||
1060 | page.evaluate(function() { | ||
1061 | $(".phrase").val("abandon abandon ability"); | ||
1062 | $(".phrase").trigger("input"); | ||
1063 | }); | ||
1064 | waitForGenerate(function() { | ||
1065 | // toggle address visibility | ||
1066 | page.evaluate(function() { | ||
1067 | $(".address-toggle").click(); | ||
1068 | }); | ||
1069 | // check the address is not visible | ||
1070 | var isInvisible = page.evaluate(function() { | ||
1071 | return $(".address:first span").hasClass("invisible"); | ||
1072 | }); | ||
1073 | if (!isInvisible) { | ||
1074 | console.log("Toggled address is visible"); | ||
1075 | fail(); | ||
1076 | } | ||
1077 | next(); | ||
1078 | }); | ||
1079 | }); | ||
1080 | }, | ||
1081 | |||
1026 | // Private key is shown | 1082 | // Private key is shown |
1083 | function() { | ||
1084 | page.open(url, function(status) { | ||
1085 | var expected = "L26cVSpWFkJ6aQkPkKmTzLqTdLJ923e6CzrVh9cmx21QHsoUmrEE"; | ||
1086 | // set the phrase | ||
1087 | page.evaluate(function() { | ||
1088 | $(".phrase").val("abandon abandon ability").trigger("input"); | ||
1089 | }); | ||
1090 | // get the address | ||
1091 | waitForGenerate(function() { | ||
1092 | var actual = page.evaluate(function() { | ||
1093 | return $(".privkey:first").text(); | ||
1094 | }); | ||
1095 | if (actual != expected) { | ||
1096 | console.log("Private key is not shown"); | ||
1097 | console.log("Expected: " + expected); | ||
1098 | console.log("Got: " + actual); | ||
1099 | fail(); | ||
1100 | } | ||
1101 | next(); | ||
1102 | }); | ||
1103 | }); | ||
1104 | }, | ||
1105 | |||
1027 | // Private key visibility can be toggled | 1106 | // Private key visibility can be toggled |
1107 | function() { | ||
1108 | page.open(url, function(status) { | ||
1109 | // set the phrase | ||
1110 | page.evaluate(function() { | ||
1111 | $(".phrase").val("abandon abandon ability"); | ||
1112 | $(".phrase").trigger("input"); | ||
1113 | }); | ||
1114 | waitForGenerate(function() { | ||
1115 | // toggle private key visibility | ||
1116 | page.evaluate(function() { | ||
1117 | $(".private-key-toggle").click(); | ||
1118 | }); | ||
1119 | // check the private key is not visible | ||
1120 | var isInvisible = page.evaluate(function() { | ||
1121 | return $(".privkey:first span").hasClass("invisible"); | ||
1122 | }); | ||
1123 | if (!isInvisible) { | ||
1124 | console.log("Toggled private key is visible"); | ||
1125 | fail(); | ||
1126 | } | ||
1127 | next(); | ||
1128 | }); | ||
1129 | }); | ||
1130 | }, | ||
1028 | 1131 | ||
1029 | // More addresses can be generated | 1132 | // More addresses can be generated |
1030 | // A custom number of additional addresses can be generated | 1133 | // A custom number of additional addresses can be generated |