From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../browser_ie_edge_bookmarks_success_strings.js | 89 ++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 browser/components/migration/tests/browser/browser_ie_edge_bookmarks_success_strings.js (limited to 'browser/components/migration/tests/browser/browser_ie_edge_bookmarks_success_strings.js') diff --git a/browser/components/migration/tests/browser/browser_ie_edge_bookmarks_success_strings.js b/browser/components/migration/tests/browser/browser_ie_edge_bookmarks_success_strings.js new file mode 100644 index 0000000000..ab0b705678 --- /dev/null +++ b/browser/components/migration/tests/browser/browser_ie_edge_bookmarks_success_strings.js @@ -0,0 +1,89 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +/** + * Tests that the progress strings that the Migration Wizard shows + * during migrations for IE and Edge uses the term "Favorites" rather + * then "Bookmarks". + */ +add_task(async function test_ie_edge_bookmarks_success_strings() { + for (let key of ["ie", "edge", "internal-testing"]) { + let sandbox = sinon.createSandbox(); + + sandbox.stub(InternalTestingProfileMigrator, "key").get(() => { + return key; + }); + + sandbox.stub(MigrationUtils, "availableMigratorKeys").get(() => { + return key; + }); + + let testingMigrator = new InternalTestingProfileMigrator(); + sandbox.stub(MigrationUtils, "getMigrator").callsFake(() => { + return Promise.resolve(testingMigrator); + }); + + let migration = waitForTestMigration( + [MigrationUtils.resourceTypes.BOOKMARKS], + [MigrationUtils.resourceTypes.BOOKMARKS], + InternalTestingProfileMigrator.testProfile + ); + + await withMigrationWizardDialog(async prefsWin => { + let dialogBody = prefsWin.document.body; + let wizard = dialogBody.querySelector("migration-wizard"); + let wizardDone = BrowserTestUtils.waitForEvent( + wizard, + "MigrationWizard:DoneMigration" + ); + selectResourceTypesAndStartMigration( + wizard, + [MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS], + key + ); + await migration; + + let dialog = prefsWin.document.querySelector("#migrationWizardDialog"); + let shadow = wizard.openOrClosedShadowRoot; + + // If we were using IE or Edge (EdgeHTLM), then the success message should + // include the word "favorites". Otherwise, we expect it to include + // the word "bookmarks". + let bookmarksProgressGroup = shadow.querySelector( + `.resource-progress-group[data-resource-type="${MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.BOOKMARKS}"` + ); + let successTextElement = + bookmarksProgressGroup.querySelector(".success-text"); + + await BrowserTestUtils.waitForCondition(() => { + return successTextElement.textContent.trim(); + }); + + let successText = successTextElement.textContent.toLowerCase(); + + if (key == "internal-testing") { + Assert.ok( + successText.includes("bookmarks"), + `Success test should refer to bookmarks: ${successText}.` + ); + } else { + Assert.ok( + successText.includes("favorites"), + `Success test should refer to favorites: ${successText}` + ); + } + + let doneButton = shadow.querySelector( + "div[name='page-progress'] .done-button" + ); + let dialogClosed = BrowserTestUtils.waitForEvent(dialog, "close"); + doneButton.click(); + await dialogClosed; + await wizardDone; + }); + + sandbox.restore(); + } +}); -- cgit v1.2.3