ops.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. /**
  2. * Tests for operations to ensure they output something sensible where expected
  3. *
  4. * @author n1474335 [n1474335@gmail.com]
  5. * @copyright Crown Copyright 2021
  6. * @license Apache-2.0
  7. */
  8. module.exports = {
  9. before: browser => {
  10. browser
  11. .resizeWindow(1280, 800)
  12. .url(browser.launchUrl)
  13. .useCss()
  14. .waitForElementNotPresent("#preloader", 10000)
  15. .click("#auto-bake-label");
  16. },
  17. "Sanity check operations": browser => {
  18. testOp(browser, "A1Z26 Cipher Decode", "20 5 19 20 15 21 20 16 21 20", "testoutput");
  19. testOp(browser, "A1Z26 Cipher Encode", "test input", "20 5 19 20 9 14 16 21 20");
  20. testOp(browser, "ADD", "test input", "Ê»ÉÊv¿ÄÆËÊ", [{ "option": "Hex", "string": "56" }]);
  21. testOp(browser, "AES Decrypt", "b443f7f7c16ac5396a34273f6f639caa", "test output", [{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" }, { "option": "Hex", "string": "00000000000000000000000000000000" }, "CBC", "Hex", "Raw", { "option": "Hex", "string": "" }]);
  22. testOp(browser, "AES Encrypt", "test input", "e42eb8fbfb7a98fff061cd2c1a794d92", [{"option": "Hex", "string": "00112233445566778899aabbccddeeff"}, {"option": "Hex", "string": "00000000000000000000000000000000"}, "CBC", "Raw", "Hex"]);
  23. testOp(browser, "AND", "test input", "4$04 $044", [{ "option": "Hex", "string": "34" }]);
  24. testOp(browser, "Add line numbers", "test input", "1 test input");
  25. // testOp(browser, "Add Text To Image", "test input", "test_output");
  26. testOp(browser, "Adler-32 Checksum", "test input", "16160411");
  27. testOp(browser, "Affine Cipher Decode", "test input", "rcqr glnsr", [1, 2]);
  28. testOp(browser, "Affine Cipher Encode", "test input", "njln rbfpn", [2, 1]);
  29. testOp(browser, "Analyse hash", "0123456789abcdef", /CRC-64/);
  30. testOp(browser, "Atbash Cipher", "test input", "gvhg rmkfg");
  31. // testOp(browser, "Avro to JSON", "test input", "test_output");
  32. // testOp(browser, "BLAKE2b", "test input", "test_output");
  33. // testOp(browser, "BLAKE2s", "test input", "test_output");
  34. // testOp(browser, "BSON deserialise", "test input", "test_output");
  35. // testOp(browser, "BSON serialise", "test input", "test_output");
  36. // testOp(browser, "Bacon Cipher Decode", "test input", "test_output");
  37. // testOp(browser, "Bacon Cipher Encode", "test input", "test_output");
  38. // testOp(browser, "Bcrypt", "test input", "test_output");
  39. // testOp(browser, "Bcrypt compare", "test input", "test_output");
  40. // testOp(browser, "Bcrypt parse", "test input", "test_output");
  41. // testOp(browser, "Bifid Cipher Decode", "test input", "test_output");
  42. // testOp(browser, "Bifid Cipher Encode", "test input", "test_output");
  43. // testOp(browser, "Bit shift left", "test input", "test_output");
  44. // testOp(browser, "Bit shift right", "test input", "test_output");
  45. // testOp(browser, "Blowfish Decrypt", "test input", "test_output");
  46. // testOp(browser, "Blowfish Encrypt", "test input", "test_output");
  47. // testOp(browser, "Blur Image", "test input", "test_output");
  48. // testOp(browser, "Bombe", "test input", "test_output");
  49. // testOp(browser, "Bzip2 Compress", "test input", "test_output");
  50. // testOp(browser, "Bzip2 Decompress", "test input", "test_output");
  51. // testOp(browser, "CRC-16 Checksum", "test input", "test_output");
  52. // testOp(browser, "CRC-32 Checksum", "test input", "test_output");
  53. // testOp(browser, "CRC-8 Checksum", "test input", "test_output");
  54. // testOp(browser, "CSS Beautify", "test input", "test_output");
  55. // testOp(browser, "CSS Minify", "test input", "test_output");
  56. // testOp(browser, "CSS selector", "test input", "test_output");
  57. // testOp(browser, "CSV to JSON", "test input", "test_output");
  58. // testOp(browser, "CTPH", "test input", "test_output");
  59. // testOp(browser, "Cartesian Product", "test input", "test_output");
  60. // testOp(browser, "Change IP format", "test input", "test_output");
  61. // testOp(browser, "Chi Square", "test input", "test_output");
  62. // testOp(browser, "CipherSaber2 Decrypt", "test input", "test_output");
  63. // testOp(browser, "CipherSaber2 Encrypt", "test input", "test_output");
  64. // testOp(browser, "Citrix CTX1 Decode", "test input", "test_output");
  65. // testOp(browser, "Citrix CTX1 Encode", "test input", "test_output");
  66. // testOp(browser, "Colossus", "test input", "test_output");
  67. // testOp(browser, "Comment", "test input", "test_output");
  68. // testOp(browser, "Compare CTPH hashes", "test input", "test_output");
  69. // testOp(browser, "Compare SSDEEP hashes", "test input", "test_output");
  70. // testOp(browser, "Conditional Jump", "test input", "test_output");
  71. // testOp(browser, "Contain Image", "test input", "test_output");
  72. // testOp(browser, "Convert area", "test input", "test_output");
  73. // testOp(browser, "Convert co-ordinate format", "test input", "test_output");
  74. // testOp(browser, "Convert data units", "test input", "test_output");
  75. // testOp(browser, "Convert distance", "test input", "test_output");
  76. // testOp(browser, "Convert Image Format", "test input", "test_output");
  77. // testOp(browser, "Convert mass", "test input", "test_output");
  78. // testOp(browser, "Convert speed", "test input", "test_output");
  79. // testOp(browser, "Convert to NATO alphabet", "test input", "test_output");
  80. // testOp(browser, "Count occurrences", "test input", "test_output");
  81. // testOp(browser, "Cover Image", "test input", "test_output");
  82. // testOp(browser, "Crop Image", "test input", "test_output");
  83. // testOp(browser, "DES Decrypt", "test input", "test_output");
  84. // testOp(browser, "DES Encrypt", "test input", "test_output");
  85. // testOp(browser, "DNS over HTTPS", "test input", "test_output");
  86. // testOp(browser, "Dechunk HTTP response", "test input", "test_output");
  87. // testOp(browser, "Decode NetBIOS Name", "test input", "test_output");
  88. // testOp(browser, "Decode text", "test input", "test_output");
  89. // testOp(browser, "Defang IP Addresses", "test input", "test_output");
  90. // testOp(browser, "Defang URL", "test input", "test_output");
  91. // testOp(browser, "Derive EVP key", "test input", "test_output");
  92. // testOp(browser, "Derive PBKDF2 key", "test input", "test_output");
  93. // testOp(browser, "Detect File Type", "test input", "test_output");
  94. // testOp(browser, "Diff", "test input", "test_output");
  95. // testOp(browser, "Disassemble x86", "test input", "test_output");
  96. // testOp(browser, "Dither Image", "test input", "test_output");
  97. // testOp(browser, "Divide", "test input", "test_output");
  98. // testOp(browser, "Drop bytes", "test input", "test_output");
  99. // testOp(browser, "Encode NetBIOS Name", "test input", "test_output");
  100. // testOp(browser, "Encode text", "test input", "test_output");
  101. // testOp(browser, "Enigma", "test input", "test_output");
  102. // testOp(browser, "Entropy", "test input", "test_output");
  103. // testOp(browser, "Escape string", "test input", "test_output");
  104. // testOp(browser, "Escape Unicode Characters", "test input", "test_output");
  105. // testOp(browser, "Expand alphabet range", "test input", "test_output");
  106. // testOp(browser, "Extract dates", "test input", "test_output");
  107. // testOp(browser, "Extract domains", "test input", "test_output");
  108. // testOp(browser, "Extract EXIF", "test input", "test_output");
  109. // testOp(browser, "Extract email addresses", "test input", "test_output");
  110. // testOp(browser, "Extract file paths", "test input", "test_output");
  111. // testOp(browser, "Extract Files", "test input", "test_output");
  112. // testOp(browser, "Extract IP addresses", "test input", "test_output");
  113. // testOp(browser, "Extract LSB", "test input", "test_output");
  114. // testOp(browser, "Extract MAC addresses", "test input", "test_output");
  115. // testOp(browser, "Extract RGBA", "test input", "test_output");
  116. // testOp(browser, "Extract URLs", "test input", "test_output");
  117. // testOp(browser, "Filter", "test input", "test_output");
  118. // testOp(browser, "Find / Replace", "test input", "test_output");
  119. // testOp(browser, "Fletcher-16 Checksum", "test input", "test_output");
  120. // testOp(browser, "Fletcher-32 Checksum", "test input", "test_output");
  121. // testOp(browser, "Fletcher-64 Checksum", "test input", "test_output");
  122. // testOp(browser, "Fletcher-8 Checksum", "test input", "test_output");
  123. // testOp(browser, "Flip Image", "test input", "test_output");
  124. // testOp(browser, "Fork", "test input", "test_output");
  125. // testOp(browser, "Format MAC addresses", "test input", "test_output");
  126. // testOp(browser, "Frequency distribution", "test input", "test_output");
  127. // testOp(browser, "From BCD", "test input", "test_output");
  128. // testOp(browser, "From Base", "test input", "test_output");
  129. // testOp(browser, "From Base32", "test input", "test_output");
  130. // testOp(browser, "From Base58", "test input", "test_output");
  131. // testOp(browser, "From Base62", "test input", "test_output");
  132. // testOp(browser, "From Base64", "test input", "test_output");
  133. // testOp(browser, "From Base85", "test input", "test_output");
  134. // testOp(browser, "From Binary", "test input", "test_output");
  135. // testOp(browser, "From Braille", "test input", "test_output");
  136. // testOp(browser, "From Case Insensitive Regex", "test input", "test_output");
  137. // testOp(browser, "From Charcode", "test input", "test_output");
  138. // testOp(browser, "From Decimal", "test input", "test_output");
  139. // testOp(browser, "From HTML Entity", "test input", "test_output");
  140. // testOp(browser, "From Hex", "test input", "test_output");
  141. // testOp(browser, "From Hex Content", "test input", "test_output");
  142. // testOp(browser, "From Hexdump", "test input", "test_output");
  143. // testOp(browser, "From MessagePack", "test input", "test_output");
  144. // testOp(browser, "From Morse Code", "test input", "test_output");
  145. // testOp(browser, "From Octal", "test input", "test_output");
  146. // testOp(browser, "From Punycode", "test input", "test_output");
  147. // testOp(browser, "From Quoted Printable", "test input", "test_output");
  148. // testOp(browser, "From UNIX Timestamp", "test input", "test_output");
  149. // testOp(browser, "GOST hash", "test input", "test_output");
  150. // testOp(browser, "Generate all hashes", "test input", "test_output");
  151. // testOp(browser, "Generate HOTP", "test input", "test_output");
  152. // testOp(browser, "Generate Image", "test input", "test_output");
  153. // testOp(browser, "Generate Lorem Ipsum", "test input", "test_output");
  154. // testOp(browser, "Generate PGP Key Pair", "test input", "test_output");
  155. // testOp(browser, "Generate QR Code", "test input", "test_output");
  156. // testOp(browser, "Generate TOTP", "test input", "test_output");
  157. // testOp(browser, "Generate UUID", "test input", "test_output");
  158. // testOp(browser, "Generic Code Beautify", "test input", "test_output");
  159. // testOp(browser, "Group IP addresses", "test input", "test_output");
  160. // testOp(browser, "Gunzip", "test input", "test_output");
  161. // testOp(browser, "Gzip", "test input", "test_output");
  162. // testOp(browser, "HAS-160", "test input", "test_output");
  163. // testOp(browser, "HMAC", "test input", "test_output");
  164. // testOp(browser, "HTML To Text", "test input", "test_output");
  165. // testOp(browser, "HTTP request", "test input", "test_output");
  166. // testOp(browser, "Hamming Distance", "test input", "test_output");
  167. // testOp(browser, "Haversine distance", "test input", "test_output");
  168. // testOp(browser, "Head", "test input", "test_output");
  169. // testOp(browser, "Heatmap chart", "test input", "test_output");
  170. // testOp(browser, "Hex Density chart", "test input", "test_output");
  171. // testOp(browser, "Hex to Object Identifier", "test input", "test_output");
  172. // testOp(browser, "Hex to PEM", "test input", "test_output");
  173. // testOp(browser, "Image Brightness / Contrast", "test input", "test_output");
  174. // testOp(browser, "Image Filter", "test input", "test_output");
  175. // testOp(browser, "Image Hue/Saturation/Lightness", "test input", "test_output");
  176. // testOp(browser, "Image Opacity", "test input", "test_output");
  177. // testOp(browser, "Index of Coincidence", "test input", "test_output");
  178. // testOp(browser, "Invert Image", "test input", "test_output");
  179. // testOp(browser, "JPath expression", "test input", "test_output");
  180. // testOp(browser, "JSON Beautify", "test input", "test_output");
  181. // testOp(browser, "JSON Minify", "test input", "test_output");
  182. // testOp(browser, "JSON to CSV", "test input", "test_output");
  183. // testOp(browser, "JWT Decode", "test input", "test_output");
  184. // testOp(browser, "JWT Sign", "test input", "test_output");
  185. // testOp(browser, "JWT Verify", "test input", "test_output");
  186. // testOp(browser, "JavaScript Beautify", "test input", "test_output");
  187. // testOp(browser, "JavaScript Minify", "test input", "test_output");
  188. // testOp(browser, "JavaScript Parser", "test input", "test_output");
  189. // testOp(browser, "Jump", "test input", "test_output");
  190. // testOp(browser, "Keccak", "test input", "test_output");
  191. // testOp(browser, "Label", "test input", "test_output");
  192. // testOp(browser, "Lorenz", "test input", "test_output");
  193. // testOp(browser, "Luhn Checksum", "test input", "test_output");
  194. // testOp(browser, "MD2", "test input", "test_output");
  195. // testOp(browser, "MD4", "test input", "test_output");
  196. // testOp(browser, "MD5", "test input", "test_output");
  197. // testOp(browser, "MD6", "test input", "test_output");
  198. // testOp(browser, "Magic", "test input", "test_output");
  199. // testOp(browser, "Mean", "test input", "test_output");
  200. // testOp(browser, "Median", "test input", "test_output");
  201. // testOp(browser, "Merge", "test input", "test_output");
  202. // testOp(browser, "Microsoft Script Decoder", "test input", "test_output");
  203. // testOp(browser, "Multiple Bombe", "test input", "test_output");
  204. // testOp(browser, "Multiply", "test input", "test_output");
  205. // testOp(browser, "NOT", "test input", "test_output");
  206. // testOp(browser, "Normalise Image", "test input", "test_output");
  207. // testOp(browser, "Normalise Unicode", "test input", "test_output");
  208. // testOp(browser, "Numberwang", "test input", "test_output");
  209. // testOp(browser, "OR", "test input", "test_output");
  210. // testOp(browser, "Object Identifier to Hex", "test input", "test_output");
  211. // testOp(browser, "Offset checker", "test input", "test_output");
  212. // testOp(browser, "Optical Character Recognition", "test input", "test_output");
  213. // testOp(browser, "PEM to Hex", "test input", "test_output");
  214. // testOp(browser, "PGP Decrypt", "test input", "test_output");
  215. // testOp(browser, "PGP Decrypt and Verify", "test input", "test_output");
  216. // testOp(browser, "PGP Encrypt", "test input", "test_output");
  217. // testOp(browser, "PGP Encrypt and Sign", "test input", "test_output");
  218. // testOp(browser, "PGP Verify", "test input", "test_output");
  219. // testOp(browser, "PHP Deserialize", "test input", "test_output");
  220. // testOp(browser, "Pad lines", "test input", "test_output");
  221. // testOp(browser, "Parse ASN.1 hex string", "test input", "test_output");
  222. // testOp(browser, "Parse colour code", "test input", "test_output");
  223. // testOp(browser, "Parse DateTime", "test input", "test_output");
  224. // testOp(browser, "Parse IP range", "test input", "test_output");
  225. // testOp(browser, "Parse IPv4 header", "test input", "test_output");
  226. // testOp(browser, "Parse IPv6 address", "test input", "test_output");
  227. // testOp(browser, "Parse ObjectID timestamp", "test input", "test_output");
  228. // testOp(browser, "Parse QR Code", "test input", "test_output");
  229. // testOp(browser, "Parse SSH Host Key", "test input", "test_output");
  230. // testOp(browser, "Parse TLV", "test input", "test_output");
  231. // testOp(browser, "Parse UDP", "test input", "test_output");
  232. // testOp(browser, "Parse UNIX file permissions", "test input", "test_output");
  233. // testOp(browser, "Parse URI", "test input", "test_output");
  234. // testOp(browser, "Parse User Agent", "test input", "test_output");
  235. // testOp(browser, "Parse X.509 certificate", "test input", "test_output");
  236. // testOp(browser, "Play Media", "test input", "test_output");
  237. // testOp(browser, "Power Set", "test input", "test_output");
  238. // testOp(browser, "Protobuf Decode", "test input", "test_output");
  239. // testOp(browser, "Pseudo-Random Number Generator", "test input", "test_output");
  240. // testOp(browser, "RC2 Decrypt", "test input", "test_output");
  241. // testOp(browser, "RC2 Encrypt", "test input", "test_output");
  242. // testOp(browser, "RC4", "test input", "test_output");
  243. // testOp(browser, "RC4 Drop", "test input", "test_output");
  244. // testOp(browser, "RIPEMD", "test input", "test_output");
  245. // testOp(browser, "ROT13", "test input", "test_output");
  246. // testOp(browser, "ROT47", "test input", "test_output");
  247. // testOp(browser, "Rail Fence Cipher Decode", "test input", "test_output");
  248. // testOp(browser, "Rail Fence Cipher Encode", "test input", "test_output");
  249. // testOp(browser, "Randomize Colour Palette", "test input", "test_output");
  250. // testOp(browser, "Raw Deflate", "test input", "test_output");
  251. // testOp(browser, "Raw Inflate", "test input", "test_output");
  252. // testOp(browser, "Register", "test input", "test_output");
  253. // testOp(browser, "Regular expression", "test input", "test_output");
  254. // testOp(browser, "Remove Diacritics", "test input", "test_output");
  255. // testOp(browser, "Remove EXIF", "test input", "test_output");
  256. // testOp(browser, "Remove line numbers", "test input", "test_output");
  257. // testOp(browser, "Remove null bytes", "test input", "test_output");
  258. // testOp(browser, "Remove whitespace", "test input", "test_output");
  259. // testOp(browser, "Render Image", "test input", "test_output");
  260. // testOp(browser, "Render Markdown", "test input", "test_output");
  261. // testOp(browser, "Resize Image", "test input", "test_output");
  262. // testOp(browser, "Return", "test input", "test_output");
  263. // testOp(browser, "Reverse", "test input", "test_output");
  264. // testOp(browser, "Rotate Image", "test input", "test_output");
  265. // testOp(browser, "Rotate left", "test input", "test_output");
  266. // testOp(browser, "Rotate right", "test input", "test_output");
  267. // testOp(browser, "SHA0", "test input", "test_output");
  268. // testOp(browser, "SHA1", "test input", "test_output");
  269. // testOp(browser, "SHA2", "test input", "test_output");
  270. // testOp(browser, "SHA3", "test input", "test_output");
  271. // testOp(browser, "SQL Beautify", "test input", "test_output");
  272. // testOp(browser, "SQL Minify", "test input", "test_output");
  273. // testOp(browser, "SSDEEP", "test input", "test_output");
  274. // testOp(browser, "SUB", "test input", "test_output");
  275. // testOp(browser, "Scan for Embedded Files", "test input", "test_output");
  276. // testOp(browser, "Scatter chart", "test input", "test_output");
  277. // testOp(browser, "Scrypt", "test input", "test_output");
  278. // testOp(browser, "Series chart", "test input", "test_output");
  279. // testOp(browser, "Set Difference", "test input", "test_output");
  280. // testOp(browser, "Set Intersection", "test input", "test_output");
  281. // testOp(browser, "Set Union", "test input", "test_output");
  282. // testOp(browser, "Shake", "test input", "test_output");
  283. // testOp(browser, "Sharpen Image", "test input", "test_output");
  284. // testOp(browser, "Show Base64 offsets", "test input", "test_output");
  285. // testOp(browser, "Show on map", "test input", "test_output");
  286. // testOp(browser, "Sleep", "test input", "test_output");
  287. // testOp(browser, "Snefru", "test input", "test_output");
  288. // testOp(browser, "Sort", "test input", "test_output");
  289. // testOp(browser, "Split", "test input", "test_output");
  290. // testOp(browser, "Split Colour Channels", "test input", "test_output");
  291. // testOp(browser, "Standard Deviation", "test input", "test_output");
  292. // testOp(browser, "Streebog", "test input", "test_output");
  293. // testOp(browser, "Strings", "test input", "test_output");
  294. // testOp(browser, "Strip HTML tags", "test input", "test_output");
  295. // testOp(browser, "Strip HTTP headers", "test input", "test_output");
  296. // testOp(browser, "Subsection", "test input", "test_output");
  297. // testOp(browser, "Substitute", "test input", "test_output");
  298. // testOp(browser, "Subtract", "test input", "test_output");
  299. // testOp(browser, "Sum", "test input", "test_output");
  300. // testOp(browser, "Swap endianness", "test input", "test_output");
  301. // testOp(browser, "Symmetric Difference", "test input", "test_output");
  302. // testOp(browser, "Syntax highlighter", "test input", "test_output");
  303. // testOp(browser, "TCP/IP Checksum", "test input", "test_output");
  304. // testOp(browser, "Tail", "test input", "test_output");
  305. // testOp(browser, "Take bytes", "test input", "test_output");
  306. // testOp(browser, "Tar", "test input", "test_output");
  307. // testOp(browser, "Text Encoding Brute Force", "test input", "test_output");
  308. // testOp(browser, "To BCD", "test input", "test_output");
  309. // testOp(browser, "To Base", "test input", "test_output");
  310. // testOp(browser, "To Base32", "test input", "test_output");
  311. // testOp(browser, "To Base58", "test input", "test_output");
  312. // testOp(browser, "To Base62", "test input", "test_output");
  313. // testOp(browser, "To Base64", "test input", "test_output");
  314. // testOp(browser, "To Base85", "test input", "test_output");
  315. // testOp(browser, "To Binary", "test input", "test_output");
  316. // testOp(browser, "To Braille", "test input", "test_output");
  317. // testOp(browser, "To Camel case", "test input", "test_output");
  318. // testOp(browser, "To Case Insensitive Regex", "test input", "test_output");
  319. // testOp(browser, "To Charcode", "test input", "test_output");
  320. // testOp(browser, "To Decimal", "test input", "test_output");
  321. // testOp(browser, "To HTML Entity", "test input", "test_output");
  322. // testOp(browser, "To Hex", "test input", "test_output");
  323. // testOp(browser, "To Hex Content", "test input", "test_output");
  324. // testOp(browser, "To Hexdump", "test input", "test_output");
  325. // testOp(browser, "To Kebab case", "test input", "test_output");
  326. // testOp(browser, "To Lower case", "test input", "test_output");
  327. // testOp(browser, "To MessagePack", "test input", "test_output");
  328. // testOp(browser, "To Morse Code", "test input", "test_output");
  329. // testOp(browser, "To Octal", "test input", "test_output");
  330. // testOp(browser, "To Punycode", "test input", "test_output");
  331. // testOp(browser, "To Quoted Printable", "test input", "test_output");
  332. // testOp(browser, "To Snake case", "test input", "test_output");
  333. // testOp(browser, "To Table", "test input", "test_output");
  334. // testOp(browser, "To UNIX Timestamp", "test input", "test_output");
  335. // testOp(browser, "To Upper case", "test input", "test_output");
  336. // testOp(browser, "Translate DateTime Format", "test input", "test_output");
  337. // testOp(browser, "Triple DES Decrypt", "test input", "test_output");
  338. // testOp(browser, "Triple DES Encrypt", "test input", "test_output");
  339. // testOp(browser, "Typex", "test input", "test_output");
  340. // testOp(browser, "UNIX Timestamp to Windows Filetime", "test input", "test_output");
  341. // testOp(browser, "URL Decode", "test input", "test_output");
  342. // testOp(browser, "URL Encode", "test input", "test_output");
  343. // testOp(browser, "Unescape string", "test input", "test_output");
  344. // testOp(browser, "Unescape Unicode Characters", "test input", "test_output");
  345. // testOp(browser, "Unique", "test input", "test_output");
  346. // testOp(browser, "Untar", "test input", "test_output");
  347. // testOp(browser, "Unzip", "test input", "test_output");
  348. // testOp(browser, "VarInt Decode", "test input", "test_output");
  349. // testOp(browser, "VarInt Encode", "test input", "test_output");
  350. // testOp(browser, "View Bit Plane", "test input", "test_output");
  351. // testOp(browser, "Vigenère Decode", "test input", "test_output");
  352. // testOp(browser, "Vigenère Encode", "test input", "test_output");
  353. // testOp(browser, "Whirlpool", "test input", "test_output");
  354. // testOp(browser, "Windows Filetime to UNIX Timestamp", "test input", "test_output");
  355. // testOp(browser, "XKCD Random Number", "test input", "test_output");
  356. // testOp(browser, "XML Beautify", "test input", "test_output");
  357. // testOp(browser, "XML Minify", "test input", "test_output");
  358. // testOp(browser, "XOR", "test input", "test_output");
  359. // testOp(browser, "XOR Brute Force", "test input", "test_output");
  360. // testOp(browser, "XPath expression", "test input", "test_output");
  361. // testOp(browser, "YARA Rules", "test input", "test_output");
  362. // testOp(browser, "Zip", "test input", "test_output");
  363. // testOp(browser, "Zlib Deflate", "test input", "test_output");
  364. // testOp(browser, "Zlib Inflate", "test input", "test_output");
  365. },
  366. after: browser => {
  367. browser.end();
  368. }
  369. };
  370. /**
  371. * Clears the current recipe and tests a new operation.
  372. *
  373. * @param {string} opName
  374. * @param {Browser} browser
  375. */
  376. function testOp(browser, opName, input, output, args=[]) {
  377. const recipeConfig = JSON.stringify([{
  378. "op": opName,
  379. "args": args
  380. }]);
  381. browser
  382. .perform(function() {
  383. console.log(opName);
  384. })
  385. .useCss()
  386. .click("#clr-recipe")
  387. .click("#clr-io")
  388. .waitForElementNotPresent("#rec-list li.operation")
  389. .expect.element("#input-text").to.have.property("value").that.equals("");
  390. browser
  391. .urlHash("recipe=" + recipeConfig)
  392. .setValue("#input-text", input)
  393. .waitForElementPresent("#rec-list li.operation")
  394. .expect.element("#input-text").to.have.property("value").that.equals(input);
  395. browser
  396. .waitForElementVisible("#stale-indicator", 5000)
  397. .pause(100)
  398. .click("#bake")
  399. .pause(100)
  400. .waitForElementPresent("#stale-indicator.hidden", 5000)
  401. .waitForElementNotVisible("#output-loader", 5000);
  402. if (typeof output === "string") {
  403. browser.expect.element("#output-text").to.have.property("value").that.equals(output);
  404. } else if (output instanceof RegExp) {
  405. browser.expect.element("#output-text").to.have.property("value").that.matches(output);
  406. }
  407. }