Bug 1701412: Use bookmark instead of visit for autofill r=eeejay

Previously we relied on adding a visit to prompt the URL bar to autofill, that worked because nightly and release shipped with bookmarks to addons.moz. Beta, however, does not, so we should modify this test to populate the bookmark on all releases.

Differential Revision: https://phabricator.services.mozilla.com/D110571
This commit is contained in:
Morgan Reschenberg 2021-04-01 22:59:54 +00:00
parent 6776a9971c
commit 21cc205fff

View File

@ -8,7 +8,6 @@ loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
XPCOMUtils.defineLazyModuleGetters(this, {
BrowserTestUtils: "resource://testing-common/BrowserTestUtils.jsm",
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.jsm",
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.jsm",
});
@ -21,11 +20,15 @@ async function runTests() {
);
info("Creating new window");
let newWin = await BrowserTestUtils.openNewBrowserWindow();
await PlacesTestUtils.addVisits("http://addons.mozilla.org");
let bookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "addons",
url: Services.io.newURI("http://www.addons.mozilla.org/"),
});
registerCleanupFunction(async function() {
await BrowserTestUtils.closeWindow(newWin);
await PlacesUtils.history.clear();
await PlacesUtils.bookmarks.remove(bookmark);
});
info("Focusing window");
newWin.focus();