Bug 1333484 - make Firefox refresh marionette test not rely on previous tests, r?mikedeboer
MozReview-Commit-ID: APQf2XMG8JV
--- a/browser/components/migration/tests/marionette/test_refresh_firefox.py
+++ b/browser/components/migration/tests/marionette/test_refresh_firefox.py
@@ -125,18 +125,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/",
@@ -270,18 +278,17 @@ class TestFirefoxRefresh(MarionetteTestC
window.addEventListener("SSWindowStateReady", function testSSPostReset() {
window.removeEventListener("SSWindowStateReady", testSSPostReset, false);
Promise.all(gBrowser.browsers.map(b => TabStateFlusher.flush(b))).then(function() {
marionetteScriptFinished([... gBrowser.browsers].map(b => b.currentURI && b.currentURI.spec));
});
}, false);
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: