diff options
Diffstat (limited to 'toolkit/components/passwordmgr/test/mochitest')
-rw-r--r-- | toolkit/components/passwordmgr/test/mochitest/test_autocomplete_password_generation_confirm.html | 26 | ||||
-rw-r--r-- | toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html | 6 |
2 files changed, 21 insertions, 11 deletions
diff --git a/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_password_generation_confirm.html b/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_password_generation_confirm.html index 54cb450815..b5db098174 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_password_generation_confirm.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_autocomplete_password_generation_confirm.html @@ -146,21 +146,29 @@ Login Manager test: filling generated passwords into confirm password fields "resetLoginsAndGeneratedPasswords", () => { LoginTestUtils.clearData(); LoginTestUtils.resetGeneratedPasswordsCache(); + return Promise.resolve(); } ); }); function resetLoginsAndGeneratedPasswords() { - return setupScript.sendAsyncMessage("resetLoginsAndGeneratedPasswords"); + return setupScript.sendQuery("resetLoginsAndGeneratedPasswords"); } async function triggerPasswordGeneration(form) { await openPopupOn(form.pword); synthesizeKey("KEY_ArrowDown"); synthesizeKey("KEY_Enter"); + + const storageAddPromise = promiseStorageChanged(["addLogin"]); await SimpleTest.promiseWaitForCondition(() => !!form.pword.value, "Wait for generated password to get filled"); + await storageAddPromise; } + add_setup(async () => { + SpecialPowers.pushPrefEnv({"set": [["signon.webauthn.autocomplete", false]]}); + }) + add_named_task("autocomplete menu contains option to generate password", async () => { await resetLoginsAndGeneratedPasswords(); const form = setContentForTask(formTemplates.form1); @@ -206,7 +214,7 @@ Login Manager test: filling generated passwords into confirm password fields await resetLoginsAndGeneratedPasswords(); const form = setContentForTask(formTemplates.form1); await triggerPasswordGeneration(form); - is(form.pwordNext.value, form.pword.value, "Value of the confirm field has been filled with generated password"); + await SimpleTest.promiseWaitForCondition(() => form.pword.value == form.pwordNext.value, "Value of the confirm field has been filled with generated password"); }); add_named_task("password field is not masked initially after password generation", async () => { @@ -270,7 +278,7 @@ Login Manager test: filling generated passwords into confirm password fields form.pword.blur(); await messageSentPromise; - is(form.pwordNext.value, generatedPassword, "Value of the confirm field still holds the original generated password"); + await SimpleTest.promiseWaitForCondition(() => form.pwordNext.value == generatedPassword, "Value of the confirm field still holds the original generated password"); ok(form.pwordNext.matches(":autofill"), "Highlight is still applied to password confirmation field"); }); @@ -314,21 +322,21 @@ Login Manager test: filling generated passwords into confirm password fields form.pwordNext.focus() sendString("edited value"); await triggerPasswordGeneration(form); - is(form.pwordNext.value, "edited value", "Value of the confirm field has been filled with generated password"); + await SimpleTest.promiseWaitForCondition(() => form.pwordNext.value == "edited value", "Value of the confirm field has been filled with generated password"); }); add_named_task("password confirmation does not get filled with the generated password if its readonly", async () => { await resetLoginsAndGeneratedPasswords(); const form = setContentForTask(formTemplates.form3); await triggerPasswordGeneration(form); - is(form.pwordNext.value, "", "Value of the confirm field has been filled with generated password"); + await SimpleTest.promiseWaitForCondition(() => form.pwordNext.value == "", "Value of the confirm field has been filled with generated password"); }); add_named_task("password confirmation does not get filled with the generated password if its disabled", async () => { await resetLoginsAndGeneratedPasswords(); const form = setContentForTask(formTemplates.form4); await triggerPasswordGeneration(form); - is(form.pwordNext.value, "", "Value of the confirm field has been filled with generated password"); + await SimpleTest.promiseWaitForCondition(() => form.pwordNext.value == "", "Value of the confirm field has been filled with generated password"); }); add_named_task("password confirmation matching autocomplete info gets filled with the generated password", async () => { @@ -336,14 +344,14 @@ Login Manager test: filling generated passwords into confirm password fields const form = setContentForTask(formTemplates.form5); await triggerPasswordGeneration(form); is(form.pwordBetween.value, "", "Value of the between field has not been filled"); - is(form.pwordNext.value, form.pword.value, "Value of the confirm field has been filled with generated password"); + await SimpleTest.promiseWaitForCondition(() => form.pwordNext.value == form.pword.value, "Value of the confirm field has been filled with generated password"); }); add_named_task("password confirmation matching autocomplete info gets ignored if its disabled, even if has autocomplete info", async () => { await resetLoginsAndGeneratedPasswords(); const form = setContentForTask(formTemplates.form6); await triggerPasswordGeneration(form); - is(form.pwordNext.value, form.pword.value, "Value of the confirm field has been filled with generated password"); + await SimpleTest.promiseWaitForCondition(() => form.pwordNext.value == form.pword.value, "Value of the confirm field has been filled with generated password"); is(form.pwordAfter.value, "", "Value of the disabled confirmation field has not been filled"); }); @@ -365,7 +373,7 @@ Login Manager test: filling generated passwords into confirm password fields await resetLoginsAndGeneratedPasswords(); const form = setContentForTask(formTemplates.form9); await triggerPasswordGeneration(form); - is(form.pwordNext.value, form.pword.value, "Value of the confirm field has been filled with generated password"); + await SimpleTest.promiseWaitForCondition(() => form.pwordNext.value == form.pword.value, "Value of the confirm field has been filled with generated password"); }); add_named_task("do not fill third password field after the confirm-password field", async () => { diff --git a/toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html b/toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html index 803197c2a2..ae4586f1bb 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_autofocus_js.html @@ -22,6 +22,8 @@ const iframe = document.getElementsByTagName("iframe")[0]; let iframeDoc, hostname; add_setup(async () => { + SpecialPowers.pushPrefEnv({"set": [["signon.webauthn.autocomplete", false]]}); + const origin = window.location.origin; await setStoredLoginsAsync( [origin, origin, null, "name", "pass"], @@ -96,9 +98,9 @@ add_task(async function test_not_reopened_after_selecting() { listenForUnexpectedPopupShown(); await SpecialPowers.spawn(getIframeBrowsingContext(window), [], function() { - let formFillController = SpecialPowers.getFormFillController(); + const actor = content.windowGlobalChild.getActor("AutoComplete"); let usernameField = this.content.document.getElementById("form-basic-username"); - formFillController.markAsLoginManagerField(usernameField); + actor.markAsAutoCompletableField(usernameField); }); info("Waiting to see if a popupshown occurs"); |