Bug 1550122 - Fix browser_loginItemErrors.js
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Fri, 30 Aug 2019 05:23:18 +0000
changeset 490814 089a6046448590315f1c6df32aeb2a37423543ea
parent 490813 725115d70e4f7c4fbd18ff7be5b181a86ba46e3f
child 490815 00deeb71f9cd43808988d05805d47f40bbfd5164
push id94055
push usermozilla@noorenberghe.ca
push dateFri, 30 Aug 2019 05:24:06 +0000
treeherderautoland@089a60464485 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1550122
milestone70.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 1550122 - Fix browser_loginItemErrors.js Differential Revision: https://phabricator.services.mozilla.com/D44107
browser/components/aboutlogins/tests/browser/browser_loginItemErrors.js
--- a/browser/components/aboutlogins/tests/browser/browser_loginItemErrors.js
+++ b/browser/components/aboutlogins/tests/browser/browser_loginItemErrors.js
@@ -10,18 +10,18 @@ add_task(async function setup() {
     BrowserTestUtils.removeTab(gBrowser.selectedTab);
     Services.logins.removeAllLogins();
   });
 });
 
 add_task(async function test_showLoginItemErrors() {
   const browser = gBrowser.selectedBrowser;
   let LOGIN_TO_UPDATE = new nsLoginInfo(
-    "https://example.com/",
-    "https://example.com/",
+    "https://example.com",
+    "https://example.com",
     null,
     "user2",
     "pass2"
   );
   LOGIN_TO_UPDATE = Services.logins.addLogin(LOGIN_TO_UPDATE);
 
   await ContentTask.spawn(
     browser,
@@ -36,31 +36,31 @@ add_task(async function test_showLoginIt
       const loginList = Cu.waiveXrays(
         content.document.querySelector("login-list")
       );
 
       const createButton = loginList._createLoginButton;
       createButton.click();
 
       const loginUpdates = {
-        origin: "https://example.com/",
+        origin: "https://example.com",
         password: "my1GoodPassword",
         username: "user1",
       };
 
       const event = Cu.cloneInto(
         {
           bubbles: true,
           detail: loginUpdates,
         },
         content
       );
 
       content.dispatchEvent(
-        // adds first lgoin
+        // adds first login
         new content.CustomEvent("AboutLoginsCreateLogin", event)
       );
 
       ok(
         loginItemErrorMessage.hidden,
         "An error message should not be displayed after adding a new login."
       );
 
@@ -99,22 +99,30 @@ add_task(async function test_showLoginIt
       ok(
         loginItemErrorMessage.hidden,
         "The error message should no longer be visible."
       );
 
       const editButton = loginItem.shadowRoot.querySelector(".edit-button");
       editButton.click();
 
+      const updateEvent = Cu.cloneInto(
+        {
+          bubbles: true,
+          detail: Object.assign({guid: loginToUpdate.guid}, loginUpdates),
+        },
+        content
+      );
+
       content.dispatchEvent(
         // attempt to update LOGIN_TO_UPDATE to a username/origin combination that already exists.
-        new content.CustomEvent("AboutLoginsUpdateLogin", event)
+        new content.CustomEvent("AboutLoginsUpdateLogin", updateEvent)
       );
 
-      const loginAlreadyExistsErrorShownAfterUpdate = ContentTaskUtils.waitForCondition(
+      const loginAlreadyExistsErrorShownAfterUpdate = await ContentTaskUtils.waitForCondition(
         () => {
           return !loginItemErrorMessage.hidden;
         },
         "Waiting for error message to show after updating login to existing login."
       );
       ok(
         loginAlreadyExistsErrorShownAfterUpdate,
         "An error message should be shown after updating a login to a username/origin combination that already exists."