1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/services/sync/tests/tps/test_passwords.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,113 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/* 1.8 + * The list of phases mapped to their corresponding profiles. The object 1.9 + * here must be in strict JSON format, as it will get parsed by the Python 1.10 + * testrunner (no single quotes, extra comma's, etc). 1.11 + */ 1.12 +EnableEngines(["passwords"]); 1.13 + 1.14 +var phases = { "phase1": "profile1", 1.15 + "phase2": "profile2", 1.16 + "phase3": "profile1", 1.17 + "phase4": "profile2" }; 1.18 + 1.19 +/* 1.20 + * Password asset lists: these define password entries that are used during 1.21 + * the test 1.22 + */ 1.23 + 1.24 +// initial password list to be loaded into the browser 1.25 +var passwords_initial = [ 1.26 + { hostname: "http://www.example.com", 1.27 + submitURL: "http://login.example.com", 1.28 + username: "joe", 1.29 + password: "SeCrEt123", 1.30 + usernameField: "uname", 1.31 + passwordField: "pword", 1.32 + changes: { 1.33 + password: "zippity-do-dah" 1.34 + } 1.35 + }, 1.36 + { hostname: "http://www.example.com", 1.37 + realm: "login", 1.38 + username: "joe", 1.39 + password: "secretlogin" 1.40 + } 1.41 +]; 1.42 + 1.43 +// expected state of passwords after the changes in the above list are applied 1.44 +var passwords_after_first_update = [ 1.45 + { hostname: "http://www.example.com", 1.46 + submitURL: "http://login.example.com", 1.47 + username: "joe", 1.48 + password: "zippity-do-dah", 1.49 + usernameField: "uname", 1.50 + passwordField: "pword" 1.51 + }, 1.52 + { hostname: "http://www.example.com", 1.53 + realm: "login", 1.54 + username: "joe", 1.55 + password: "secretlogin" 1.56 + } 1.57 +]; 1.58 + 1.59 +var passwords_to_delete = [ 1.60 + { hostname: "http://www.example.com", 1.61 + realm: "login", 1.62 + username: "joe", 1.63 + password: "secretlogin" 1.64 + } 1.65 +]; 1.66 + 1.67 +var passwords_absent = [ 1.68 + { hostname: "http://www.example.com", 1.69 + realm: "login", 1.70 + username: "joe", 1.71 + password: "secretlogin" 1.72 + } 1.73 +]; 1.74 + 1.75 +// expected state of passwords after the delete operation 1.76 +var passwords_after_second_update = [ 1.77 + { hostname: "http://www.example.com", 1.78 + submitURL: "http://login.example.com", 1.79 + username: "joe", 1.80 + password: "zippity-do-dah", 1.81 + usernameField: "uname", 1.82 + passwordField: "pword" 1.83 + } 1.84 +]; 1.85 + 1.86 +/* 1.87 + * Test phases 1.88 + */ 1.89 + 1.90 +Phase('phase1', [ 1.91 + [Passwords.add, passwords_initial], 1.92 + [Sync] 1.93 +]); 1.94 + 1.95 +Phase('phase2', [ 1.96 + [Sync], 1.97 + [Passwords.verify, passwords_initial], 1.98 + [Passwords.modify, passwords_initial], 1.99 + [Passwords.verify, passwords_after_first_update], 1.100 + [Sync] 1.101 +]); 1.102 + 1.103 +Phase('phase3', [ 1.104 + [Sync], 1.105 + [Passwords.verify, passwords_after_first_update], 1.106 + [Passwords.delete, passwords_to_delete], 1.107 + [Passwords.verify, passwords_after_second_update], 1.108 + [Passwords.verifyNot, passwords_absent], 1.109 + [Sync] 1.110 +]); 1.111 + 1.112 +Phase('phase4', [ 1.113 + [Sync], 1.114 + [Passwords.verify, passwords_after_second_update], 1.115 + [Passwords.verifyNot, passwords_absent] 1.116 +]);