Bug 1303515 - Part 3: Add plain mochitest for address autofill and merge. r=lchang
authorsteveck-chung <schung@mozilla.com>
Thu, 15 Jun 2017 12:02:43 +0800
changeset 366939 bf0d8b3a56b77a3e908d545eba10dcb8abf3de74
parent 366938 2854c4f6e026f6b30a68c2efc004a9c3f1ebfd6e
child 366940 c3f7c2d4303f5a79550ffcdc4a471b454262b1cd
push id45768
push userryanvm@gmail.com
push dateFri, 30 Jun 2017 13:49:49 +0000
treeherderautoland@bf0d8b3a56b7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslchang
bugs1303515
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1303515 - Part 3: Add plain mochitest for address autofill and merge. r=lchang MozReview-Commit-ID: 1RvKA3fED3r
browser/extensions/formautofill/test/mochitest/test_on_address_submission.html
--- a/browser/extensions/formautofill/test/mochitest/test_on_address_submission.html
+++ b/browser/extensions/formautofill/test/mochitest/test_on_address_submission.html
@@ -94,16 +94,36 @@ add_task(async function new_address_subm
   // Check if timesUsed is set correctly
   expectedAddresses[0].timesUsed = 2;
   await onAddressChanged("merge");
   let matching = await checkAddresses(expectedAddresses);
   ok(matching, "Address merged as expected");
   delete expectedAddresses[0].timesUsed;
 });
 
+// Submit an updated autofill address and merge.
+add_task(async function check_storage_after_form_submitted() {
+  document.querySelector("form").reset();
+  // Add country to second address in storage
+  await setInput("#country", "US");
+  TEST_ADDRESSES[1].country = "US";
+
+  await setInput("#organization", "Moz");
+  doKey("down");
+  await expectPopup();
+  doKey("down");
+  doKey("return");
+  clickOnElement("input[type=submit]");
+
+  let expectedAddresses = TEST_ADDRESSES.slice(0);
+  await onAddressChanged("merge");
+  let matching = await checkAddresses(expectedAddresses);
+  ok(matching, "Updated address merged as expected");
+});
+
 </script>
 
 <div>
 
   <form onsubmit="return false">
     <p>This is a basic form for submitting test.</p>
     <p><label>organization: <input id="organization" name="organization" autocomplete="organization" type="text"></label></p>
     <p><label>streetAddress: <input id="street-address" name="street-address" autocomplete="street-address" type="text"></label></p>