Bug 1824640 - Write a test that ensures that if there are no browser profile migrators available, the new Migration Wizard is sent to the NO_BROWSERS_FOUND page. r=mconley.

Differential Revision: https://phabricator.services.mozilla.com/D175149
This commit is contained in:
Brian 2023-04-18 14:09:31 +00:00
parent 5dfafa520f
commit bea51f604f
2 changed files with 45 additions and 0 deletions

View File

@ -16,6 +16,7 @@ skip-if = os == "win" && debug # Bug 1827995
support-files =
dummy_file.csv
[browser_ie_edge_bookmarks_success_strings.js]
[browser_no_browsers_state.js]
[browser_only_file_migrators.js]
[browser_safari_permissions.js]
run-if =

View File

@ -0,0 +1,44 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Tests that the wizard switches to the NO_BROWSERS_FOUND page
* when no migrators are detected.
*/
add_task(async function test_browser_no_programs() {
let sandbox = sinon.createSandbox();
registerCleanupFunction(() => {
sandbox.restore();
});
sandbox.stub(MigrationUtils, "availableMigratorKeys").get(() => {
return [];
});
await withMigrationWizardDialog(async prefsWin => {
let dialog = prefsWin.document.querySelector("#migrationWizardDialog");
let wizard = dialog.querySelector("migration-wizard");
let shadow = wizard.openOrClosedShadowRoot;
let deck = shadow.querySelector("#wizard-deck");
await BrowserTestUtils.waitForMutationCondition(
deck,
{ attributeFilter: ["selected-view"] },
() => {
return (
deck.getAttribute("selected-view") ==
"page-" + MigrationWizardConstants.PAGES.NO_BROWSERS_FOUND
);
}
);
Assert.ok(
true,
"Went to no browser page after attempting to search for migrators."
);
});
sandbox.restore();
});