summaryrefslogtreecommitdiffstats
path: root/browser/extensions/formautofill/test/mochitest
diff options
context:
space:
mode:
Diffstat (limited to 'browser/extensions/formautofill/test/mochitest')
-rw-r--r--browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form.html1
-rw-r--r--browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form_expiry_select_elements.html1
-rw-r--r--browser/extensions/formautofill/test/mochitest/creditCard/test_preview_highlight_with_multiple_cc_number_fields.html2
-rw-r--r--browser/extensions/formautofill/test/mochitest/formautofill_common.js22
-rw-r--r--browser/extensions/formautofill/test/mochitest/formautofill_parent_utils.js34
-rw-r--r--browser/extensions/formautofill/test/mochitest/test_autofill_and_ordinal_forms.html6
-rw-r--r--browser/extensions/formautofill/test/mochitest/test_form_changes.html3
7 files changed, 15 insertions, 54 deletions
diff --git a/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form.html b/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form.html
index 3d8049f053..a1a3322c4e 100644
--- a/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form.html
+++ b/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form.html
@@ -69,7 +69,6 @@ async function checkIsFormCleared(patch = {}) {
const expectedValue = patch[elem.id] || "";
checkFieldValue(elem, expectedValue);
await checkFieldHighlighted(elem, false);
- await checkFieldPreview(elem, "");
}
}
diff --git a/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form_expiry_select_elements.html b/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form_expiry_select_elements.html
index 4fc989a36e..6ebef3bba1 100644
--- a/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form_expiry_select_elements.html
+++ b/browser/extensions/formautofill/test/mochitest/creditCard/test_clear_form_expiry_select_elements.html
@@ -54,7 +54,6 @@ async function checkIsFormCleared(patch = {}) {
const expectedValue = patch[elem.id] || "";
checkFieldValue(elem, expectedValue);
await checkFieldHighlighted(elem, false);
- await checkFieldPreview(elem, "");
}
}
diff --git a/browser/extensions/formautofill/test/mochitest/creditCard/test_preview_highlight_with_multiple_cc_number_fields.html b/browser/extensions/formautofill/test/mochitest/creditCard/test_preview_highlight_with_multiple_cc_number_fields.html
index 6b0d7a522c..a6d0572ac6 100644
--- a/browser/extensions/formautofill/test/mochitest/creditCard/test_preview_highlight_with_multiple_cc_number_fields.html
+++ b/browser/extensions/formautofill/test/mochitest/creditCard/test_preview_highlight_with_multiple_cc_number_fields.html
@@ -72,9 +72,7 @@ async function checkMultipleCCNumberFormStyle(profile, isPreviewing = true) {
} else {
fillableValue = profile[element.id];
}
- let previewValue = (isPreviewing && fillableValue) || "";
await checkFieldHighlighted(element, !!fillableValue);
- await checkFieldPreview(element, previewValue);
}
}
diff --git a/browser/extensions/formautofill/test/mochitest/formautofill_common.js b/browser/extensions/formautofill/test/mochitest/formautofill_common.js
index 6dbfa7c918..6cdf9ca86b 100644
--- a/browser/extensions/formautofill/test/mochitest/formautofill_common.js
+++ b/browser/extensions/formautofill/test/mochitest/formautofill_common.js
@@ -104,27 +104,6 @@ async function checkFieldHighlighted(elem, expectedValue) {
is(isHighlightApplied, expectedValue, `Checking #${elem.id} highlight style`);
}
-async function checkFieldPreview(elem, expectedValue) {
- is(
- SpecialPowers.wrap(elem).previewValue,
- expectedValue,
- `Checking #${elem.id} previewValue`
- );
- let isTextColorApplied;
- await SimpleTest.promiseWaitForCondition(function checkPreview() {
- const computedStyle = window.getComputedStyle(elem);
- const actualColor = computedStyle.getPropertyValue("color");
- if (elem.disabled) {
- isTextColorApplied = actualColor !== defaultDisabledTextColor;
- } else {
- isTextColorApplied = actualColor !== defaultTextColor;
- }
- return isTextColorApplied === !!expectedValue;
- }, `Checking #${elem.id} preview style`);
-
- is(isTextColorApplied, !!expectedValue, `Checking #${elem.id} preview style`);
-}
-
async function checkFormFieldsStyle(profile, isPreviewing = true) {
const elems = document.querySelectorAll("input, select");
@@ -143,7 +122,6 @@ async function checkFormFieldsStyle(profile, isPreviewing = true) {
(isPreviewing && fillableValue?.toString().replaceAll("*", "•")) || "";
}
await checkFieldHighlighted(elem, !!fillableValue);
- await checkFieldPreview(elem, previewValue);
}
}
diff --git a/browser/extensions/formautofill/test/mochitest/formautofill_parent_utils.js b/browser/extensions/formautofill/test/mochitest/formautofill_parent_utils.js
index c133e535f5..97e62657d3 100644
--- a/browser/extensions/formautofill/test/mochitest/formautofill_parent_utils.js
+++ b/browser/extensions/formautofill/test/mochitest/formautofill_parent_utils.js
@@ -129,11 +129,11 @@ var ParentUtils = {
},
async operateAddress(type, msgData) {
- await this._operateRecord(ADDRESSES_COLLECTION_NAME, ...arguments);
+ await this._operateRecord(ADDRESSES_COLLECTION_NAME, type, msgData);
},
async operateCreditCard(type, msgData) {
- await this._operateRecord(CREDITCARDS_COLLECTION_NAME, ...arguments);
+ await this._operateRecord(CREDITCARDS_COLLECTION_NAME, type, msgData);
},
async cleanUpAddresses() {
@@ -145,11 +145,7 @@ var ParentUtils = {
return;
}
- await this.operateAddress(
- "remove",
- { guids },
- "FormAutofillTest:AddressesCleanedUp"
- );
+ await this.operateAddress("remove", { guids });
},
async cleanUpCreditCards() {
@@ -164,11 +160,7 @@ var ParentUtils = {
return;
}
- await this.operateCreditCard(
- "remove",
- { guids },
- "FormAutofillTest:CreditCardsCleanedUp"
- );
+ await this.operateCreditCard("remove", { guids });
},
setup() {
@@ -268,7 +260,7 @@ addMessageListener("FormAutofillTest:CheckAddresses", msg => {
return ParentUtils.checkAddresses(msg);
});
-addMessageListener("FormAutofillTest:CleanUpAddresses", msg => {
+addMessageListener("FormAutofillTest:CleanUpAddresses", _msg => {
return ParentUtils.cleanUpAddresses();
});
@@ -284,23 +276,21 @@ addMessageListener("FormAutofillTest:CheckCreditCards", msg => {
return ParentUtils.checkCreditCards(msg);
});
-addMessageListener("FormAutofillTest:CleanUpCreditCards", msg => {
+addMessageListener("FormAutofillTest:CleanUpCreditCards", _msg => {
return ParentUtils.cleanUpCreditCards();
});
-addMessageListener("FormAutofillTest:CanTestOSKeyStoreLogin", msg => {
+addMessageListener("FormAutofillTest:CanTestOSKeyStoreLogin", _msg => {
return { canTest: OSKeyStoreTestUtils.canTestOSKeyStoreLogin() };
});
-addMessageListener("FormAutofillTest:OSKeyStoreLogin", async msg => {
- await OSKeyStoreTestUtils.waitForOSKeyStoreLogin(msg.login);
-});
+addMessageListener("FormAutofillTest:OSKeyStoreLogin", msg =>
+ OSKeyStoreTestUtils.waitForOSKeyStoreLogin(msg.login)
+);
-addMessageListener("setup", async () => {
- ParentUtils.setup();
-});
+addMessageListener("setup", async _msg => ParentUtils.setup());
-addMessageListener("cleanup", async () => {
+addMessageListener("cleanup", async _msg => {
destroyed = true;
await ParentUtils.cleanup();
});
diff --git a/browser/extensions/formautofill/test/mochitest/test_autofill_and_ordinal_forms.html b/browser/extensions/formautofill/test/mochitest/test_autofill_and_ordinal_forms.html
index 54efc83359..ab3c08e89a 100644
--- a/browser/extensions/formautofill/test/mochitest/test_autofill_and_ordinal_forms.html
+++ b/browser/extensions/formautofill/test/mochitest/test_autofill_and_ordinal_forms.html
@@ -47,9 +47,8 @@ add_task(async function check_switch_autofill_form_popup() {
checkMenuEntries(
[
`{"primary":"+13453453456","secondary":"123 Sesame Street."}`,
- `{"primary":"","secondary":"","categories":["organization","address","tel","name"],"focusedCategory":"tel"}`,
],
- false
+ true
);
await testMenuEntry(0, "!(el instanceof MozElements.MozAutocompleteRichlistitem)");
@@ -75,9 +74,8 @@ add_task(async function check_switch_autofill_form_popup_back() {
checkMenuEntries(
[
`{"primary":"+13453453456","secondary":"123 Sesame Street."}`,
- `{"primary":"","secondary":"","categories":["organization","address","tel","name"],"focusedCategory":"tel"}`,
],
- false
+ true
);
await testMenuEntry(0, "!(el instanceof MozElements.MozAutocompleteRichlistitem)");
diff --git a/browser/extensions/formautofill/test/mochitest/test_form_changes.html b/browser/extensions/formautofill/test/mochitest/test_form_changes.html
index 2eace91a53..1bfc655328 100644
--- a/browser/extensions/formautofill/test/mochitest/test_form_changes.html
+++ b/browser/extensions/formautofill/test/mochitest/test_form_changes.html
@@ -77,8 +77,7 @@ async function checkFormChangeHappened(formId) {
// Click on an autofilled field would show an autocomplete popup with "clear form" entry
checkMenuEntries([
JSON.stringify({primary: "", secondary: ""}), // Clear Autofill Form
- JSON.stringify({primary: "", secondary: ""}) // FormAutofill Preferemce
- ], false);
+ ], true);
// This is for checking the changes of element removed and added then.
document.querySelector(`#${formId} input[name=address-level2]`).remove();