services/sync/tests/tps/test_sync.js

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /*
michael@0 5 * The list of phases mapped to their corresponding profiles. The object
michael@0 6 * here must be in strict JSON format, as it will get parsed by the Python
michael@0 7 * testrunner (no single quotes, extra comma's, etc).
michael@0 8 */
michael@0 9
michael@0 10 var phases = { "phase1": "profile1",
michael@0 11 "phase2": "profile2",
michael@0 12 "phase3": "profile1",
michael@0 13 "phase4": "profile2" };
michael@0 14
michael@0 15 /*
michael@0 16 * Bookmark asset lists: these define bookmarks that are used during the test
michael@0 17 */
michael@0 18
michael@0 19 // the initial list of bookmarks to be added to the browser
michael@0 20 var bookmarks_initial = {
michael@0 21 "menu": [
michael@0 22 { uri: "http://www.google.com",
michael@0 23 loadInSidebar: true,
michael@0 24 tags: ["google", "computers", "internet", "www"],
michael@0 25 changes: {
michael@0 26 title: "Google",
michael@0 27 loadInSidebar: false,
michael@0 28 tags: ["google", "computers", "misc"],
michael@0 29 }
michael@0 30 },
michael@0 31 { uri: "http://bugzilla.mozilla.org/show_bug.cgi?id=%s",
michael@0 32 title: "Bugzilla",
michael@0 33 keyword: "bz",
michael@0 34 changes: {
michael@0 35 keyword: "bugzilla"
michael@0 36 }
michael@0 37 },
michael@0 38 { folder: "foldera" },
michael@0 39 { uri: "http://www.mozilla.com" },
michael@0 40 { separator: true },
michael@0 41 { folder: "folderb" },
michael@0 42 ],
michael@0 43 "menu/foldera": [
michael@0 44 { uri: "http://www.yahoo.com",
michael@0 45 title: "testing Yahoo",
michael@0 46 changes: {
michael@0 47 location: "menu/folderb"
michael@0 48 }
michael@0 49 },
michael@0 50 { uri: "http://www.cnn.com",
michael@0 51 description: "This is a description of the site a at www.cnn.com",
michael@0 52 changes: {
michael@0 53 uri: "http://money.cnn.com",
michael@0 54 description: "new description",
michael@0 55 }
michael@0 56 },
michael@0 57 { livemark: "Livemark1",
michael@0 58 feedUri: "http://rss.wunderground.com/blog/JeffMasters/rss.xml",
michael@0 59 siteUri: "http://www.wunderground.com/blog/JeffMasters/show.html",
michael@0 60 changes: {
michael@0 61 livemark: "LivemarkOne"
michael@0 62 }
michael@0 63 },
michael@0 64 ],
michael@0 65 "menu/folderb": [
michael@0 66 { uri: "http://www.apple.com",
michael@0 67 tags: ["apple", "mac"],
michael@0 68 changes: {
michael@0 69 uri: "http://www.apple.com/iphone/",
michael@0 70 title: "iPhone",
michael@0 71 location: "menu",
michael@0 72 position: "Google",
michael@0 73 tags: []
michael@0 74 }
michael@0 75 }
michael@0 76 ],
michael@0 77 toolbar: [
michael@0 78 { uri: "place:queryType=0&sort=8&maxResults=10&beginTimeRef=1&beginTime=0",
michael@0 79 title: "Visited Today"
michael@0 80 }
michael@0 81 ]
michael@0 82 };
michael@0 83
michael@0 84 // the state of bookmarks after the first 'modify' action has been performed
michael@0 85 // on them
michael@0 86 var bookmarks_after_first_modify = {
michael@0 87 "menu": [
michael@0 88 { uri: "http://www.apple.com/iphone/",
michael@0 89 title: "iPhone",
michael@0 90 before: "Google",
michael@0 91 tags: []
michael@0 92 },
michael@0 93 { uri: "http://www.google.com",
michael@0 94 title: "Google",
michael@0 95 loadInSidebar: false,
michael@0 96 tags: [ "google", "computers", "misc"]
michael@0 97 },
michael@0 98 { uri: "http://bugzilla.mozilla.org/show_bug.cgi?id=%s",
michael@0 99 title: "Bugzilla",
michael@0 100 keyword: "bugzilla"
michael@0 101 },
michael@0 102 { folder: "foldera" },
michael@0 103 { uri: "http://www.mozilla.com" },
michael@0 104 { separator: true },
michael@0 105 { folder: "folderb",
michael@0 106 changes: {
michael@0 107 location: "menu/foldera",
michael@0 108 folder: "Folder B",
michael@0 109 description: "folder description"
michael@0 110 }
michael@0 111 }
michael@0 112 ],
michael@0 113 "menu/foldera": [
michael@0 114 { uri: "http://money.cnn.com",
michael@0 115 title: "http://www.cnn.com",
michael@0 116 description: "new description"
michael@0 117 },
michael@0 118 { livemark: "LivemarkOne",
michael@0 119 feedUri: "http://rss.wunderground.com/blog/JeffMasters/rss.xml",
michael@0 120 siteUri: "http://www.wunderground.com/blog/JeffMasters/show.html"
michael@0 121 }
michael@0 122 ],
michael@0 123 "menu/folderb": [
michael@0 124 { uri: "http://www.yahoo.com",
michael@0 125 title: "testing Yahoo"
michael@0 126 }
michael@0 127 ],
michael@0 128 "toolbar": [
michael@0 129 { uri: "place:queryType=0&sort=8&maxResults=10&beginTimeRef=1&beginTime=0",
michael@0 130 title: "Visited Today"
michael@0 131 }
michael@0 132 ]
michael@0 133 };
michael@0 134
michael@0 135 // a list of bookmarks to delete during a 'delete' action
michael@0 136 var bookmarks_to_delete = {
michael@0 137 "menu": [
michael@0 138 { uri: "http://www.google.com",
michael@0 139 title: "Google",
michael@0 140 loadInSidebar: false,
michael@0 141 tags: [ "google", "computers", "misc" ]
michael@0 142 }
michael@0 143 ]
michael@0 144 };
michael@0 145
michael@0 146 // the state of bookmarks after the second 'modify' action has been performed
michael@0 147 // on them
michael@0 148 var bookmarks_after_second_modify = {
michael@0 149 "menu": [
michael@0 150 { uri: "http://www.apple.com/iphone/",
michael@0 151 title: "iPhone"
michael@0 152 },
michael@0 153 { uri: "http://bugzilla.mozilla.org/show_bug.cgi?id=%s",
michael@0 154 title: "Bugzilla",
michael@0 155 keyword: "bugzilla"
michael@0 156 },
michael@0 157 { folder: "foldera" },
michael@0 158 { uri: "http://www.mozilla.com" },
michael@0 159 { separator: true },
michael@0 160 ],
michael@0 161 "menu/foldera": [
michael@0 162 { uri: "http://money.cnn.com",
michael@0 163 title: "http://www.cnn.com",
michael@0 164 description: "new description"
michael@0 165 },
michael@0 166 { livemark: "LivemarkOne",
michael@0 167 feedUri: "http://rss.wunderground.com/blog/JeffMasters/rss.xml",
michael@0 168 siteUri: "http://www.wunderground.com/blog/JeffMasters/show.html"
michael@0 169 },
michael@0 170 { folder: "Folder B",
michael@0 171 description: "folder description"
michael@0 172 }
michael@0 173 ],
michael@0 174 "menu/foldera/Folder B": [
michael@0 175 { uri: "http://www.yahoo.com",
michael@0 176 title: "testing Yahoo"
michael@0 177 }
michael@0 178 ]
michael@0 179 };
michael@0 180
michael@0 181 // a list of bookmarks which should not be present after the last
michael@0 182 // 'delete' and 'modify' actions
michael@0 183 var bookmarks_absent = {
michael@0 184 "menu": [
michael@0 185 { uri: "http://www.google.com",
michael@0 186 title: "Google"
michael@0 187 },
michael@0 188 { folder: "folderb" },
michael@0 189 { folder: "Folder B" }
michael@0 190 ]
michael@0 191 };
michael@0 192
michael@0 193 /*
michael@0 194 * History asset lists: these define history entries that are used during
michael@0 195 * the test
michael@0 196 */
michael@0 197
michael@0 198 // the initial list of history items to add to the browser
michael@0 199 var history_initial = [
michael@0 200 { uri: "http://www.google.com/",
michael@0 201 title: "Google",
michael@0 202 visits: [
michael@0 203 { type: 1, date: 0 },
michael@0 204 { type: 2, date: -1 }
michael@0 205 ]
michael@0 206 },
michael@0 207 { uri: "http://www.cnn.com/",
michael@0 208 title: "CNN",
michael@0 209 visits: [
michael@0 210 { type: 1, date: -1 },
michael@0 211 { type: 2, date: -36 }
michael@0 212 ]
michael@0 213 },
michael@0 214 { uri: "http://www.google.com/language_tools?hl=en",
michael@0 215 title: "Language Tools",
michael@0 216 visits: [
michael@0 217 { type: 1, date: 0 },
michael@0 218 { type: 2, date: -40 }
michael@0 219 ]
michael@0 220 },
michael@0 221 { uri: "http://www.mozilla.com/",
michael@0 222 title: "Mozilla",
michael@0 223 visits: [
michael@0 224 { type: 1, date: 0 },
michael@0 225 { type: 1, date: -1 },
michael@0 226 { type: 1, date: -20 },
michael@0 227 { type: 2, date: -36 }
michael@0 228 ]
michael@0 229 }
michael@0 230 ];
michael@0 231
michael@0 232 // a list of history entries to delete during a 'delete' action
michael@0 233 var history_to_delete = [
michael@0 234 { uri: "http://www.cnn.com/" },
michael@0 235 { begin: -24,
michael@0 236 end: -1 },
michael@0 237 { host: "www.google.com" }
michael@0 238 ];
michael@0 239
michael@0 240 // the expected history entries after the first 'delete' action
michael@0 241 var history_after_delete = [
michael@0 242 { uri: "http://www.mozilla.com/",
michael@0 243 title: "Mozilla",
michael@0 244 visits: [
michael@0 245 { type: 1,
michael@0 246 date: 0
michael@0 247 },
michael@0 248 { type: 2,
michael@0 249 date: -36
michael@0 250 }
michael@0 251 ]
michael@0 252 }
michael@0 253 ];
michael@0 254
michael@0 255 // history entries expected to not exist after a 'delete' action
michael@0 256 var history_absent = [
michael@0 257 { uri: "http://www.google.com/",
michael@0 258 title: "Google",
michael@0 259 visits: [
michael@0 260 { type: 1,
michael@0 261 date: 0
michael@0 262 },
michael@0 263 { type: 2,
michael@0 264 date: -1
michael@0 265 }
michael@0 266 ]
michael@0 267 },
michael@0 268 { uri: "http://www.cnn.com/",
michael@0 269 title: "CNN",
michael@0 270 visits: [
michael@0 271 { type: 1,
michael@0 272 date: -1
michael@0 273 },
michael@0 274 { type: 2,
michael@0 275 date: -36
michael@0 276 }
michael@0 277 ]
michael@0 278 },
michael@0 279 { uri: "http://www.google.com/language_tools?hl=en",
michael@0 280 title: "Language Tools",
michael@0 281 visits: [
michael@0 282 { type: 1,
michael@0 283 date: 0
michael@0 284 },
michael@0 285 { type: 2,
michael@0 286 date: -40
michael@0 287 }
michael@0 288 ]
michael@0 289 },
michael@0 290 { uri: "http://www.mozilla.com/",
michael@0 291 title: "Mozilla",
michael@0 292 visits: [
michael@0 293 { type: 1,
michael@0 294 date: -1
michael@0 295 },
michael@0 296 { type: 1,
michael@0 297 date: -20
michael@0 298 }
michael@0 299 ]
michael@0 300 }
michael@0 301 ];
michael@0 302
michael@0 303 /*
michael@0 304 * Password asset lists: these define password entries that are used during
michael@0 305 * the test
michael@0 306 */
michael@0 307
michael@0 308 // the initial list of passwords to add to the browser
michael@0 309 var passwords_initial = [
michael@0 310 { hostname: "http://www.example.com",
michael@0 311 submitURL: "http://login.example.com",
michael@0 312 username: "joe",
michael@0 313 password: "SeCrEt123",
michael@0 314 usernameField: "uname",
michael@0 315 passwordField: "pword",
michael@0 316 changes: {
michael@0 317 password: "zippity-do-dah"
michael@0 318 }
michael@0 319 },
michael@0 320 { hostname: "http://www.example.com",
michael@0 321 realm: "login",
michael@0 322 username: "joe",
michael@0 323 password: "secretlogin"
michael@0 324 }
michael@0 325 ];
michael@0 326
michael@0 327 // the expected state of passwords after the first 'modify' action
michael@0 328 var passwords_after_first_modify = [
michael@0 329 { hostname: "http://www.example.com",
michael@0 330 submitURL: "http://login.example.com",
michael@0 331 username: "joe",
michael@0 332 password: "zippity-do-dah",
michael@0 333 usernameField: "uname",
michael@0 334 passwordField: "pword"
michael@0 335 },
michael@0 336 { hostname: "http://www.example.com",
michael@0 337 realm: "login",
michael@0 338 username: "joe",
michael@0 339 password: "secretlogin"
michael@0 340 }
michael@0 341 ];
michael@0 342
michael@0 343 // a list of passwords to delete during a 'delete' action
michael@0 344 var passwords_to_delete = [
michael@0 345 { hostname: "http://www.example.com",
michael@0 346 realm: "login",
michael@0 347 username: "joe",
michael@0 348 password: "secretlogin"
michael@0 349 }
michael@0 350 ];
michael@0 351
michael@0 352 // a list of passwords expected to be absent after 'delete' and 'modify'
michael@0 353 // actions
michael@0 354 var passwords_absent = [
michael@0 355 { hostname: "http://www.example.com",
michael@0 356 realm: "login",
michael@0 357 username: "joe",
michael@0 358 password: "secretlogin"
michael@0 359 }
michael@0 360 ];
michael@0 361
michael@0 362 // the expected state of passwords after the seconds 'modify' action
michael@0 363 var passwords_after_second_modify = [
michael@0 364 { hostname: "http://www.example.com",
michael@0 365 submitURL: "http://login.example.com",
michael@0 366 username: "joe",
michael@0 367 password: "zippity-do-dah",
michael@0 368 usernameField: "uname",
michael@0 369 passwordField: "pword"
michael@0 370 }
michael@0 371 ];
michael@0 372
michael@0 373 /*
michael@0 374 * Test phases
michael@0 375 */
michael@0 376
michael@0 377 Phase('phase1', [
michael@0 378 [Bookmarks.add, bookmarks_initial],
michael@0 379 [Passwords.add, passwords_initial],
michael@0 380 [History.add, history_initial],
michael@0 381 [Sync],
michael@0 382 ]);
michael@0 383
michael@0 384 Phase('phase2', [
michael@0 385 [Sync],
michael@0 386 [Bookmarks.verify, bookmarks_initial],
michael@0 387 [Passwords.verify, passwords_initial],
michael@0 388 [History.verify, history_initial],
michael@0 389 [Bookmarks.modify, bookmarks_initial],
michael@0 390 [Passwords.modify, passwords_initial],
michael@0 391 [History.delete, history_to_delete],
michael@0 392 [Bookmarks.verify, bookmarks_after_first_modify],
michael@0 393 [Passwords.verify, passwords_after_first_modify],
michael@0 394 [History.verify, history_after_delete],
michael@0 395 [History.verifyNot, history_absent],
michael@0 396 [Sync],
michael@0 397 ]);
michael@0 398
michael@0 399 Phase('phase3', [
michael@0 400 [Sync],
michael@0 401 [Bookmarks.verify, bookmarks_after_first_modify],
michael@0 402 [Passwords.verify, passwords_after_first_modify],
michael@0 403 [History.verify, history_after_delete],
michael@0 404 [Bookmarks.modify, bookmarks_after_first_modify],
michael@0 405 [Passwords.modify, passwords_after_first_modify],
michael@0 406 [Bookmarks.delete, bookmarks_to_delete],
michael@0 407 [Passwords.delete, passwords_to_delete],
michael@0 408 [Bookmarks.verify, bookmarks_after_second_modify],
michael@0 409 [Passwords.verify, passwords_after_second_modify],
michael@0 410 [Bookmarks.verifyNot, bookmarks_absent],
michael@0 411 [Passwords.verifyNot, passwords_absent],
michael@0 412 [Sync],
michael@0 413 ]);
michael@0 414
michael@0 415 Phase('phase4', [
michael@0 416 [Sync],
michael@0 417 [Bookmarks.verify, bookmarks_after_second_modify],
michael@0 418 [Passwords.verify, passwords_after_second_modify],
michael@0 419 [Bookmarks.verifyNot, bookmarks_absent],
michael@0 420 [Passwords.verifyNot, passwords_absent],
michael@0 421 [History.verifyNot, history_absent],
michael@0 422 ]);
michael@0 423
michael@0 424

mercurial