Bug 1333484 - Make Firefox refresh marionette test not rely on previous tests. r=mikedeboer, a=test-only
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 24 Jan 2017 18:29:46 +0000
changeset 378947 fb836ee72ce6953b44ec4538d72a2cf27c106fc7
parent 378946 42bbb960062c48636be15ad5cef187353a3be84d
child 378948 20dda1bb565d0b18c77e01468c568f68fa1b1396
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer, test-only
bugs1333484
milestone53.0
Bug 1333484 - Make Firefox refresh marionette test not rely on previous tests. r=mikedeboer, a=test-only MozReview-Commit-ID: APQf2XMG8JV
browser/components/migration/tests/marionette/test_refresh_firefox.py
--- a/browser/components/migration/tests/marionette/test_refresh_firefox.py
+++ b/browser/components/migration/tests/marionette/test_refresh_firefox.py
@@ -126,18 +126,26 @@ class TestFirefoxRefresh(MarionetteTestC
                   if (!expectedURLs.length) {
                     gBrowser.removeTabsProgressListener(this);
                     marionetteScriptFinished();
                   }
                 });
               }
             }
           });
+          let expectedTabs = new Set();
           for (let url of expectedURLs) {
-            gBrowser.addTab(url);
+            expectedTabs.add(gBrowser.addTab(url));
+          }
+          // Close any other tabs that might be open:
+          let allTabs = Array.from(gBrowser.tabs);
+          for (let tab of allTabs) {
+            if (!expectedTabs.has(tab)) {
+              gBrowser.removeTab(tab);
+            }
           }
         """, script_args=[self._expectedURLs])
 
     def checkPassword(self):
         loginInfo = self.marionette.execute_script("""
           let ary = Services.logins.findLogins({},
             "test.marionette.mozilla.com",
             "http://test.marionette.mozilla.com/some/form/",
@@ -288,18 +296,17 @@ class TestFirefoxRefresh(MarionetteTestC
               content.window.addEventListener("load", function(event) {
                 content.document.getElementById("errorTryAgain").click();
               }, { once: true });
             }
           };
 
           mm.loadFrameScript("data:application/javascript,(" + fs.toString() + ")()", true);
         """)
-        self.assertSequenceEqual(tabURIs, ["about:blank"] + self._expectedURLs)
-        pass
+        self.assertSequenceEqual(tabURIs, self._expectedURLs)
 
     def checkProfile(self, hasMigrated=False):
         self.checkPassword()
         self.checkBookmark()
         self.checkHistory()
         self.checkFormHistory()
         self.checkCookie()
         if hasMigrated: