|
297 | 297 | is(form.pword.value, "", "password is empty");
|
298 | 298 | });
|
299 | 299 |
|
300 |
| - add_named_task("delete", async () => { |
| 300 | + add_named_task("do not delete last", async () => { |
301 | 301 | await setStoredLoginsDuringTask(
|
302 | 302 | [location.origin, "https://autocomplete:8888", null, "user-1", "pass-1", "uname", "pword"],
|
303 | 303 | [location.origin, "https://autocomplete:8888", null, "user-2", "pass-2", "uname", "pword"],
|
|
309 | 309 | form.uname.focus();
|
310 | 310 | await popupByArrowDown();
|
311 | 311 |
|
312 |
| - // XXX tried sending character "t" before/during dropdown to test |
313 |
| - // filtering, but had no luck. Seemed like the character was getting lost. |
314 |
| - // Setting uname.value didn't seem to work either. This works with a human |
315 |
| - // driver, so I'm not sure what's up. |
316 |
| - |
317 |
| - // Delete the first entry (of 3), "user-1" |
| 312 | + // Try and fail to delete the last entry (of 3), "user-3" |
318 | 313 | synthesizeKey("KEY_ArrowDown");
|
319 |
| - const numLoginsBeforeDeletion = await LoginManager.countLogins(location.origin, "https://autocomplete:8888", null); |
320 |
| - is(numLoginsBeforeDeletion, 3, "Correct number of logins before deleting one"); |
321 |
| - |
322 |
| - const countChangedPromise = notifyMenuChanged(3); |
323 |
| - const deletionPromise = promiseStorageChanged(["removeLogin"]); |
324 |
| - // On OS X, shift-backspace and shift-delete work, just delete does not. |
325 |
| - // On Win/Linux, shift-backspace does not work, delete and shift-delete do. |
326 |
| - synthesizeKey("KEY_Delete", {shiftKey: true}); |
327 |
| - await deletionPromise; |
328 |
| - |
329 |
| - is(form.uname.value, "", "username is empty"); |
330 |
| - is(form.pword.value, "", "password is empty"); |
331 |
| - const numLoginsAfterDeletion = await LoginManager.countLogins(location.origin, "https://autocomplete:8888", null); |
332 |
| - is(numLoginsAfterDeletion, 2, "Correct number of logins after deleting one"); |
333 |
| - await countChangedPromise; |
334 |
| - synthesizeKey("KEY_Enter"); |
335 |
| - await untilAutocompletePopupClosed(); |
336 |
| - is(form.uname.value, "user-2", "username is set"); |
337 |
| - is(form.pword.value, "pass-2", "password is set"); |
338 |
| - }); |
339 |
| - |
340 |
| - add_named_task("delete second", async () => { |
341 |
| - await setStoredLoginsDuringTask( |
342 |
| - [location.origin, "https://autocomplete:8888", null, "user-1", "pass-1", "uname", "pword"], |
343 |
| - [location.origin, "https://autocomplete:8888", null, "user-2", "pass-2", "uname", "pword"], |
344 |
| - [location.origin, "https://autocomplete:8888", null, "user-3", "pass-3", "uname", "pword"] |
345 |
| - ); |
346 |
| - const form = setContentForTask(formTemplate); |
347 |
| - const autofillResult = await formAutofillResult(form.id); |
348 |
| - is(autofillResult, "multiple_logins", "form has not been filled due to multiple logins"); |
349 |
| - form.uname.focus(); |
350 |
| - await popupByArrowDown(); |
351 |
| - |
352 |
| - // Delete the second entry (of 3), "user-2" |
353 | 314 | synthesizeKey("KEY_ArrowDown");
|
354 | 315 | synthesizeKey("KEY_ArrowDown");
|
| 316 | + const numLoginsBeforeDeletion = await LoginManager.countLogins(location.origin, "https://autocomplete:8888", null); |
| 317 | + is(numLoginsBeforeDeletion, 3, "Correct number of logins before trying to delete one using an autocomplete form"); |
| 318 | + // Pressing the delete key shouldn't remove a login. |
355 | 319 | synthesizeKey("KEY_Delete", {shiftKey: true});
|
356 | 320 | is(form.uname.value, "", "username is empty");
|
357 | 321 | is(form.pword.value, "", "password is empty");
|
358 |
| - const numLoginsAfterDeletion = await LoginManager.countLogins(location.origin, "https://autocomplete:8888", null); |
359 |
| - is(numLoginsAfterDeletion, 2, "Correct number of logins after deleting one"); |
| 322 | + const numLoginsAfterAttemptedDeletion = await LoginManager.countLogins(location.origin, "https://autocomplete:8888", null); |
| 323 | + is(numLoginsAfterAttemptedDeletion, 3, "Correct number of logins after trying to delete one using an autocomplete form"); |
360 | 324 | synthesizeKey("KEY_Enter");
|
361 | 325 | await untilAutocompletePopupClosed();
|
362 | 326 | is(form.uname.value, "user-3", "username is set");
|
363 | 327 | is(form.pword.value, "pass-3", "password is set");
|
364 | 328 | });
|
365 | 329 |
|
366 |
| - add_named_task("delete last", async () => { |
367 |
| - await setStoredLoginsDuringTask( |
368 |
| - [location.origin, "https://autocomplete:8888", null, "user-1", "pass-1", "uname", "pword"], |
369 |
| - [location.origin, "https://autocomplete:8888", null, "user-2", "pass-2", "uname", "pword"], |
370 |
| - [location.origin, "https://autocomplete:8888", null, "user-3", "pass-3", "uname", "pword"] |
371 |
| - ); |
372 |
| - const form = setContentForTask(formTemplate); |
373 |
| - const autofillResult = await formAutofillResult(form.id); |
374 |
| - is(autofillResult, "multiple_logins", "form has not been filled due to multiple logins"); |
375 |
| - form.uname.focus(); |
376 |
| - await popupByArrowDown(); |
377 |
| - |
378 |
| - /* test 54 */ |
379 |
| - // Delete the last entry (of 3), "user-3" |
380 |
| - synthesizeKey("KEY_ArrowDown"); |
381 |
| - synthesizeKey("KEY_ArrowDown"); |
382 |
| - synthesizeKey("KEY_ArrowDown"); |
383 |
| - const numLoginsBeforeDeletion = await LoginManager.countLogins(location.origin, "https://autocomplete:8888", null); |
384 |
| - is(numLoginsBeforeDeletion, 3, "Correct number of logins before deleting one"); |
385 |
| - synthesizeKey("KEY_Delete", {shiftKey: true}); |
386 |
| - is(form.uname.value, "", "username is empty"); |
387 |
| - is(form.pword.value, "", "password is empty"); |
388 |
| - const numLoginsAfterDeletion = await LoginManager.countLogins(location.origin, "https://autocomplete:8888", null); |
389 |
| - is(numLoginsAfterDeletion, 2, "Correct number of logins after deleting one"); |
390 |
| - synthesizeKey("KEY_ArrowDown"); |
391 |
| - synthesizeKey("KEY_Enter"); |
392 |
| - await untilAutocompletePopupClosed(); |
393 |
| - is(form.uname.value, "user-1", "username is set"); |
394 |
| - is(form.pword.value, "pass-1", "password is set"); |
395 |
| - }); |
396 |
| - |
397 | 330 | // Tests for single-user forms for ignoring autocomplete=off */
|
398 | 331 |
|
399 | 332 | add_named_task("default", async () => {
|
|
0 commit comments